diff --git a/flyteadmin/pkg/manager/impl/testutils/mock_requests.go b/flyteadmin/pkg/manager/impl/testutils/mock_requests.go index 281b90a14d3..b8686122697 100644 --- a/flyteadmin/pkg/manager/impl/testutils/mock_requests.go +++ b/flyteadmin/pkg/manager/impl/testutils/mock_requests.go @@ -47,8 +47,8 @@ func GetValidTaskRequest() *admin.TaskCreateRequest { } } -func GetValidTaskRequestWithOverrides(project string, domain string, name string, version string) admin.TaskCreateRequest { - return admin.TaskCreateRequest{ +func GetValidTaskRequestWithOverrides(project string, domain string, name string, version string) *admin.TaskCreateRequest { + return &admin.TaskCreateRequest{ Id: &core.Identifier{ ResourceType: core.ResourceType_TASK, Project: project, @@ -78,11 +78,6 @@ func GetValidTaskRequestWithOverrides(project string, domain string, name string } } -func GetValidTaskSpecBytes() []byte { - bytes, _ := proto.Marshal(GetValidTaskRequest().Spec) - return bytes -} - func GetWorkflowRequest() *admin.WorkflowCreateRequest { identifier := core.Identifier{ ResourceType: core.ResourceType_WORKFLOW, diff --git a/flyteadmin/pkg/rpc/adminservice/tests/task_test.go b/flyteadmin/pkg/rpc/adminservice/tests/task_test.go index 20faae59bad..2e4d5a8287e 100644 --- a/flyteadmin/pkg/rpc/adminservice/tests/task_test.go +++ b/flyteadmin/pkg/rpc/adminservice/tests/task_test.go @@ -13,7 +13,7 @@ import ( "github.com/flyteorg/flyte/flytestdlib/utils" ) -var taskIdentifier = core.Identifier{ +var taskIdentifier = &core.Identifier{ ResourceType: core.ResourceType_TASK, Name: "Name", Domain: "Domain", @@ -36,7 +36,7 @@ func TestTaskHappyCase(t *testing.T) { }) resp, err := mockServer.CreateTask(ctx, &admin.TaskCreateRequest{ - Id: &taskIdentifier, + Id: taskIdentifier, }) assert.NotNil(t, resp) assert.NoError(t, err) diff --git a/flyteadmin/tests/task_test.go b/flyteadmin/tests/task_test.go index e11f499bf2b..72dbf9a28db 100644 --- a/flyteadmin/tests/task_test.go +++ b/flyteadmin/tests/task_test.go @@ -45,7 +45,7 @@ func TestCreateBasic(t *testing.T) { // Test that task creation and retrieval works valid := testutils.GetValidTaskRequest() - response, err := client.CreateTask(ctx, &valid) + response, err := client.CreateTask(ctx, valid) assert.NoError(t, err) task, err := client.GetTask(ctx, &admin.ObjectGetRequest{ Id: valid.Id, @@ -56,7 +56,7 @@ func TestCreateBasic(t *testing.T) { // Currently the returned object does not have the URN // Test creating twice in a row fails on uniqueness - response, err = client.CreateTask(ctx, &valid) + response, err = client.CreateTask(ctx, valid) assert.Nil(t, response) assert.Error(t, err) assert.True(t, strings.Contains(err.Error(), "already exists")) @@ -353,20 +353,20 @@ func TestListTaskIdsWithMultipleTaskVersions(t *testing.T) { // Create two versions of one task and one version of another task, and one unrelated task valid := testutils.GetValidTaskRequestWithOverrides("project", "domain", "name", "v1") - _, err := client.CreateTask(ctx, &valid) + _, err := client.CreateTask(ctx, valid) assert.NoError(t, err) valid = testutils.GetValidTaskRequestWithOverrides("project", "domain", "name", "v2") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) valid = testutils.GetValidTaskRequestWithOverrides("project", "domain", "secondtask", "v1") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) // This last one should not show up. valid = testutils.GetValidTaskRequestWithOverrides("project", "development", "hidden", "v1") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) // We should only get back two entities @@ -423,20 +423,20 @@ func TestListTaskIdsWithPagination(t *testing.T) { // Create two versions of one task and one version of another task, and one unrelated task valid := testutils.GetValidTaskRequestWithOverrides("project", "domain", "name", "v1") - _, err := client.CreateTask(ctx, &valid) + _, err := client.CreateTask(ctx, valid) assert.NoError(t, err) valid = testutils.GetValidTaskRequestWithOverrides("project", "domain", "name", "v2") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) valid = testutils.GetValidTaskRequestWithOverrides("project", "domain", "secondtask", "v1") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) // This last one should not show up. valid = testutils.GetValidTaskRequestWithOverrides("project", "development", "hidden", "v1") - _, err = client.CreateTask(ctx, &valid) + _, err = client.CreateTask(ctx, valid) assert.NoError(t, err) // We should only get back one entity @@ -502,7 +502,7 @@ func TestCreateInvalidTaskType(t *testing.T) { // Test that task creation fails based on task type valid := testutils.GetValidTaskRequest() valid.Spec.Template.Type = "sparkonk8s" - _, err := client.CreateTask(ctx, &valid) + _, err := client.CreateTask(ctx, valid) assert.NotNil(t, err) assert.Contains(t, err.Error(), "task type must be whitelisted before use") }