From 31c827abc8b9420b0050b960a141fb0d5dd7077e Mon Sep 17 00:00:00 2001 From: Haytham AbuelFutuh Date: Thu, 3 Dec 2020 13:19:29 -0800 Subject: [PATCH] [Compiler] When multiple nodes call the same workflow, the compiler attempts to validate an already compiled WF (#210) --- flytepropeller/pkg/compiler/validators/node.go | 4 ++++ .../pkg/compiler/validators/node_test.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/flytepropeller/pkg/compiler/validators/node.go b/flytepropeller/pkg/compiler/validators/node.go index aa5c8eee68..c328ba2b1b 100644 --- a/flytepropeller/pkg/compiler/validators/node.go +++ b/flytepropeller/pkg/compiler/validators/node.go @@ -120,6 +120,10 @@ func ValidateNode(w c.WorkflowBuilder, n c.NodeBuilder, validateConditionTypes b errs.Collect(errors.NewValueRequiredErr("", "Id")) } + if n.GetId() == c.StartNodeID || n.GetId() == c.EndNodeID { + return true + } + if _, ifaceOk := ValidateUnderlyingInterface(w, n, errs.NewScope()); ifaceOk { // Validate node output aliases validateEffectiveOutputParameters(n, errs.NewScope()) diff --git a/flytepropeller/pkg/compiler/validators/node_test.go b/flytepropeller/pkg/compiler/validators/node_test.go index aff59e9b0d..70d72100f0 100644 --- a/flytepropeller/pkg/compiler/validators/node_test.go +++ b/flytepropeller/pkg/compiler/validators/node_test.go @@ -3,6 +3,8 @@ package validators import ( "testing" + "github.com/lyft/flytepropeller/pkg/compiler/common" + "github.com/lyft/flyteidl/gen/pb-go/flyteidl/core" "github.com/lyft/flytepropeller/pkg/compiler/common/mocks" @@ -33,3 +35,15 @@ func TestValidateBranchNode(t *testing.T) { } }) } + +func TestValidateNode(t *testing.T) { + n := &mocks.NodeBuilder{} + n.OnGetId().Return(common.StartNodeID) + + wf := &mocks.WorkflowBuilder{} + errs := errors.NewCompileErrors() + ValidateNode(wf, n, true, errs) + if errs.HasErrors() { + assert.NoError(t, errs) + } +}