Skip to content

Commit

Permalink
Adding support for ArrayNode (flyteorg#406)
Browse files Browse the repository at this point in the history
* hydrating arraynode subnode

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

* updating flyteidl

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

* added unit tests

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

---------

Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Jul 10, 2023
1 parent 95fccea commit 9bcf5cc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 365 deletions.
4 changes: 4 additions & 0 deletions flytectl/cmd/register/register_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ func hydrateNode(node *core.Node, version string, force bool) error {
}
case *core.Node_GateNode:
// Do nothing.
case *core.Node_ArrayNode:
if err := hydrateNode(v.ArrayNode.Node, version, force); err != nil {
return fmt.Errorf("failed to hydrateNode")
}
default:
return fmt.Errorf("unknown type %T", v)
}
Expand Down
27 changes: 27 additions & 0 deletions flytectl/cmd/register/register_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,33 @@ func TestHydrateNode(t *testing.T) {
})
}

func TestHydrateArrayNode(t *testing.T) {
registerFilesSetup()
node := &core.Node{
Target: &core.Node_ArrayNode{
ArrayNode: &core.ArrayNode{
Node: &core.Node{
Target: &core.Node_TaskNode{
TaskNode: &core.TaskNode{
Reference: &core.TaskNode_ReferenceId{
ReferenceId: &core.Identifier{
ResourceType: core.ResourceType_TASK,
Project: "flytesnacks",
Domain: "development",
Name: "n1",
Version: "v1",
},
},
},
},
},
},
},
}
err := hydrateNode(node, rconfig.DefaultFilesConfig.Version, true)
assert.Nil(t, err)
}

func TestHydrateGateNode(t *testing.T) {
t.Run("Hydrate Sleep", func(t *testing.T) {
registerFilesSetup()
Expand Down
2 changes: 1 addition & 1 deletion flytectl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/docker/docker v20.10.7+incompatible
github.com/docker/go-connections v0.4.0
github.com/enescakir/emoji v1.0.0
github.com/flyteorg/flyteidl v1.5.10
github.com/flyteorg/flyteidl v1.5.12
github.com/flyteorg/flytepropeller v1.1.1
github.com/flyteorg/flytestdlib v1.0.13
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
Expand Down
Loading

0 comments on commit 9bcf5cc

Please sign in to comment.