-
Notifications
You must be signed in to change notification settings - Fork 61
Fix for "protects kube objects" failure in the unit tests #2125
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
base: main
Are you sure you want to change the base?
Fix for "protects kube objects" failure in the unit tests #2125
Conversation
to vrgObjectProtectionValidate as it is validating if the vrg is uploaded to the s3 store, not the kube objects. Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
from `protects kube objects` to `protects vrg objects` as it is vrg objects that we are testing the upload of. Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
47ee546
to
ef2c905
Compare
TODO: explain Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
ef2c905
to
1cde698
Compare
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 to see the test pass again!
|
||
if expected.Status.ObservedGeneration != got.Status.ObservedGeneration || | ||
expected.Status.State != got.Status.State { | ||
return true, false, fmt.Sprintf("VRG %s/%s in pvrgl has mismatched status, expected: "+ |
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.
What is pvrgl?
gotList := make([]string, 0, len(protectedVrgList.Status.Items)) | ||
|
||
for _, vrgExpected := range vrgsExpected { | ||
expectedList = append(expectedList, fmt.Sprintf("%s/%s", vrgExpected.Namespace, vrgExpected.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.
Using "vrg" like in the next loop will be better, this is a temporary variable with tiny scope. But since this is only for logging, maybe add a helper like vrgNames() to created the list of names, and call it only if the test fails?
return false, false, fmt.Sprintf("VRG %s/%s does not match expected: "+ | ||
"got: %s/%s", | ||
expected.Namespace, expected.Name, | ||
got.Namespace, got.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.
This message will be generated for all vrgs but one. Does not seem very helpful.
func protectedVrgListExpectInclude(protectedVrgList *ramen.ProtectedVolumeReplicationGroupList, | ||
vrgsExpected []ramen.VolumeReplicationGroup, | ||
) { | ||
vrgsStatusStateUpdate(protectedVrgList.Status.Items, vrgsExpected) | ||
Expect(protectedVrgList.Status.Items).To(ContainElements(vrgsExpected)) |
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.
So this assumed identical vrgs, and we want to compare only certain fields?
|
||
if !valid { | ||
Fail(msg) | ||
} |
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.
If will be more clear if we separate finding the vrg and checking the stauts:
for _, vrg := range expectedVRGs {
found := findVRG(protectedVrgList.Status.Items, vrg)
if found == nil {
Fail(...)
}
if err := checkVRGStatus(found, vrg); err != nil {
Fail(...)
}
}
TODO