Skip to content

Commit

Permalink
Fix gate node approve condition node interface binding validation (fl…
Browse files Browse the repository at this point in the history
…yteorg#512)

* added random print statements

Signed-off-by: Dan Rammer <[email protected]>

* random print statement

Signed-off-by: Dan Rammer <[email protected]>

* infering gate node approve condition input and output variables from upstream nodes

Signed-off-by: Dan Rammer <[email protected]>

* removed print statements

Signed-off-by: Dan Rammer <[email protected]>

* fixed unit tests

Signed-off-by: Dan Rammer <[email protected]>

Signed-off-by: Dan Rammer <[email protected]>
  • Loading branch information
hamersaw authored Jan 3, 2023
1 parent 50f1aa4 commit 437fe5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flytepropeller/pkg/compiler/validators/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,14 @@ func ValidateUnderlyingInterface(w c.WorkflowBuilder, node c.NodeBuilder, errs e
case *core.Node_GateNode:
gateNode := node.GetGateNode()
if approve := gateNode.GetApprove(); approve != nil {
// discover inputs / outputs from upstream bindings. output variable are identical to inputs
// because evaluating the approve condition copies the input LiteralMap directly to outputs.
inputVarsFromBindings, _ := ValidateBindings(w, node, node.GetInputs(), &core.VariableMap{Variables: map[string]*core.Variable{}},
false, c.EdgeDirectionUpstream, errs.NewScope())

iface = &core.TypedInterface{
Inputs: &core.VariableMap{Variables: map[string]*core.Variable{}},
Outputs: &core.VariableMap{Variables: map[string]*core.Variable{}},
Inputs: inputVarsFromBindings,
Outputs: inputVarsFromBindings,
}
} else if signal := gateNode.GetSignal(); signal != nil {
if signal.GetType() == nil {
Expand Down
1 change: 1 addition & 0 deletions flytepropeller/pkg/compiler/validators/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func TestValidateUnderlyingInterface(t *testing.T) {
},
})
nodeBuilder.OnGetInterface().Return(nil)
nodeBuilder.OnGetInputs().Return(nil)

nodeBuilder.On("GetGateNode").Return(gateNode)
nodeBuilder.On("GetId").Return("node_1")
Expand Down

0 comments on commit 437fe5d

Please sign in to comment.