Skip to content

Commit

Permalink
Add Tags in UpdateExecutionModel(#4185)
Browse files Browse the repository at this point in the history
Signed-off-by: Da-Yi Wu <[email protected]>
  • Loading branch information
ericwudayi committed Oct 15, 2023
1 parent af77f31 commit 1dc7f31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flyteadmin/pkg/manager/impl/execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions flyteadmin/pkg/repositories/transformers/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -939,22 +939,22 @@ 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
spec.Tags = []string{"tags1", "tags2"}
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)
Expand Down

0 comments on commit 1dc7f31

Please sign in to comment.