-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix some code and add UTs #28
Conversation
Signed-off-by: Shelly Kagan <[email protected]>
Signed-off-by: Shelly Kagan <[email protected]>
Signed-off-by: Shelly Kagan <[email protected]>
In case there are no valid golden images also in the case where the golden image doesnt have data source we dont want to exit the checkup we can continue to the next check which is check existing VMIs and then on the checks that are dependent on the golden images we should show the same message and skip. Signed-off-by: Shelly Kagan <[email protected]>
adjust reporter UT adjusr checkup UT add negative UT for checkup Signed-off-by: Shelly Kagan <[email protected]>
Signed-off-by: Shelly Kagan <[email protected]>
tests := map[string]struct { | ||
checkup checkupStub | ||
reporter reporterStub | ||
errors []string | ||
}{ | ||
"report fails": {checkup: checkupStub{}, reporter: reporterStub{failReport: errReport}, errors: []string{errReport.Error()}}, | ||
"setup fails": {checkup: checkupStub{failSetup: errSetup}, reporter: reporterStub{}, errors: []string{errSetup.Error()}}, | ||
"run fails": {checkup: checkupStub{failRun: errRun}, reporter: reporterStub{}, errors: []string{errRun.Error()}}, | ||
"teardown fails": {checkup: checkupStub{failTeardown: errTeardown}, reporter: reporterStub{}, errors: []string{errTeardown.Error()}}, | ||
"setup and 2nd report fail": {checkup: checkupStub{failSetup: errSetup}, reporter: reporterStub{failReport: errReport, failOnSecondReport: true}, errors: []string{errSetup.Error(), errReport.Error()}}, | ||
"run and report fail": {checkup: checkupStub{failRun: errRun}, reporter: reporterStub{failReport: errReport, failOnSecondReport: true}, errors: []string{errRun.Error(), errReport.Error()}}, | ||
"teardown and report fail": {checkup: checkupStub{failTeardown: errTeardown}, reporter: reporterStub{failReport: errReport, failOnSecondReport: true}, errors: []string{errTeardown.Error(), errReport.Error()}}, | ||
"run, teardown and report fail": {checkup: checkupStub{failRun: errRun, failTeardown: errTeardown}, reporter: reporterStub{failReport: errReport, failOnSecondReport: true}, errors: []string{errRun.Error(), errTeardown.Error(), errReport.Error()}}, | ||
} |
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.
Nice!
pkg/internal/checkup/checkup.go
Outdated
// FIXME: need to decide of we want to return errors in this cases | ||
// errMissingVolumeSnapshotClass = "There are StorageProfiles missing VolumeSnapshotClass." | ||
// errVMsWithNonVirtRbdStorageClass = "There are VMs using the plain RBD storageclass when the virtualization storageclass exists." |
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.
Afaiu, we shoud report these cases in the status but not fail the checkup
pkg/internal/checkup/checkup_test.go
Outdated
}, | ||
"storageProfileIncomplete": { | ||
clientConfig: clientConfig{spIncomplete: true}, | ||
expectedResults: map[string]string{reporter.StorageProfilesWithEmptyClaimPropertySetsKey: testScName, reporter.StorageProfilesWithSpecClaimPropertySetsKey: testScName, reporter.StorageWithRWXKey: ""}, |
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.
Not sure how can a SC be on both EmptyClaimPropertySets and SpecClaimPropertySets? I guess only in UT it's possible :)
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.
/lgtm
/approve
@ShellyKa13 please sign the commits |
They are signed it seems signed commits by github is not the DCO check we do in other repos. I changed the settings. |
code fixes:
Adjust UT accordingly adjust and add negative UTs