Skip to content
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

apply generic update #1078

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

rsoaresd
Copy link
Contributor

@rsoaresd rsoaresd commented Dec 5, 2024

Description

This PR cleans up all the update functions that are very similar to the Update generic function, addressing the necessary changes.



Please, note that I did not clean up UpdateSpaceBindingRequest because UpdateTestUpdateSpaceBindingRequest returns err when there is an error while updating, it is needed for this assertion

Issue ticket number and link

SANDBOX-838

@rsoaresd
Copy link
Contributor Author

rsoaresd commented Dec 5, 2024

/retest

known flaky test SANDBOX-836

Copy link
Contributor

@alexeykazakov alexeykazakov left a comment

Choose a reason for hiding this comment

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

Nice improvement!

s, err := hostAwait.UpdateSpace(t, space.Name, func(s *toolchainv1alpha1.Space) {
s.Spec.TargetCluster = "unknown"
})
s, err := For(t, hostAwait.Awaitility, &toolchainv1alpha1.Space{}).
Copy link
Contributor

Choose a reason for hiding this comment

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

wait.For() would look better then just For() . But it's cosmetic :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed! Addressed, thanks!

@openshift-ci openshift-ci bot added the approved label Dec 6, 2024
Copy link
Collaborator

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

Nice 🤩
Thanks for this simplification and removal of the duplications 🥇 🙏

@@ -84,7 +84,7 @@ func TestCreationOfUserAndIdentityIsSkipped(t *testing.T) {
t.Run("user and identity stay there when user is deactivated", func(t *testing.T) {
// when
userSignup, err := wait.For(t, hostAwait.Awaitility, &toolchainv1alpha1.UserSignup{}).
Update(signup.Name,
Update(signup.Name, hostAwait.Namespace,
Copy link
Collaborator

Choose a reason for hiding this comment

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

seeing all these changes, I'm wondering if we really need to provide the namespace explicitly? couldn't it be read from the provided "awaitility" instance?
Just to be clear, it's fine to keep it as it is for now and address it later if we figure out that it would simplify the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were some update functions like UpdateServiceAccount, UpdateSpaceRequest, and UpdateConfigMap that had the namespace as input, that's why I changed a little the generic update function

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, I see 👍 Thanks for clarification

Copy link

openshift-ci bot commented Dec 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, MatousJobanek, rsoaresd

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,alexeykazakov]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rsoaresd rsoaresd merged commit d123e68 into codeready-toolchain:master Dec 6, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants