8000 Fix for "protects kube objects" failure in the unit tests by raghavendra-talur · Pull Request #2125 · RamenDR/ramen · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

raghavendra-talur
Copy link
Member

TODO

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>
TODO: explain

Signed-off-by: Raghavendra Talur <raghavendra.talur@gmail.com>
Copy link
Member
@nirs nirs left a 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: "+
Copy link
Member

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))
Copy link
Member

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)
Copy link
Member

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))
Copy link
Member

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)
}
Copy link
Member

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(...)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0