Skip to content

Commit

Permalink
Reset default filter in the task_test so that the unit tests can be r…
Browse files Browse the repository at this point in the history
…un individually (flyteorg#155)

Signed-off-by: Sean Lin <[email protected]>
  • Loading branch information
mayitbeegh authored and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent c754b4c commit 9ab0ba2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flytectl/cmd/get/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func getTaskSetup() {
taskConfig.DefaultConfig.Latest = false
taskConfig.DefaultConfig.ExecFile = ""
taskConfig.DefaultConfig.Version = ""
taskConfig.DefaultConfig.Filter = filters.DefaultFilter
}

func TestGetTaskFuncWithError(t *testing.T) {
Expand Down Expand Up @@ -238,6 +239,7 @@ func TestGetTaskFuncWithError(t *testing.T) {
func TestGetTaskFunc(t *testing.T) {
setup()
getTaskSetup()
taskConfig.DefaultConfig.Filter = filters.Filters{}
mockClient.OnListTasksMatch(ctx, resourceListRequestTask).Return(taskListResponse, nil)
mockClient.OnGetTaskMatch(ctx, objectGetRequestTask).Return(task2, nil)
err = getTaskFunc(ctx, argsTask, cmdCtx)
Expand Down Expand Up @@ -320,6 +322,7 @@ func TestGetTaskFunc(t *testing.T) {
func TestGetTaskTableFunc(t *testing.T) {
setup()
getTaskSetup()
taskConfig.DefaultConfig.Filter = filters.Filters{}
mockClient.OnListTasksMatch(ctx, resourceListRequestTask).Return(taskListResponse, nil)
mockClient.OnGetTaskMatch(ctx, objectGetRequestTask).Return(task2, nil)
config.GetConfig().Output = "table"
Expand All @@ -342,6 +345,7 @@ func TestGetTaskTableFunc(t *testing.T) {
func TestGetTaskFuncLatest(t *testing.T) {
setup()
getTaskSetup()
taskConfig.DefaultConfig.Filter = filters.Filters{}
mockClient.OnListTasksMatch(ctx, resourceListRequestTask).Return(taskListResponse, nil)
mockClient.OnGetTaskMatch(ctx, objectGetRequestTask).Return(task2, nil)
mockClient.OnListTaskIdsMatch(ctx, namedIDRequestTask).Return(namedIdentifierListTask, nil)
Expand Down Expand Up @@ -389,6 +393,7 @@ func TestGetTaskFuncLatest(t *testing.T) {
func TestGetTaskWithVersion(t *testing.T) {
setup()
getTaskSetup()
taskConfig.DefaultConfig.Filter = filters.Filters{}
mockClient.OnListTasksMatch(ctx, resourceListRequestTask).Return(taskListResponse, nil)
mockClient.OnGetTaskMatch(ctx, objectGetRequestTask).Return(task2, nil)
mockClient.OnListTaskIdsMatch(ctx, namedIDRequestTask).Return(namedIdentifierListTask, nil)
Expand Down Expand Up @@ -437,6 +442,7 @@ func TestGetTaskWithVersion(t *testing.T) {
func TestGetTasks(t *testing.T) {
setup()
getTaskSetup()
taskConfig.DefaultConfig.Filter = filters.Filters{}
mockClient.OnListTasksMatch(ctx, resourceListRequestTask).Return(taskListResponse, nil)
mockClient.OnGetTaskMatch(ctx, objectGetRequestTask).Return(task2, nil)
err = getTaskFunc(ctx, argsTask, cmdCtx)
Expand Down

0 comments on commit 9ab0ba2

Please sign in to comment.