Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Fix integration tests (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
katrogan authored Sep 23, 2020
1 parent f386d9f commit ffa3a74
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flyteadmin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ require (
github.com/jinzhu/gorm v1.9.12
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/lib/pq v1.3.0
github.com/lyft/flyteidl v0.18.3
github.com/lyft/flytepropeller v0.3.7
github.com/lyft/flyteidl v0.18.6
github.com/lyft/flytepropeller v0.3.16
github.com/lyft/flytestdlib v0.3.9
github.com/magiconair/properties v1.8.1
github.com/mitchellh/mapstructure v1.1.2
Expand Down
5 changes: 5 additions & 0 deletions flyteadmin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,14 @@ github.com/lyft/flyteidl v0.18.0/go.mod h1:/zQXxuHO11u/saxTTZc8oYExIGEShXB+xCB1/
github.com/lyft/flyteidl v0.18.1/go.mod h1:/zQXxuHO11u/saxTTZc8oYExIGEShXB+xCB1/F1Cu20=
github.com/lyft/flyteidl v0.18.3 h1:+O0rDCXoiui5X56DtoqquW0rqjN75jDWqAEyvcqmarI=
github.com/lyft/flyteidl v0.18.3/go.mod h1:/zQXxuHO11u/saxTTZc8oYExIGEShXB+xCB1/F1Cu20=
github.com/lyft/flyteidl v0.18.6 h1:HGbxHI8avEDvoPqcO2+/BoJVcP9sjOj4qwJ/wNRWuoA=
github.com/lyft/flyteidl v0.18.6/go.mod h1:/zQXxuHO11u/saxTTZc8oYExIGEShXB+xCB1/F1Cu20=
github.com/lyft/flyteplugins v0.4.4/go.mod h1:8zhqFG9BzbHNQGEXzGYltTJLD+KTmQZkanxXgeFI25c=
github.com/lyft/flyteplugins v0.5.1/go.mod h1:8zhqFG9BzbHNQGEXzGYltTJLD+KTmQZkanxXgeFI25c=
github.com/lyft/flytepropeller v0.3.7 h1:l2AguhyhiUDCvqjHYF8XJw46gPW9j4XNZwJEAJdiEtI=
github.com/lyft/flytepropeller v0.3.7/go.mod h1:8sNP7ZnEngNRYBMewmH4PtiRR0pus8RkjNoPqelyKX8=
github.com/lyft/flytepropeller v0.3.16 h1:a6KbvtDRMMVEUlVTqQ9h9IOehUerk3dT+pvsN5Ql/4o=
github.com/lyft/flytepropeller v0.3.16/go.mod h1:GArCzcLAZ48OacGUsHUA3f028ixoU8CVZOMikyjEdNY=
github.com/lyft/flytestdlib v0.3.0 h1:nIkX4MlyYdcLLzaF35RI2P5BhARt+qMgHoFto8eVNzU=
github.com/lyft/flytestdlib v0.3.0/go.mod h1:LJPPJlkFj+wwVWMrQT3K5JZgNhZi2mULsCG4ZYhinhU=
github.com/lyft/flytestdlib v0.3.9 h1:NaKp9xkeWWwhVvqTOcR/FqlASy1N2gu/kN7PVe4S7YI=
Expand Down
24 changes: 24 additions & 0 deletions flyteadmin/tests/launch_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ func getWorkflowCreateRequest() admin.WorkflowCreateRequest {
},
},
},
Nodes: []*core.Node{
{
Id: "I'm a node",
Target: &core.Node_TaskNode{
TaskNode: &core.TaskNode{
Reference: &core.TaskNode_ReferenceId{
ReferenceId: &core.Identifier{
ResourceType: core.ResourceType_TASK,
Project: "admintests",
Domain: "development",
Name: "name_a",
Version: "123",
},
},
},
},
},
},
},
},
}
Expand Down Expand Up @@ -163,6 +181,7 @@ func TestCreateLaunchPlan(t *testing.T) {
ctx := context.Background()
client, conn := GetTestAdminServiceClient()
defer conn.Close()
insertTasksForTests(t, client)

createWorkflowReq := getWorkflowCreateRequest()

Expand All @@ -180,6 +199,7 @@ func TestGetLaunchPlanHTTP(t *testing.T) {
client, conn := GetTestAdminServiceClient()
defer conn.Close()

insertTasksForTests(t, client)
createWorkflowReq := getWorkflowCreateRequest()

_, err := client.CreateWorkflow(ctx, &createWorkflowReq)
Expand Down Expand Up @@ -213,6 +233,7 @@ func TestEnableDisableLaunchPlan(t *testing.T) {
client, conn := GetTestAdminServiceClient()
defer conn.Close()

insertTasksForTests(t, client)
createWorkflowReq := getWorkflowCreateRequest()

_, err := client.CreateWorkflow(ctx, &createWorkflowReq)
Expand Down Expand Up @@ -268,6 +289,7 @@ func TestUpdateActiveLaunchPlanVersion(t *testing.T) {
client, conn := GetTestAdminServiceClient()
defer conn.Close()

insertTasksForTests(t, client)
createWorkflowReq := getWorkflowCreateRequest()

_, err := client.CreateWorkflow(ctx, &createWorkflowReq)
Expand Down Expand Up @@ -322,6 +344,7 @@ func TestListLaunchPlans(t *testing.T) {
ctx := context.Background()
client, conn := GetTestAdminServiceClient()

insertTasksForTests(t, client)
createWorkflowReq := getWorkflowCreateRequest()

_, err := client.CreateWorkflow(ctx, &createWorkflowReq)
Expand Down Expand Up @@ -391,6 +414,7 @@ func TestListLaunchPlansFilterOnSchedule(t *testing.T) {
ctx := context.Background()
client, conn := GetTestAdminServiceClient()

insertTasksForTests(t, client)
createWorkflowReq := getWorkflowCreateRequest()

_, err := client.CreateWorkflow(ctx, &createWorkflowReq)
Expand Down
1 change: 1 addition & 0 deletions flyteadmin/tests/named_entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func TestUpdateNamedEntityState(t *testing.T) {
ctx := context.Background()

defer conn.Close()
insertTasksForTests(t, client)
insertWorkflowsForTests(t, client)

result, err := client.ListNamedEntities(ctx, &admin.NamedEntityListRequest{
Expand Down
18 changes: 18 additions & 0 deletions flyteadmin/tests/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ func insertWorkflowsForTests(t *testing.T, client service.AdminServiceClient) {
},
},
},
Nodes: []*core.Node{
{
Id: "I'm a node",
Target: &core.Node_TaskNode{
TaskNode: &core.TaskNode{
Reference: &core.TaskNode_ReferenceId{
ReferenceId: &core.Identifier{
ResourceType: core.ResourceType_TASK,
Project: project,
Domain: domain,
Name: name,
Version: version,
},
},
},
},
},
},
},
},
}
Expand Down
25 changes: 24 additions & 1 deletion flyteadmin/tests/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package tests
import (
"context"
"fmt"
"github.com/lyft/flyteadmin/pkg/manager/impl/testutils"
"io/ioutil"
"net/http"
"testing"
Expand All @@ -17,10 +18,19 @@ import (
)

func TestCreateWorkflow(t *testing.T) {
truncateAllTablesForTestingOnly()
ctx := context.Background()
client, conn := GetTestAdminServiceClient()
defer conn.Close()

taskCreateReq := testutils.GetValidTaskRequest()
taskCreateReq.Id.Project = "admintests"
taskCreateReq.Id.Domain = "development"
taskCreateReq.Id.Name = "simple task"
_, err := client.CreateTask(ctx, &taskCreateReq)
assert.NoError(t, err)


identifier := core.Identifier{
ResourceType: core.ResourceType_WORKFLOW,
Project: "admintests",
Expand All @@ -34,18 +44,31 @@ func TestCreateWorkflow(t *testing.T) {
Template: &core.WorkflowTemplate{
Id: &identifier,
Interface: &core.TypedInterface{},
Nodes: []*core.Node{
{
Id: "I'm a node",
Target: &core.Node_TaskNode{
TaskNode: &core.TaskNode{
Reference: &core.TaskNode_ReferenceId{
ReferenceId: taskCreateReq.Id,
},
},
},
},
},
},
},
}

_, err := client.CreateWorkflow(ctx, &req)
_, err = client.CreateWorkflow(ctx, &req)
assert.Nil(t, err)
}

func TestGetWorkflows(t *testing.T) {
truncateAllTablesForTestingOnly()
client, conn := GetTestAdminServiceClient()
defer conn.Close()
insertTasksForTests(t, client)
insertWorkflowsForTests(t, client)

t.Run("TestGetWorkflowGrpc", testGetWorkflowGrpc)
Expand Down

0 comments on commit ffa3a74

Please sign in to comment.