Skip to content

Commit

Permalink
Schema support idl update (#182)
Browse files Browse the repository at this point in the history
* Schema support idl update

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* Added released idl version

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* Fixed flaky tests

Signed-off-by: Prafulla Mahindrakar <[email protected]>
  • Loading branch information
pmahindrakar-oss authored Sep 21, 2021
1 parent 4199e65 commit c6dff3f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 124 deletions.
120 changes: 0 additions & 120 deletions flytectl/cmd/get/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion flytectl/cmd/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}

Expand Down
2 changes: 1 addition & 1 deletion flytectl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions flytectl/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit c6dff3f

Please sign in to comment.