func TestGetNameToNodeInfo(t *testing.T) { pipeline, err := parse.NewParser().ParsePipeline("../parse/testdata/basic") require.NoError(t, err) nodeInfos, err := getNameToNodeInfo(pipeline.NameToNode) require.NoError(t, err) require.Equal(t, []string{"bar-node"}, nodeInfos["baz-node-bar-in-bar-out-in"].Parents) }
func TestBasic(t *testing.T) { pipeline, err := parse.NewParser().ParsePipeline("../parse/testdata/basic", "") require.NoError(t, err) pipelineInfo, err := NewGrapher().GetPipelineInfo(pipeline) require.NoError(t, err) m := pipelineInfo.NameToNodeInfo require.Equal(t, []string{"baz-node-bar-in-bar-out-in"}, m["bar-node"].Children) require.Equal(t, []string{"bar-node"}, m["baz-node-bar-in-bar-out-in"].Parents) }
func getDirPathAndPipeline(pipelineSource *pps.PipelineSource) (string, *pps.Pipeline, error) { if pipelineSource.GithubPipelineSource != nil { dirPath, err := githubClone(pipelineSource.GithubPipelineSource) if err != nil { return "", nil, err } pipeline, err := parse.NewParser().ParsePipeline(dirPath, pipelineSource.GithubPipelineSource.ContextDir) if err != nil { return "", nil, err } return dirPath, pipeline, nil } return "", nil, fmt.Errorf("must specify pipeline source") }
func getDirPathAndPipeline(pipelineSource *pps.PipelineSource) (string, *pps.Pipeline, error) { if pipelineSource.GetGithubPipelineSource() != nil { dirPath, err := githubClone(pipelineSource.GetGithubPipelineSource()) if err != nil { return "", nil, err } dirPath = filepath.Join(dirPath, pipelineSource.GetGithubPipelineSource().ContextDir) pipeline, err := parse.NewParser().ParsePipeline(dirPath) if err != nil { return "", nil, err } pipeline.PipelineSourceId = pipelineSource.Id return dirPath, pipeline, nil } return "", nil, fmt.Errorf("must specify pipeline source") }