2024-03-04 14:53:29 +08:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-03-20 17:57:41 +08:00
|
|
|
"fmt"
|
2024-03-04 14:53:29 +08:00
|
|
|
"kis-flow/file"
|
|
|
|
"kis-flow/kis"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMetricsDataTotal(t *testing.T) {
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
// 1. 加载配置文件并构建Flow
|
2024-03-20 18:09:08 +08:00
|
|
|
if err := file.ConfigImportYaml("load_conf/"); err != nil {
|
2024-03-20 17:57:41 +08:00
|
|
|
fmt.Println("Wrong Config Yaml Path!")
|
2024-03-04 14:53:29 +08:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 2. 获取Flow
|
|
|
|
flow1 := kis.Pool().GetFlow("flowName1")
|
|
|
|
|
|
|
|
n := 0
|
|
|
|
|
|
|
|
for n < 10 {
|
|
|
|
// 3. 提交原始数据
|
|
|
|
_ = flow1.CommitRow("This is Data1 from Test")
|
|
|
|
|
|
|
|
// 4. 执行flow1
|
|
|
|
if err := flow1.Run(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
n++
|
|
|
|
}
|
|
|
|
|
|
|
|
select {}
|
|
|
|
}
|