Skip to content

Conversation

@DanielePalaia
Copy link
Contributor

Wrap expect into eventually on updating status condition in system tests
to let tests be more stable in the smaller openshift environment

This closes #

Note to reviewers: remember to look at the commits in this PR and consider if they can be squashed
Note to contributors: remember to re-generate client set if there are any API changes

Summary Of Changes

Additional Context

Copy link
Contributor

@coro coro left a comment

Choose a reason for hiding this comment

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

Is the intermittent failure due to the Status Condition not being present, or having the wrong value? As of this change, the Eventually will loop until a status condition is returned, regardless of if it's 'True' or not, and then still fail if it's 'False'. Perhaps the checks on each returned condition should be part of the Eventually loop?

Copy link
Member

@Zerpet Zerpet left a comment

Choose a reason for hiding this comment

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

I would add a descriptive message for the Should assertion, so that Gomega reports something more useful than "Expected 1, received 0" 🙂
https://onsi.github.io/gomega/#annotating-assertions

@DanielePalaia
Copy link
Contributor Author

@coro Actually in this case the condition seems not to be present, as the error result is: <[]v1beta1.Condition | len:0, cap:0>: nil, but after putting a timeout seems then to always be present.

Copy link
Contributor

@ChunyiLyu ChunyiLyu left a comment

Choose a reason for hiding this comment

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

Looks good. One small thing, the 20s timeout is used only for waiting for status condition to be updated and the time out is there to accommodate smalled openshift env. Perhaps create a variable to represent the time out similar to how cluster operator specific timeout const used across the system tests suite? https://github.com/rabbitmq/cluster-operator/blob/6d5295b4858c3b70b6ad3cf63dee766f9e3a00b1/system_tests/utils.go#L61-L63

Then you could add a comment to the timeout explaining its mostly required for openshift.

@DanielePalaia DanielePalaia force-pushed the systemtests_eventually_on_status_conditions branch from c341d85 to 617e801 Compare June 20, 2022 12:49
@DanielePalaia
Copy link
Contributor Author

@ChunyiLyu @Zerpet Thanks for the suggestions. Implemented!

Expect(k8sClient.Get(ctx, types.NamespacedName{Name: policy.Name, Namespace: policy.Namespace}, &fetchedPolicy)).To(Succeed())
return fetchedPolicy.Status.Conditions
}, 10, 2).Should(HaveLen(1))
}, 20, 2).Should(HaveLen(1), "policy status condition should be present")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you would like to use waitUpdatedStatusConditionhere as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes indeed :) fixed, thanks!

"k8s.io/utils/pointer"
)

// Used for openshift smaller cluster
Copy link
Contributor

@ChunyiLyu ChunyiLyu Jun 20, 2022

Choose a reason for hiding this comment

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

nitpick: I would say something like "useful for small Openshift environment while updating status takes a long time"

Copy link
Contributor Author

@DanielePalaia DanielePalaia Jun 20, 2022

Choose a reason for hiding this comment

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

Fair enough! Fixed!

Wrap expect into eventually on updating status condition in system tests
to let tests be more stable in the smaller openshift environment
@DanielePalaia DanielePalaia force-pushed the systemtests_eventually_on_status_conditions branch from 617e801 to f525396 Compare June 20, 2022 15:23
@DanielePalaia DanielePalaia merged commit e79d647 into main Jun 21, 2022
@DanielePalaia DanielePalaia deleted the systemtests_eventually_on_status_conditions branch June 21, 2022 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants