-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathkis_action_test.go
102 lines (80 loc) · 2.3 KB
/
kis_action_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package test
import (
"context"
"fmt"
"testing"
"github.com/aceld/kis-flow/file"
"github.com/aceld/kis-flow/kis"
)
func TestActionAbort(t *testing.T) {
ctx := context.Background()
// 1. Load the configuration file and build the Flow
if err := file.ConfigImportYaml("load_conf/"); err != nil {
fmt.Println("Wrong Config Yaml Path!")
panic(err)
}
// 2. Get the Flow
flow1 := kis.Pool().GetFlow("flowName2")
// 3. Commit original data
_ = flow1.CommitRow("This is Data1 from Test")
_ = flow1.CommitRow("This is Data2 from Test")
_ = flow1.CommitRow("This is Data3 from Test")
// 4. Execute flow1
if err := flow1.Run(ctx); err != nil {
panic(err)
}
}
func TestActionDataReuse(t *testing.T) {
ctx := context.Background()
// 1. Load the configuration file and build the Flow
if err := file.ConfigImportYaml("load_conf/"); err != nil {
fmt.Println("Wrong Config Yaml Path!")
panic(err)
}
// 2. Get the Flow
flow1 := kis.Pool().GetFlow("flowName3")
// 3. Commit original data
_ = flow1.CommitRow("This is Data1 from Test")
_ = flow1.CommitRow("This is Data2 from Test")
_ = flow1.CommitRow("This is Data3 from Test")
// 4. Execute flow1
if err := flow1.Run(ctx); err != nil {
panic(err)
}
}
func TestActionForceEntry(t *testing.T) {
ctx := context.Background()
// 1. Load the configuration file and build the Flow
if err := file.ConfigImportYaml("load_conf/"); err != nil {
fmt.Println("Wrong Config Yaml Path!")
panic(err)
}
// 2. Get the Flow
flow1 := kis.Pool().GetFlow("flowName4")
// 3. Commit original data
_ = flow1.CommitRow("This is Data1 from Test")
_ = flow1.CommitRow("This is Data2 from Test")
_ = flow1.CommitRow("This is Data3 from Test")
// 4. Execute flow1
if err := flow1.Run(ctx); err != nil {
panic(err)
}
}
func TestActionJumpFunc(t *testing.T) {
ctx := context.Background()
// 1. Load the configuration file and build the Flow
if err := file.ConfigImportYaml("load_conf/"); err != nil {
fmt.Println("Wrong Config Yaml Path!")
panic(err)
}
// 2. Get the Flow
flow1 := kis.Pool().GetFlow("flowName5")
// 3. Commit original data
_ = flow1.CommitRow("This is Data1 from Test")
_ = flow1.CommitRow("This is Data2 from Test")
_ = flow1.CommitRow("This is Data3 from Test")
// 4. Execute flow1
if err := flow1.Run(ctx); err != nil {
panic(err)
}
}