From 38c7b799e5fc7689ff2f3ce8abfa7b5656f9a1e3 Mon Sep 17 00:00:00 2001 From: Shane Bryzak Date: Tue, 10 Oct 2023 12:44:30 +1000 Subject: [PATCH] add test to confirm that propagatedclaims are correctly propagated all the way from UserSignup to UserAccount (#813) --- test/e2e/usersignup_test.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/e2e/usersignup_test.go b/test/e2e/usersignup_test.go index 3fa31fca3..f27ee8ec1 100644 --- a/test/e2e/usersignup_test.go +++ b/test/e2e/usersignup_test.go @@ -284,6 +284,39 @@ func (s *userSignupIntegrationTest) TestUserResourcesCreatedWhenOriginalSubIsSet VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base") } +func (s *userSignupIntegrationTest) TestUserResourcesUpdatedWhenPropagatedClaimsModified() { + hostAwait := s.Host() + + // given + hostAwait.UpdateToolchainConfig(s.T(), testconfig.AutomaticApproval().Enabled(true)) + + // when + userSignup, _ := NewSignupRequest(s.Awaitilities). + Username("test-user-resources-updated"). + Email("test-user-resources-updated@redhat.com"). + UserID("43215432"). + AccountID("ppqnnn00099"). + EnsureMUR(). + RequireConditions(wait.ConditionSet(wait.Default(), wait.ApprovedAutomatically())...). + Execute(s.T()).Resources() + + // then + VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base") + + // Update the UserSignup + userSignup, err := hostAwait.UpdateUserSignup(s.T(), userSignup.Name, func(us *toolchainv1alpha1.UserSignup) { + // Modify the user's AccountID + us.Spec.IdentityClaims.AccountID = "nnnbbb111234" + }) + require.NoError(s.T(), err) + + // Confirm the AccountID is updated + require.Equal(s.T(), "nnnbbb111234", userSignup.Spec.IdentityClaims.AccountID) + + // Verify that the resources are updated with the propagated claim + VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base") +} + // TestUserResourcesCreatedWhenOriginalSubIsSetAndUserIDSameAsSub tests the case where: // // 1. sub claim set manually by test