Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryzak committed Sep 25, 2023
1 parent bc90a6a commit abe3aae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
4 changes: 1 addition & 3 deletions test/e2e/nstemplatetier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 9 additions & 13 deletions testsupport/user_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
},
}
}
Expand Down

0 comments on commit abe3aae

Please sign in to comment.