Skip to content

Commit d6abb9c

Browse files
committed
fixing nstemplatetier test
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
1 parent ac0211a commit d6abb9c

2 files changed

Lines changed: 8 additions & 32 deletions

File tree

deploy/base1ns-gotemplate/tier.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ apiVersion: toolchain.dev.openshift.com/v1alpha1
22
kind: NSTemplateTier
33
metadata:
44
name: ttr-go-template
5+
labels:
6+
go-template: toolchain-e2e
57
spec:
68
clusterResources:
79
templateRef: ttr-clusterresources-go-template

test/e2e/parallel/nstemplatetier_test.go

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ func TestNSTemplateTiers(t *testing.T) {
5959
notCreatedByE2e := client.MatchingLabelsSelector{
6060
Selector: labels.NewSelector().Add(*e2eProducer),
6161
}
62-
err = hostAwait.Client.List(context.TODO(), allTiers, client.InNamespace(hostAwait.Namespace), notCreatedByE2e)
62+
GoTemplate, err := labels.NewRequirement("go-template", selection.Equals, []string{"toolchain-e2e"})
63+
require.NoError(t, err)
64+
notGoTemplate := client.MatchingLabelsSelector{
65+
Selector: labels.NewSelector().Add(*GoTemplate),
66+
}
67+
err = hostAwait.Client.List(context.TODO(), allTiers, client.InNamespace(hostAwait.Namespace), notCreatedByE2e, notGoTemplate)
6368
require.NoError(t, err)
6469
assert.Len(t, allTiers.Items, len(tiersToCheck))
6570

@@ -247,37 +252,6 @@ func setupAccounts(t *testing.T, awaitilities wait.Awaitilities, tier *tiers.Cus
247252
return userSignups
248253
}
249254

250-
func setupGoAccounts(t *testing.T, awaitilities wait.Awaitilities, tier *tiers.CustomNSTemplateTier, nameFmt string, targetCluster *wait.MemberAwaitility, count int) []*toolchainv1alpha1.UserSignup {
251-
// first, let's create the a new NSTemplateTier (to avoid messing with other tiers)
252-
hostAwait := awaitilities.Host()
253-
254-
// let's create a few users (more than `maxPoolSize`)
255-
// and wait until they are all provisioned by calling EnsureMUR()
256-
userSignups := make([]*toolchainv1alpha1.UserSignup, count)
257-
for i := 0; i < count; i++ {
258-
user := NewSignupRequest(awaitilities).
259-
Username(fmt.Sprintf(nameFmt, i)).
260-
ManuallyApprove().
261-
WaitForMUR().
262-
UserID(uuid.Must(uuid.NewV4()).String()).
263-
RequireConditions(wait.ConditionSet(wait.Default(), wait.ApprovedByAdmin())...).
264-
TargetCluster(targetCluster).
265-
Execute(t)
266-
userSignups[i] = user.UserSignup
267-
}
268-
269-
// let's promote to users the new tier
270-
for i := range userSignups {
271-
272-
VerifyResourcesProvisionedForSignup(t, awaitilities, userSignups[i])
273-
274-
username := fmt.Sprintf(nameFmt, i)
275-
tiers.MoveSpaceToTier(t, hostAwait, username, tier.Name)
276-
VerifyResourcesProvisionedForSignupWithTiers(t, awaitilities, userSignups[i], "deactivate30", "ttr-go-template")
277-
}
278-
return userSignups
279-
}
280-
281255
func verifyResourceUpdatesForUserSignups(t *testing.T, hostAwait *wait.HostAwaitility, memberAwaitility *wait.MemberAwaitility, userSignups []*toolchainv1alpha1.UserSignup, tier *tiers.CustomNSTemplateTier) {
282256
// if there's an annotation that describes on which other tier this one is based (for e2e tests only)
283257
for _, usersignup := range userSignups {

0 commit comments

Comments
 (0)