From 6644f0f919d79c813142007e04dc1976fb73985d Mon Sep 17 00:00:00 2001 From: Prafulla Mahindrakar Date: Tue, 27 Apr 2021 16:47:58 +0530 Subject: [PATCH] Rebased from master Signed-off-by: Prafulla Mahindrakar --- cmd/update/launch_plan_test.go | 2 +- cmd/update/named_entity_test.go | 2 +- cmd/update/project_test.go | 6 ++++-- cmd/update/task_test.go | 2 +- cmd/update/workflow_test.go | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/update/launch_plan_test.go b/cmd/update/launch_plan_test.go index aa8f8601d..a4725e6ce 100644 --- a/cmd/update/launch_plan_test.go +++ b/cmd/update/launch_plan_test.go @@ -14,7 +14,7 @@ import ( func UpdateLPSetup() { ctx = testutils.Ctx cmdCtx = testutils.CmdCtx - mockClient = testutils.MockClient + mockClient = testutils.MockAdminClient } func TestLPUpdate(t *testing.T) { diff --git a/cmd/update/named_entity_test.go b/cmd/update/named_entity_test.go index 9c322f184..53a804651 100644 --- a/cmd/update/named_entity_test.go +++ b/cmd/update/named_entity_test.go @@ -15,7 +15,7 @@ import ( func NamedEntitySetup() { ctx = testutils.Ctx cmdCtx = testutils.CmdCtx - mockClient = testutils.MockClient + mockClient = testutils.MockAdminClient } func TestNamedEntity(t *testing.T) { diff --git a/cmd/update/project_test.go b/cmd/update/project_test.go index 0cffe8b0f..22abb7922 100644 --- a/cmd/update/project_test.go +++ b/cmd/update/project_test.go @@ -3,8 +3,10 @@ package update import ( "context" "errors" + "fmt" "testing" + "github.com/flyteorg/flytectl/clierrors" "github.com/flyteorg/flytectl/cmd/config" cmdCore "github.com/flyteorg/flytectl/cmd/core" "github.com/flyteorg/flytectl/cmd/testutils" @@ -95,7 +97,7 @@ func TestArchiveProjectFuncWithError(t *testing.T) { func TestEmptyProjectInput(t *testing.T) { setup() createProjectSetup() - defer tearDownAndVerify(t, "Project not passed\n") + defer tearDownAndVerify(t, "Project not passed\n") config.GetConfig().Project = "" modifyProjectFlags(&(projectConfig.ArchiveProject), false, &(projectConfig.ActivateProject), true) mockClient.OnUpdateProjectMatch(ctx, projectUpdateRequest).Return(nil, nil) @@ -107,10 +109,10 @@ func TestEmptyProjectInput(t *testing.T) { func TestInvalidInput(t *testing.T) { setup() createProjectSetup() - defer tearDownAndVerify(t, "Invalid state passed. Specify either activate or archive\n") modifyProjectFlags(&(projectConfig.ArchiveProject), false, &(projectConfig.ActivateProject), false) mockClient.OnUpdateProjectMatch(ctx, projectUpdateRequest).Return(nil, nil) err := updateProjectsFunc(ctx, args, cmdCtx) assert.NotNil(t, err) + assert.Equal(t, fmt.Errorf(clierrors.ErrInvalidStateUpdate), err) mockClient.AssertNotCalled(t, "UpdateProject", ctx, projectUpdateRequest) } diff --git a/cmd/update/task_test.go b/cmd/update/task_test.go index 250f7f9fd..51dcb09ef 100644 --- a/cmd/update/task_test.go +++ b/cmd/update/task_test.go @@ -14,7 +14,7 @@ import ( func UpdateTaskSetup() { ctx = testutils.Ctx cmdCtx = testutils.CmdCtx - mockClient = testutils.MockClient + mockClient = testutils.MockAdminClient } func TestTaskUpdate(t *testing.T) { diff --git a/cmd/update/workflow_test.go b/cmd/update/workflow_test.go index d6b5ba06a..eb3b06251 100644 --- a/cmd/update/workflow_test.go +++ b/cmd/update/workflow_test.go @@ -14,7 +14,7 @@ import ( func UpdateWorkflowSetup() { ctx = testutils.Ctx cmdCtx = testutils.CmdCtx - mockClient = testutils.MockClient + mockClient = testutils.MockAdminClient } func TestWorkflowUpdate(t *testing.T) {