1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package test
- import (
- "fmt"
- "git.sxidc.com/go-tools/utils/pipeline"
- "git.sxidc.com/go-tools/utils/pipeline/component"
- "git.sxidc.com/go-tools/utils/pipeline/test/test_node"
- "testing"
- )
- func init() {
- err := component.RegisterComponentBuilders(
- &test_node.PrintlnBuilder{}, &test_node.BoolBuilder{},
- )
- if err != nil {
- panic(err)
- }
- }
- func TestPipeline(t *testing.T) {
- p, err := pipeline.NewPipelineFromYaml("def.yaml")
- if err != nil {
- t.Fatal(err)
- }
- dynamicParams, err := pipeline.LoadDynamicParamsFromYaml("value.yaml")
- if err != nil {
- t.Fatal(err)
- }
- globalRunParams := map[string]any{
- "Test": "Global Params",
- }
- token := p.Run(globalRunParams, dynamicParams)
- if token.Wait(); token.Err != nil {
- t.Fatal(token.Err)
- }
- fmt.Println(token.Result)
- }
|