From c6dff3f2b406d781b79ba1f08389dd4399e60678 Mon Sep 17 00:00:00 2001 From: pmahindrakar-oss Date: Tue, 21 Sep 2021 12:42:09 +0530 Subject: [PATCH] Schema support idl update (#182) * Schema support idl update Signed-off-by: Prafulla Mahindrakar * Added released idl version Signed-off-by: Prafulla Mahindrakar * Fixed flaky tests Signed-off-by: Prafulla Mahindrakar --- flytectl/cmd/get/execution_test.go | 120 --------------------------- flytectl/cmd/upgrade/upgrade_test.go | 2 +- flytectl/go.mod | 2 +- flytectl/go.sum | 4 +- 4 files changed, 4 insertions(+), 124 deletions(-) diff --git a/flytectl/cmd/get/execution_test.go b/flytectl/cmd/get/execution_test.go index 6589e4df2d..bcedf1f6d3 100644 --- a/flytectl/cmd/get/execution_test.go +++ b/flytectl/cmd/get/execution_test.go @@ -262,126 +262,6 @@ func TestGetExecutionFuncWithIOData(t *testing.T) { err = getExecutionFunc(ctx, args, mockCmdCtx) assert.Nil(t, err) }) - t.Run("invalid inputs", func(t *testing.T) { - setup() - getExecutionSetup() - ctx := u.Ctx - mockCmdCtx := u.CmdCtx - mockClient = u.MockClient - mockFetcherExt := u.FetcherExt - execution.DefaultConfig.NodeID = nodeID - args := []string{dummyExec} - - nodeExec1 := createDummyNodeWithID("n0", false) - taskExec1 := createDummyTaskExecutionForNode("n0", "task21") - taskExec2 := createDummyTaskExecutionForNode("n0", "task22") - - nodeExecutions := []*admin.NodeExecution{nodeExec1} - nodeExecList := &admin.NodeExecutionList{NodeExecutions: nodeExecutions} - - inputs := map[string]*core.Literal{ - "val1": &core.Literal{ - Value: &core.Literal_Scalar{ - Scalar: &core.Scalar{ - Value: &core.Scalar_Schema{}, - }, - }, - }, - } - outputs := map[string]*core.Literal{ - "o2": &core.Literal{ - Value: &core.Literal_Scalar{ - Scalar: &core.Scalar{ - Value: &core.Scalar_Primitive{ - Primitive: &core.Primitive{ - Value: &core.Primitive_Integer{ - Integer: 120, - }, - }, - }, - }, - }, - }, - } - dataResp := &admin.NodeExecutionGetDataResponse{ - FullOutputs: &core.LiteralMap{ - Literals: inputs, - }, - FullInputs: &core.LiteralMap{ - Literals: outputs, - }, - } - mockFetcherExt.OnFetchExecutionMatch(ctx, dummyExec, dummyProject, dummyDomain).Return(&admin.Execution{}, nil) - mockFetcherExt.OnFetchNodeExecutionDetailsMatch(ctx, dummyExec, dummyProject, dummyDomain, "").Return(nodeExecList, nil) - mockFetcherExt.OnFetchTaskExecutionsOnNodeMatch(ctx, "n0", dummyExec, dummyProject, dummyDomain).Return(&admin.TaskExecutionList{ - TaskExecutions: []*admin.TaskExecution{taskExec1, taskExec2}, - }, nil) - mockFetcherExt.OnFetchNodeExecutionDataMatch(ctx, mock.Anything, dummyExec, dummyProject, dummyDomain).Return(dataResp, nil) - - err = getExecutionFunc(ctx, args, mockCmdCtx) - assert.NotNil(t, err) - assert.Equal(t, fmt.Errorf("unsupported literal scalar type *core.Scalar_Schema"), err) - }) - t.Run("invalid outputs", func(t *testing.T) { - setup() - getExecutionSetup() - ctx := u.Ctx - mockCmdCtx := u.CmdCtx - mockClient = u.MockClient - mockFetcherExt := u.FetcherExt - execution.DefaultConfig.NodeID = nodeID - args := []string{dummyExec} - - nodeExec1 := createDummyNodeWithID("n0", false) - taskExec1 := createDummyTaskExecutionForNode("n0", "task21") - taskExec2 := createDummyTaskExecutionForNode("n0", "task22") - - nodeExecutions := []*admin.NodeExecution{nodeExec1} - nodeExecList := &admin.NodeExecutionList{NodeExecutions: nodeExecutions} - - inputs := map[string]*core.Literal{ - "val1": &core.Literal{ - Value: &core.Literal_Scalar{ - Scalar: &core.Scalar{ - Value: &core.Scalar_Primitive{ - Primitive: &core.Primitive{ - Value: &core.Primitive_Integer{ - Integer: 120, - }, - }, - }, - }, - }, - }, - } - outputs := map[string]*core.Literal{ - "o2": &core.Literal{ - Value: &core.Literal_Scalar{ - Scalar: &core.Scalar{ - Value: &core.Scalar_Schema{}, - }, - }, - }, - } - dataResp := &admin.NodeExecutionGetDataResponse{ - FullOutputs: &core.LiteralMap{ - Literals: inputs, - }, - FullInputs: &core.LiteralMap{ - Literals: outputs, - }, - } - mockFetcherExt.OnFetchExecutionMatch(ctx, dummyExec, dummyProject, dummyDomain).Return(&admin.Execution{}, nil) - mockFetcherExt.OnFetchNodeExecutionDetailsMatch(ctx, dummyExec, dummyProject, dummyDomain, "").Return(nodeExecList, nil) - mockFetcherExt.OnFetchTaskExecutionsOnNodeMatch(ctx, "n0", dummyExec, dummyProject, dummyDomain).Return(&admin.TaskExecutionList{ - TaskExecutions: []*admin.TaskExecution{taskExec1, taskExec2}, - }, nil) - mockFetcherExt.OnFetchNodeExecutionDataMatch(ctx, mock.Anything, dummyExec, dummyProject, dummyDomain).Return(dataResp, nil) - - err = getExecutionFunc(ctx, args, mockCmdCtx) - assert.NotNil(t, err) - assert.Equal(t, fmt.Errorf("unsupported literal scalar type *core.Scalar_Schema"), err) - }) t.Run("fetch data error from admin", func(t *testing.T) { setup() getExecutionSetup() diff --git a/flytectl/cmd/upgrade/upgrade_test.go b/flytectl/cmd/upgrade/upgrade_test.go index e1996fb24d..213b02afdc 100644 --- a/flytectl/cmd/upgrade/upgrade_test.go +++ b/flytectl/cmd/upgrade/upgrade_test.go @@ -54,7 +54,7 @@ func TestUpgrade(t *testing.T) { t.Run("Successful upgrade", func(t *testing.T) { message, err := upgrade(githubutil.FlytectlReleaseConfig) assert.Nil(t, err) - assert.Equal(t, 39, len(message)) + assert.Contains(t, message, "Successfully updated to version") }) } diff --git a/flytectl/go.mod b/flytectl/go.mod index 94ef0c7047..125993c6d4 100644 --- a/flytectl/go.mod +++ b/flytectl/go.mod @@ -11,7 +11,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 v0.21.0 + github.com/flyteorg/flyteidl v0.21.2 github.com/flyteorg/flytestdlib v0.3.34 github.com/ghodss/yaml v1.0.0 github.com/golang/protobuf v1.4.3 diff --git a/flytectl/go.sum b/flytectl/go.sum index b482ad192a..475f57a778 100644 --- a/flytectl/go.sum +++ b/flytectl/go.sum @@ -345,8 +345,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/flyteorg/flyteidl v0.21.0 h1:AwHNusfxJMfRRSDk2QWfb3aIlyLJrFWVGtpXCbCtJ5A= -github.com/flyteorg/flyteidl v0.21.0/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U= +github.com/flyteorg/flyteidl v0.21.2 h1:7qRC28MueIcElwaqQxtjp483zMFrOjINTH8fjW/sQx0= +github.com/flyteorg/flyteidl v0.21.2/go.mod h1:576W2ViEyjTpT+kEVHAGbrTP3HARNUZ/eCwrNPmdx9U= github.com/flyteorg/flytestdlib v0.3.13/go.mod h1:Tz8JCECAbX6VWGwFT6cmEQ+RJpZ/6L9pswu3fzWs220= github.com/flyteorg/flytestdlib v0.3.34 h1:OOuV03X8c1AWInzBU6IRsqpEF6y8WDJngbPcdL4VktY= github.com/flyteorg/flytestdlib v0.3.34/go.mod h1:7cDWkY3v7xsoesFcDdu6DSW5Q2U2W5KlHUbUHSwBG1Q=