Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pipeline version to job/run integration test so that job/run is c… #3270

Merged
merged 5 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions backend/test/integration/job_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,28 +344,34 @@ func (s *JobApiTestSuite) TestJobApis_noCatchupOption() {
func (s *JobApiTestSuite) checkHelloWorldJob(t *testing.T, job *job_model.APIJob, experimentID string, experimentName string, pipelineVersionId string, pipelineVersionName string) {
// Check workflow manifest is not empty
assert.Contains(t, job.PipelineSpec.WorkflowManifest, "whalesay")

// Check resource references contain experiment and pipeline version.
resourceReferences := []*job_model.APIResourceReference{
{Key: &job_model.APIResourceKey{Type: job_model.APIResourceTypeEXPERIMENT, ID: experimentID},
Name: experimentName, Relationship: job_model.APIRelationshipOWNER,
},
{Key: &job_model.APIResourceKey{Type: job_model.APIResourceTypePIPELINEVERSION, ID: pipelineVersionId},
Name: pipelineVersionName, Relationship: job_model.APIRelationshipCREATOR},
}
assert.Len(t, job.ResourceReferences, 2)
assert.Subset(t, job.ResourceReferences, resourceReferences)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// Check other fields in job object (other than resource references)
job.ResourceReferences = nil
expectedJob := &job_model.APIJob{
ID: job.ID,
Name: "hello world",
Description: "this is hello world",
PipelineSpec: &job_model.APIPipelineSpec{
WorkflowManifest: job.PipelineSpec.WorkflowManifest,
},
ResourceReferences: []*job_model.APIResourceReference{
{Key: &job_model.APIResourceKey{Type: job_model.APIResourceTypeEXPERIMENT, ID: experimentID},
Name: experimentName, Relationship: job_model.APIRelationshipOWNER,
},
{Key: &job_model.APIResourceKey{Type: job_model.APIResourceTypePIPELINEVERSION, ID: pipelineVersionId},
Name: pipelineVersionName, Relationship: job_model.APIRelationshipCREATOR},
},
MaxConcurrency: 10,
Enabled: true,
CreatedAt: job.CreatedAt,
UpdatedAt: job.UpdatedAt,
Status: job.Status,
Trigger: &job_model.APITrigger{},
}

assert.Equal(t, expectedJob, job)
}

Expand Down
1 change: 1 addition & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.