|
@@ -16,13 +16,14 @@ package function
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "reflect"
|
|
|
|
+ "testing"
|
|
|
|
+
|
|
"github.com/lf-edge/ekuiper/internal/conf"
|
|
"github.com/lf-edge/ekuiper/internal/conf"
|
|
kctx "github.com/lf-edge/ekuiper/internal/topo/context"
|
|
kctx "github.com/lf-edge/ekuiper/internal/topo/context"
|
|
"github.com/lf-edge/ekuiper/internal/topo/state"
|
|
"github.com/lf-edge/ekuiper/internal/topo/state"
|
|
"github.com/lf-edge/ekuiper/pkg/api"
|
|
"github.com/lf-edge/ekuiper/pkg/api"
|
|
"github.com/lf-edge/ekuiper/pkg/ast"
|
|
"github.com/lf-edge/ekuiper/pkg/ast"
|
|
- "reflect"
|
|
|
|
- "testing"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func TestChangedColValidation(t *testing.T) {
|
|
func TestChangedColValidation(t *testing.T) {
|
|
@@ -30,7 +31,7 @@ func TestChangedColValidation(t *testing.T) {
|
|
if !ok {
|
|
if !ok {
|
|
t.Fatal("builtin not found")
|
|
t.Fatal("builtin not found")
|
|
}
|
|
}
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []ast.Expr
|
|
args []ast.Expr
|
|
err error
|
|
err error
|
|
}{
|
|
}{
|
|
@@ -76,7 +77,7 @@ func TestChangedColExec(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -147,7 +148,7 @@ func TestChangedColPartition(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -218,7 +219,7 @@ func TestChangedColPartitionWithWhen(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -301,7 +302,7 @@ func TestHadChangedValidation(t *testing.T) {
|
|
if !ok {
|
|
if !ok {
|
|
t.Fatal("builtin not found")
|
|
t.Fatal("builtin not found")
|
|
}
|
|
}
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []ast.Expr
|
|
args []ast.Expr
|
|
err error
|
|
err error
|
|
}{
|
|
}{
|
|
@@ -354,7 +355,7 @@ func TestHadChangedExec(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -457,7 +458,7 @@ func TestHadChangedExecAllowNull(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -569,7 +570,7 @@ func TestHadChangedPartition(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -672,7 +673,7 @@ func TestHadChangedPartitionWithWhen(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 1)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -784,7 +785,7 @@ func TestLagExec(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -846,7 +847,7 @@ func TestLagPartition(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -908,7 +909,7 @@ func TestLagExecWithWhen(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -970,7 +971,7 @@ func TestLagPartitionWithWhen(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -1032,7 +1033,7 @@ func TestLagExecIndexWithDefaultValue(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -1104,7 +1105,7 @@ func TestLagExecIndex(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -1171,7 +1172,7 @@ func TestLatestExec(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -1233,7 +1234,7 @@ func TestLatestExecWithWhen(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|
|
@@ -1295,7 +1296,7 @@ func TestLatestPartition(t *testing.T) {
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
ctx := kctx.WithValue(kctx.Background(), kctx.LoggerKey, contextLogger)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
tempStore, _ := state.CreateStore("mockRule0", api.AtMostOnce)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
fctx := kctx.NewDefaultFuncContext(ctx.WithMeta("mockRule0", "test", tempStore), 2)
|
|
- var tests = []struct {
|
|
|
|
|
|
+ tests := []struct {
|
|
args []interface{}
|
|
args []interface{}
|
|
result interface{}
|
|
result interface{}
|
|
}{
|
|
}{
|