Skip to content

Commit

Permalink
Attempt to fix integration tesst
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Parraga <[email protected]>
  • Loading branch information
Sovietaced committed Sep 2, 2024
1 parent 40ae240 commit d1c5a27
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
9 changes: 2 additions & 7 deletions flyteadmin/pkg/manager/impl/testutils/mock_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{

Check warning on line 51 in flyteadmin/pkg/manager/impl/testutils/mock_requests.go

View check run for this annotation

Codecov / codecov/patch

flyteadmin/pkg/manager/impl/testutils/mock_requests.go#L50-L51

Added lines #L50 - L51 were not covered by tests
Id: &core.Identifier{
ResourceType: core.ResourceType_TASK,
Project: project,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions flyteadmin/pkg/rpc/adminservice/tests/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down
22 changes: 11 additions & 11 deletions flyteadmin/tests/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
2 changes: 1 addition & 1 deletion flyteadmin/tests/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestCreateWorkflow(t *testing.T) {
taskCreateReq.Id.Project = "admintests"
taskCreateReq.Id.Domain = "development"
taskCreateReq.Id.Name = "simple task"
_, err := client.CreateTask(ctx, &taskCreateReq)
_, err := client.CreateTask(ctx, taskCreateReq)
assert.NoError(t, err)

identifier := core.Identifier{
Expand Down

0 comments on commit d1c5a27

Please sign in to comment.