diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 5d66e6ed1..57dead992 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -540,7 +540,7 @@ func TestE2EFlow(t *testing.T) { // Wait until the UserSignup is deactivated _, err = hostAwait.WaitForUserSignup(t, userSignup.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin(), wait.ManuallyDeactivated())...)) + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ManuallyDeactivated())...)) require.NoError(t, err) // Ensure the first identity is deleted diff --git a/test/e2e/parallel/registration_service_test.go b/test/e2e/parallel/registration_service_test.go index 6d592bbe7..4b327f4a9 100644 --- a/test/e2e/parallel/registration_service_test.go +++ b/test/e2e/parallel/registration_service_test.go @@ -372,7 +372,7 @@ func TestSignupOK(t *testing.T) { }) require.NoError(t, err) _, err = hostAwait.WaitForUserSignup(t, userSignup.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin(), wait.DeactivatedWithoutPreDeactivation())...), + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.DeactivatedWithoutPreDeactivation())...), wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueDeactivated)) require.NoError(t, err) require.NoError(t, hostAwait.WaitUntilSpaceAndSpaceBindingsDeleted(t, userSignup.Status.CompliantUsername)) @@ -593,7 +593,7 @@ func TestPhoneVerification(t *testing.T) { // Ensure the UserSignup is deactivated _, err = hostAwait.WaitForUserSignup(t, userSignup.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin(), wait.ManuallyDeactivated())...)) + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ManuallyDeactivated())...)) require.NoError(t, err) // Now attempt the verification again diff --git a/test/e2e/user_management_test.go b/test/e2e/user_management_test.go index 46c6176e9..550646922 100644 --- a/test/e2e/user_management_test.go +++ b/test/e2e/user_management_test.go @@ -265,7 +265,7 @@ func (s *userManagementTestSuite) TestUserDeactivation() { require.NoError(t, err) userSignupMember1, err = hostAwait.WaitForUserSignup(t, userSignupMember1.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.ApprovedByAdmin(), wait.Deactivated())...), + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Deactivated())...), wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueDeactivated)) require.NoError(t, err) require.True(t, states.Deactivated(userSignupMember1), "usersignup should be deactivated") @@ -502,7 +502,7 @@ func (s *userManagementTestSuite) TestUserDeactivation() { // Since the config for retention days is set to 0, the account should be deactivated again immediately userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin(), wait.DeactivatedWithoutNotification())...), + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.DeactivatedWithoutNotification())...), wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueDeactivated)) require.NoError(t, err) require.True(t, states.Deactivated(userSignup), "usersignup should be deactivated") diff --git a/test/metrics/metrics_test.go b/test/metrics/metrics_test.go index bca8ba4ae..8788c5f23 100644 --- a/test/metrics/metrics_test.go +++ b/test/metrics/metrics_test.go @@ -295,7 +295,7 @@ func TestVerificationRequiredMetric(t *testing.T) { // when reactivating the user InvokeEndpoint(t, "POST", route+"/api/v1/signup", token0, "", http.StatusAccepted) userSignup, err = hostAwait.WaitForUserSignup(t, identity0.Username, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.VerificationRequired())...), + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.VerificationRequired(), wait.ApprovedDeactivated())...), wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueNotReady)) // then diff --git a/testsupport/deactivation.go b/testsupport/deactivation.go index 82339dff3..b81820a2e 100644 --- a/testsupport/deactivation.go +++ b/testsupport/deactivation.go @@ -37,10 +37,8 @@ func DeactivateAndCheckUser(t *testing.T, awaitilities wait.Awaitilities, userSi assert.Equal(t, "userdeactivated", notification.Spec.Template) assert.Equal(t, userSignup.Spec.Userid, notification.Spec.Context["UserID"]) - // We wait for the "Approved()" condition status here because it doesn't specify a reason for the approval, - // and the reason should not be necessary for the purpose of this test. userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name, - wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin(), wait.DeactivatedWithoutPreDeactivation())...), + wait.UntilUserSignupHasConditions(wait.ConditionSet(wait.Default(), wait.DeactivatedWithoutPreDeactivation())...), wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueDeactivated)) require.NoError(t, err) require.True(t, states.Deactivated(userSignup), "usersignup should be deactivated") diff --git a/testsupport/wait/conditions.go b/testsupport/wait/conditions.go index 0200443ec..5f291a05a 100644 --- a/testsupport/wait/conditions.go +++ b/testsupport/wait/conditions.go @@ -103,6 +103,16 @@ func ApprovedByAdmin() []toolchainv1alpha1.Condition { } } +func ApprovedDeactivated() []toolchainv1alpha1.Condition { + return []toolchainv1alpha1.Condition{ + { + Type: toolchainv1alpha1.UserSignupApproved, + Status: corev1.ConditionFalse, + Reason: toolchainv1alpha1.UserSignupUserDeactivatedReason, + }, + } +} + func PendingApprovalNoCluster() []toolchainv1alpha1.Condition { return []toolchainv1alpha1.Condition{ { @@ -230,6 +240,11 @@ func DeactivatedWithoutPreDeactivation() []toolchainv1alpha1.Condition { Status: corev1.ConditionTrue, Reason: "NotificationCRCreated", }, + { + Type: toolchainv1alpha1.UserSignupApproved, + Status: corev1.ConditionFalse, + Reason: toolchainv1alpha1.UserSignupUserDeactivatedReason, + }, } } @@ -245,6 +260,11 @@ func DeactivatedWithoutNotification() []toolchainv1alpha1.Condition { Status: corev1.ConditionFalse, Reason: "UserIsActive", }, + { + Type: toolchainv1alpha1.UserSignupApproved, + Status: corev1.ConditionFalse, + Reason: toolchainv1alpha1.UserSignupUserDeactivatedReason, + }, } } @@ -260,6 +280,11 @@ func ManuallyDeactivated() []toolchainv1alpha1.Condition { Status: corev1.ConditionTrue, Reason: "NotificationCRCreated", }, + { + Type: toolchainv1alpha1.UserSignupApproved, + Status: corev1.ConditionFalse, + Reason: toolchainv1alpha1.UserSignupUserDeactivatedReason, + }, } } @@ -280,6 +305,11 @@ func Deactivated() []toolchainv1alpha1.Condition { Status: corev1.ConditionTrue, Reason: "NotificationCRCreated", }, + { + Type: toolchainv1alpha1.UserSignupApproved, + Status: corev1.ConditionFalse, + Reason: toolchainv1alpha1.UserSignupUserDeactivatedReason, + }, } }