-
Notifications
You must be signed in to change notification settings - Fork 62
Release Qualifying Jobs Support (part 1) #711
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import ( | |
| "testing" | ||
|
|
||
| releasecontroller "github.com/openshift/release-controller/pkg/release-controller" | ||
|
|
||
| "github.com/openshift/release-controller/pkg/releasequalifiers" | ||
| utilerrors "k8s.io/apimachinery/pkg/util/errors" | ||
| ) | ||
|
|
||
|
|
@@ -356,3 +356,102 @@ func TestValidateUpgradeJobs(t *testing.T) { | |
| } | ||
| } | ||
| } | ||
|
|
||
| func TestValidateQualifiersConfiguration(t *testing.T) { | ||
| testCases := []struct { | ||
| name string | ||
| configs []releasecontroller.ReleaseConfig | ||
| expectedErr bool | ||
| }{ | ||
| { | ||
| name: "Good config with no qualifiers", | ||
| configs: []releasecontroller.ReleaseConfig{{ | ||
| Name: "4.19.0-0.nightly", | ||
| Verify: map[string]releasecontroller.ReleaseVerification{ | ||
| "osd-aws": { | ||
| Optional: true, | ||
| MaxRetries: 2, | ||
| ProwJob: &releasecontroller.ProwJobVerification{ | ||
| Name: "periodic-ci-openshift-release-master-nightly-4.19-osd-aws", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expectedErr: false, | ||
| }, | ||
| { | ||
| name: "Good config with nil qualifier", | ||
| configs: []releasecontroller.ReleaseConfig{{ | ||
| Name: "4.19.0-0.nightly", | ||
| Verify: map[string]releasecontroller.ReleaseVerification{ | ||
| "osd-aws": { | ||
| Optional: true, | ||
| MaxRetries: 2, | ||
| ProwJob: &releasecontroller.ProwJobVerification{ | ||
| Name: "periodic-ci-openshift-release-master-nightly-4.19-osd-aws", | ||
| }, | ||
| Qualifiers: releasequalifiers.ReleaseQualifiers{ | ||
| "rosa": {}, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expectedErr: false, | ||
| }, | ||
| { | ||
| name: "Good config with empty qualifier", | ||
| configs: []releasecontroller.ReleaseConfig{{ | ||
| Name: "4.19.0-0.nightly", | ||
| Verify: map[string]releasecontroller.ReleaseVerification{ | ||
| "osd-aws": { | ||
| Optional: true, | ||
| MaxRetries: 2, | ||
| ProwJob: &releasecontroller.ProwJobVerification{ | ||
| Name: "periodic-ci-openshift-release-master-nightly-4.19-osd-aws", | ||
| }, | ||
| Qualifiers: releasequalifiers.ReleaseQualifiers{ | ||
| "rosa": {}, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expectedErr: false, | ||
| }, | ||
|
||
| { | ||
| name: "Good config with simple overrides", | ||
| configs: []releasecontroller.ReleaseConfig{{ | ||
| Name: "4.19.0-0.nightly", | ||
| Verify: map[string]releasecontroller.ReleaseVerification{ | ||
| "osd-aws": { | ||
| Optional: true, | ||
| MaxRetries: 2, | ||
| ProwJob: &releasecontroller.ProwJobVerification{ | ||
| Name: "periodic-ci-openshift-release-master-nightly-4.19-osd-aws", | ||
| }, | ||
| Qualifiers: releasequalifiers.ReleaseQualifiers{ | ||
| "hcm": { | ||
| Enabled: releasequalifiers.BoolPtr(false), | ||
| BadgeName: "HCM Updated", | ||
| Description: "An updated description when displaying badge details", | ||
| PayloadBadge: releasequalifiers.PayloadBadgeNo, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }}, | ||
| expectedErr: false, | ||
| }, | ||
| } | ||
| for _, testCase := range testCases { | ||
| errs := validateQualifiers(testCase.configs) | ||
| if len(errs) > 0 && !testCase.expectedErr { | ||
| t.Errorf("%s: got error when error was not expected: %v", testCase.name, errs) | ||
| } | ||
| if len(errs) == 0 && testCase.expectedErr { | ||
| t.Errorf("%s: did not get error when error was expected", testCase.name) | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added these changes, specifically, to leverage the pre-existing presubmit job, in openshift/release, to validate the new release qualifiers config file.