Skip to content

Commit

Permalink
Tests for intel-x-large tier (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeykazakov authored Nov 5, 2024
1 parent 7c1b209 commit 0c385c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/e2e/parallel/nstemplatetier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNSTemplateTiers(t *testing.T) {
space := user.Space

// all tiers to check - keep the base as the last one, it will verify downgrade back to the default tier at the end of the test
tiersToCheck := []string{"advanced", "baseextendedidling", "baselarge", "test", "appstudio", "appstudiolarge", "appstudio-env", "base1ns", "base1nsnoidling", "base1ns6didler", "intelmedium", "intellarge", "base"}
tiersToCheck := []string{"advanced", "baseextendedidling", "baselarge", "test", "appstudio", "appstudiolarge", "appstudio-env", "base1ns", "base1nsnoidling", "base1ns6didler", "intelmedium", "intellarge", "intelxlarge", "base"}

// when the tiers are created during the startup then we can verify them
allTiers := &toolchainv1alpha1.NSTemplateTierList{}
Expand Down Expand Up @@ -281,9 +281,9 @@ func TestTierTemplates(t *testing.T) {
allTiers := &toolchainv1alpha1.TierTemplateList{}
err = hostAwait.Client.List(context.TODO(), allTiers, client.InNamespace(hostAwait.Namespace), notCreatedByE2e)
require.NoError(t, err)
// We have 27 tier templates (base: 3, base1ns: 2, base1nsnoidling: 2, base1ns6didler: 3, baselarge: 3, baseextendedidling: 3, advanced: 3, test: 3, appstudio: 3, appstudiolarge: 3, appstudio-env: 3, intelmedium: 2, intellarge: 2)
// We have 29 tier templates (base: 3, base1ns: 2, base1nsnoidling: 2, base1ns6didler: 3, baselarge: 3, baseextendedidling: 3, advanced: 3, test: 3, appstudio: 3, appstudiolarge: 3, appstudio-env: 3, intelmedium: 2, intellarge: 2, intelxlarge: 2)
// But we cannot verify the exact number of tiers, because during the operator update it may happen that more TierTemplates are created
assert.GreaterOrEqual(t, len(allTiers.Items), 31)
assert.GreaterOrEqual(t, len(allTiers.Items), 33)
}

func TestFeatureToggles(t *testing.T) {
Expand Down
19 changes: 17 additions & 2 deletions testsupport/tiers/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
testTier = "test"
intelMedium = "intelmedium"
intelLarge = "intellarge"
intelXLarge = "intelxlarge"

// common CPU limits
baseCPULimit = "40000m"
Expand Down Expand Up @@ -83,6 +84,8 @@ func NewChecksForTier(tier *toolchainv1alpha1.NSTemplateTier) (TierChecks, error
return &intelMediumTierChecks{tierName: intelMedium}, nil
case intelLarge:
return &intelLargeTierChecks{intelMediumTierChecks{tierName: intelLarge}}, nil
case intelXLarge:
return &intelXLargeTierChecks{intelLargeTierChecks{intelMediumTierChecks{tierName: intelXLarge}}}, nil
default:
return nil, fmt.Errorf("no assertion implementation found for %s", tier.Name)
}
Expand Down Expand Up @@ -710,9 +713,21 @@ type intelLargeTierChecks struct {
}

func (a *intelLargeTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
return getNamespaceObjectChecksForIntelLarge("32Gi")
}

type intelXLargeTierChecks struct {
intelLargeTierChecks
}

func (a *intelXLargeTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
return getNamespaceObjectChecksForIntelLarge("64Gi")
}

func getNamespaceObjectChecksForIntelLarge(memoryLimit string) []namespaceObjectsCheck {
checks := []namespaceObjectsCheck{
resourceQuotaComputeDeploy("16", "32Gi", "16", "32Gi"),
resourceQuotaComputeBuild("16", "32Gi", "16", "32Gi"),
resourceQuotaComputeDeploy("16", memoryLimit, "16", memoryLimit),
resourceQuotaComputeBuild("16", memoryLimit, "16", memoryLimit),
resourceQuotaStorage("15Gi", "100Gi", "15Gi", "5"),
limitRange("1", "1000Mi", "10m", "64Mi"),
numberOfLimitRanges(1),
Expand Down

0 comments on commit 0c385c9

Please sign in to comment.