Skip to content

Commit

Permalink
KUBESAW-248: Drop NSTemplateTier.Status.Updates field
Browse files Browse the repository at this point in the history
Signed-off-by: Feny Mehta <[email protected]>
  • Loading branch information
fbm3307 committed Jan 6, 2025
1 parent fc38f5d commit 38df139
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
17 changes: 0 additions & 17 deletions test/e2e/parallel/nstemplatetier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ func TestUpdateNSTemplateTier(t *testing.T) {
verifyResourceUpdatesForUserSignups(t, hostAwait, memberAwait, cookieUsers, cookieTier)
verifyResourceUpdatesForSpaces(t, hostAwait, memberAwait, spaces, chocolateTier)

// finally, verify the counters in the status.history for both 'cheesecake' and 'cookie' tiers
// cheesecake tier
// there should be 2 entries in the status.history (1 create + 1 update)
verifyStatus(t, hostAwait, "cheesecake", 2)

// cookie tier
// there should be 2 entries in the status.history (1 create + 1 update)
verifyStatus(t, hostAwait, "cookie", 2)

// chocolate tier
// there should be 2 entries in the status.history (1 create + 1 update)
verifyStatus(t, hostAwait, "chocolate", 2)
}

func TestResetDeactivatingStateWhenPromotingUser(t *testing.T) {
Expand Down Expand Up @@ -233,11 +221,6 @@ func setupAccounts(t *testing.T, awaitilities wait.Awaitilities, tier *tiers.Cus
return userSignups
}

func verifyStatus(t *testing.T, hostAwait *wait.HostAwaitility, tierName string, expectedCount int) {
_, err := hostAwait.WaitForNSTemplateTierAndCheckTemplates(t, tierName, wait.UntilNSTemplateTierStatusUpdates(expectedCount))
require.NoError(t, err)
}

func verifyResourceUpdatesForUserSignups(t *testing.T, hostAwait *wait.HostAwaitility, memberAwaitility *wait.MemberAwaitility, userSignups []*toolchainv1alpha1.UserSignup, tier *tiers.CustomNSTemplateTier) {
// if there's an annotation that describes on which other tier this one is based (for e2e tests only)
for _, usersignup := range userSignups {
Expand Down
4 changes: 0 additions & 4 deletions testsupport/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ func WaitForDeployments(t *testing.T) wait.Awaitilities {
err = initHostAwait.WaitUntilBaseNSTemplateTierIsUpdated(t)
require.NoError(t, err)

// check that the default user tier exists and is updated to the current version, an outdated version is applied from deploy/e2e-tests/usertier-base.yaml as
// part of the e2e test setup make target for the purpose of verifying the user tier update mechanism on startup of the host operator
err = initHostAwait.WaitUntilBaseUserTierIsUpdated(t)
require.NoError(t, err)
})

if !IsSecondMemberMode(t) {
Expand Down
14 changes: 1 addition & 13 deletions testsupport/wait/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ func (a *HostAwaitility) printUserTierWaitCriterionDiffs(t *testing.T, actual *t
t.Log(buf.String())
}

// UntilUserTierHasDeactivationTimeoutDays verify that the UserTier status.Updates has the specified number of entries
// UntilUserTierHasDeactivationTimeoutDays verify that the UserTier spec.DeactivationTimeoutDays is equal to the expected nummber
func UntilUserTierHasDeactivationTimeoutDays(expected int) UserTierWaitCriterion {
return UserTierWaitCriterion{
Match: func(actual *toolchainv1alpha1.UserTier) bool {
Expand Down Expand Up @@ -1015,18 +1015,6 @@ func UntilNSTemplateTierSpec(matcher NSTemplateTierSpecMatcher) NSTemplateTierWa
}
}

// UntilNSTemplateTierStatusUpdates verify that the NSTemplateTier status.Updates has the specified number of entries
func UntilNSTemplateTierStatusUpdates(expected int) NSTemplateTierWaitCriterion {
return NSTemplateTierWaitCriterion{
Match: func(actual *toolchainv1alpha1.NSTemplateTier) bool {
return len(actual.Status.Updates) == expected
},
Diff: func(actual *toolchainv1alpha1.NSTemplateTier) string {
return fmt.Sprintf("expected status.updates count %d. Actual: %d", expected, len(actual.Status.Updates))
},
}
}

// HasNoTemplateRefWithSuffix checks that ALL namespaces' `TemplateRef` doesn't have the suffix
func HasNoTemplateRefWithSuffix(suffix string) NSTemplateTierSpecMatcher {
return NSTemplateTierSpecMatcher{
Expand Down

0 comments on commit 38df139

Please sign in to comment.