From 1dc7f31b4b935729db57520f0c5d0bc069641f1f Mon Sep 17 00:00:00 2001 From: Da-Yi Wu Date: Sun, 15 Oct 2023 10:12:58 +0800 Subject: [PATCH] Add Tags in UpdateExecutionModel(#4185) Signed-off-by: Da-Yi Wu --- .../pkg/manager/impl/execution_manager_test.go | 2 +- .../repositories/transformers/execution_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/flyteadmin/pkg/manager/impl/execution_manager_test.go b/flyteadmin/pkg/manager/impl/execution_manager_test.go index 493df38fd7a..2538142ac0a 100644 --- a/flyteadmin/pkg/manager/impl/execution_manager_test.go +++ b/flyteadmin/pkg/manager/impl/execution_manager_test.go @@ -2936,7 +2936,7 @@ func TestUpdateExecution(t *testing.T) { r.RegisterDefault(plugins.PluginIDWorkflowExecutor, &defaultTestExecutor) execManager := NewExecutionManager(repository, r, getMockExecutionsConfigProvider(), getMockStorageForExecTest(context.Background()), mockScope.NewTestScope(), mockScope.NewTestScope(), &mockPublisher, mockExecutionRemoteURL, nil, nil, nil, nil, &eventWriterMocks.WorkflowExecutionEventWriter{}) updateResponse, err := execManager.UpdateExecution(context.Background(), admin.ExecutionUpdateRequest{ - Id: &executionIdentifier, + Id: &executionIdentifier, AddTags: []string{"tag1", "tag2"}, }, time.Now()) assert.NoError(t, err) diff --git a/flyteadmin/pkg/repositories/transformers/execution_test.go b/flyteadmin/pkg/repositories/transformers/execution_test.go index 543fad82c57..c0d36257d10 100644 --- a/flyteadmin/pkg/repositories/transformers/execution_test.go +++ b/flyteadmin/pkg/repositories/transformers/execution_test.go @@ -926,10 +926,10 @@ func TestUpdateExecutionModelAddTags(t *testing.T) { t.Run("empty add tags", func(t *testing.T) { execModel := &models.Execution{} execModel.Tags = []models.AdminTag{ - {Name: "tags1",}, - {Name: "tags2",}, + {Name: "tags1"}, + {Name: "tags2"}, } - ref_tags := []string{"tags1", "tags2"} + refTags := []string{"tags1", "tags2"} tags := []string{""} err := UpdateExecutionModelAddTag(execModel, tags) @@ -939,7 +939,7 @@ func TestUpdateExecutionModelAddTags(t *testing.T) { execTagsString = append(execTagsString, tag.Name) } assert.Nil(t, err) - assert.Equal(t, ref_tags, execTagsString) + assert.Equal(t, refTags, execTagsString) }) t.Run("duplicate tags", func(t *testing.T) { spec := testutils.GetExecutionRequest().Spec @@ -947,14 +947,14 @@ func TestUpdateExecutionModelAddTags(t *testing.T) { specBytes, _ := proto.Marshal(spec) execModel := &models.Execution{ - Spec: specBytes, + Spec: specBytes, } execModel.Tags = []models.AdminTag{ - {Name: "tags1",}, - {Name: "tags2",}, + {Name: "tags1"}, + {Name: "tags2"}, } - + tags := []string{"tags2", "tags3"} err := UpdateExecutionModelAddTag(execModel, tags) assert.Nil(t, err)