diff --git a/pkg/controllers/organization/organization_controller_test.go b/pkg/controllers/organization/organization_controller_test.go index 003758d3b..ec5d1078e 100644 --- a/pkg/controllers/organization/organization_controller_test.go +++ b/pkg/controllers/organization/organization_controller_test.go @@ -12,6 +12,7 @@ import ( "k8s.io/client-go/util/retry" greenhousev1alpha1 "github.com/cloudoperators/greenhouse/pkg/apis/greenhouse/v1alpha1" + "github.com/cloudoperators/greenhouse/pkg/clientutil" "github.com/cloudoperators/greenhouse/pkg/test" ) @@ -73,13 +74,11 @@ var _ = Describe("Test Organization reconciliation", Ordered, func() { }).Should(Succeed(), "Admin team should be created with valid IDPGroup") By("updating MappedOrgAdminIDPGroup in Organization") - err := retry.RetryOnConflict(retry.DefaultRetry, func() error { - err := setup.Get(test.Ctx, types.NamespacedName{Name: testOrgName}, testOrg) - Expect(err).ToNot(HaveOccurred(), "there should be no error getting the Organization") + _, err := clientutil.Patch(test.Ctx, test.K8sClient, testOrg, func() error { testOrg.Spec.MappedOrgAdminIDPGroup = otherValidIdpGroupName - return setup.Update(test.Ctx, testOrg) + return nil }) - Expect(err).ToNot(HaveOccurred(), "there must be no error updating the organization") + Expect(err).To(Succeed(), "there must be no error updating the organization") Eventually(func(g Gomega) { err := setup.Get(test.Ctx, types.NamespacedName{Name: testOrgName + "-admin", Namespace: testOrgName}, team) @@ -99,8 +98,12 @@ var _ = Describe("Test Organization reconciliation", Ordered, func() { }).ShouldNot(HaveOccurred(), "there should be no error getting org admin team") By("changing MappedIDPGroup in Team") - team.Spec.MappedIDPGroup = otherValidIdpGroupName - Expect(setup.Update(test.Ctx, team)).To(Succeed(), "there must be no error updating the team") + _, err := clientutil.Patch(test.Ctx, test.K8sClient, team, func() error { + team.Spec.MappedIDPGroup = otherValidIdpGroupName + return nil + }) + + Expect(err).To(Succeed(), "there must be no error updating the team") Eventually(func(g Gomega) { err := setup.Get(test.Ctx, types.NamespacedName{Name: testOrgName + "-admin", Namespace: testOrgName}, team)