diff --git a/flytectl/cmd/register/register_util.go b/flytectl/cmd/register/register_util.go index 0f646c89b5..714e30c76b 100644 --- a/flytectl/cmd/register/register_util.go +++ b/flytectl/cmd/register/register_util.go @@ -245,6 +245,8 @@ func hydrateNode(node *core.Node, version string, force bool) error { default: return fmt.Errorf("unknown type %T", branchNodeWrapper.BranchNode.IfElse.Default) } + case *core.Node_GateNode: + // Do nothing. default: return fmt.Errorf("unknown type %T", v) } diff --git a/flytectl/cmd/register/register_util_test.go b/flytectl/cmd/register/register_util_test.go index 6e31565cec..97a39082d2 100644 --- a/flytectl/cmd/register/register_util_test.go +++ b/flytectl/cmd/register/register_util_test.go @@ -35,6 +35,7 @@ import ( "github.com/stretchr/testify/mock" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/durationpb" ) type MockHTTPClient struct { @@ -501,6 +502,64 @@ func TestHydrateNode(t *testing.T) { }) } +func TestHydrateGateNode(t *testing.T) { + t.Run("Hydrate Sleep", func(t *testing.T) { + registerFilesSetup() + // Write a node that contains a GateNode + node := &core.Node{ + Target: &core.Node_GateNode{ + GateNode: &core.GateNode{ + Condition: &core.GateNode_Sleep{ + Sleep: &core.SleepCondition{ + Duration: &durationpb.Duration{ + Seconds: 10, + }, + }, + }, + }, + }, + } + err := hydrateNode(node, rconfig.DefaultFilesConfig.Version, true) + assert.Nil(t, err) + }) + + t.Run("Hydrate Signal", func(t *testing.T) { + registerFilesSetup() + // Write a node that contains a GateNode + node := &core.Node{ + Target: &core.Node_GateNode{ + GateNode: &core.GateNode{ + Condition: &core.GateNode_Signal{ + Signal: &core.SignalCondition{ + SignalId: "abc", + }, + }, + }, + }, + } + err := hydrateNode(node, rconfig.DefaultFilesConfig.Version, true) + assert.Nil(t, err) + }) + + t.Run("Hydrate Approve", func(t *testing.T) { + registerFilesSetup() + // Write a node that contains a GateNode + node := &core.Node{ + Target: &core.Node_GateNode{ + GateNode: &core.GateNode{ + Condition: &core.GateNode_Approve{ + Approve: &core.ApproveCondition{ + SignalId: "abc", + }, + }, + }, + }, + } + err := hydrateNode(node, rconfig.DefaultFilesConfig.Version, true) + assert.Nil(t, err) + }) +} + func TestHydrateTaskSpec(t *testing.T) { testScope := promutils.NewTestScope() labeled.SetMetricKeys(contextutils.AppNameKey, contextutils.ProjectKey, contextutils.DomainKey)