From abe3aaed20a09f821fbbe423a6881f1b6f5a2820 Mon Sep 17 00:00:00 2001 From: Shane Bryzak Date: Tue, 26 Sep 2023 08:24:32 +1000 Subject: [PATCH] refactor --- test/e2e/nstemplatetier_test.go | 4 +--- testsupport/user_assertions.go | 22 +++++++++------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/test/e2e/nstemplatetier_test.go b/test/e2e/nstemplatetier_test.go index b2a6ae2aa..17ceba68a 100644 --- a/test/e2e/nstemplatetier_test.go +++ b/test/e2e/nstemplatetier_test.go @@ -265,9 +265,7 @@ func verifyResourceUpdatesForUserSignups(t *testing.T, hostAwait *HostAwaitility for _, usersignup := range userSignups { userAccount, err := memberAwaitility.WaitForUserAccount(t, usersignup.Status.CompliantUsername, UntilUserAccountHasConditions(wait.Provisioned()), - UntilUserAccountHasSpec(ExpectedUserAccount(usersignup.Spec.IdentityClaims.Sub, usersignup.Spec.IdentityClaims.UserID, - usersignup.Spec.IdentityClaims.AccountID, - usersignup.Spec.OriginalSub, usersignup.Annotations[toolchainv1alpha1.UserSignupUserEmailAnnotationKey])), + UntilUserAccountHasSpec(ExpectedUserAccount(usersignup.Spec.IdentityClaims.PropagatedClaims)), UntilUserAccountMatchesMur(hostAwait)) require.NoError(t, err) require.NotNil(t, userAccount) diff --git a/testsupport/user_assertions.go b/testsupport/user_assertions.go index c12770746..5773c344e 100644 --- a/testsupport/user_assertions.go +++ b/testsupport/user_assertions.go @@ -61,11 +61,7 @@ func VerifyUserRelatedResources(t *testing.T, awaitilities wait.Awaitilities, si // Then wait for the associated UserAccount to be provisioned userAccount, err := memberAwait.WaitForUserAccount(t, mur.Name, wait.UntilUserAccountHasConditions(wait.Provisioned()), - wait.UntilUserAccountHasSpec(ExpectedUserAccount(userSignup.Spec.IdentityClaims.Sub, - userSignup.Spec.IdentityClaims.UserID, - userSignup.Spec.IdentityClaims.AccountID, - userSignup.Spec.IdentityClaims.OriginalSub, - userSignup.Annotations[toolchainv1alpha1.UserSignupUserEmailAnnotationKey])), + wait.UntilUserAccountHasSpec(ExpectedUserAccount(userSignup.Spec.IdentityClaims.PropagatedClaims)), wait.UntilUserAccountHasLabelWithValue(toolchainv1alpha1.TierLabelKey, mur.Spec.TierName), wait.UntilUserAccountHasAnnotation(toolchainv1alpha1.UserEmailAnnotationKey, signup.Annotations[toolchainv1alpha1.UserSignupUserEmailAnnotationKey]), wait.UntilUserAccountMatchesMur(hostAwait)) @@ -223,17 +219,17 @@ func VerifySpaceRelatedResources(t *testing.T, awaitilities wait.Awaitilities, u tiers.VerifyNSTemplateSet(t, hostAwait, memberAwait, nsTemplateSet, tierChecks) } -func ExpectedUserAccount(sub, userID, accountID, originalSub, email string) toolchainv1alpha1.UserAccountSpec { +func ExpectedUserAccount(claims toolchainv1alpha1.PropagatedClaims) toolchainv1alpha1.UserAccountSpec { return toolchainv1alpha1.UserAccountSpec{ - UserID: sub, + UserID: claims.Sub, Disabled: false, - OriginalSub: originalSub, + OriginalSub: claims.OriginalSub, PropagatedClaims: toolchainv1alpha1.PropagatedClaims{ - UserID: userID, - AccountID: accountID, - OriginalSub: originalSub, - Sub: sub, - Email: email, + UserID: claims.UserID, + AccountID: claims.AccountID, + OriginalSub: claims.OriginalSub, + Sub: claims.Sub, + Email: claims.Email, }, } }