Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions test/e2e/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ type ScaleSpecInput struct {
// ScaleSpec implements a scale test for clusters with MachineDeployments.
func ScaleSpec(ctx context.Context, inputGetter func() ScaleSpecInput) {
var (
specName = "scale"
input ScaleSpecInput
namespace *corev1.Namespace
cancelWatches context.CancelFunc
specName = "scale"
input ScaleSpecInput
namespace *corev1.Namespace
deployClusterInSeparateNamespaces bool
clusterNames []string
cancelWatches context.CancelFunc
)

BeforeEach(func() {
Expand Down Expand Up @@ -263,7 +265,7 @@ func ScaleSpec(ctx context.Context, inputGetter func() ScaleSpecInput) {
additionalClusterClassCount := *cmp.Or(variableAsInt64(input.E2EConfig.GetVariableOrEmpty(scaleAdditionalClusterClassCount)),
input.AdditionalClusterClassCount, ptr.To[int64](0),
)
deployClusterInSeparateNamespaces := *cmp.Or(variableAsBool(input.E2EConfig.GetVariableOrEmpty(scaleDeployClusterInSeparateNamespaces)),
deployClusterInSeparateNamespaces = *cmp.Or(variableAsBool(input.E2EConfig.GetVariableOrEmpty(scaleDeployClusterInSeparateNamespaces)),
input.DeployClusterInSeparateNamespaces, ptr.To[bool](false),
)
useCrossNamespaceClusterClass := *cmp.Or(variableAsBool(input.E2EConfig.GetVariableOrEmpty(scaleUseCrossNamespaceClusterClass)),
Expand Down Expand Up @@ -375,7 +377,7 @@ func ScaleSpec(ctx context.Context, inputGetter func() ScaleSpecInput) {
By("Create workload clusters concurrently")
// Create multiple clusters concurrently from the same base cluster template.

clusterNames := make([]string, 0, clusterCount)
clusterNames = make([]string, 0, clusterCount)
clusterNameDigits := 1 + int(math.Log10(float64(clusterCount)))
for i := int64(1); i <= clusterCount; i++ {
// This ensures we always have the right number of leading zeros in our cluster names, e.g.
Expand Down Expand Up @@ -523,6 +525,21 @@ func ScaleSpec(ctx context.Context, inputGetter func() ScaleSpecInput) {
return input.BootstrapClusterProxy.GetClient().Delete(ctx, &runtimev1.ExtensionConfig{ObjectMeta: metav1.ObjectMeta{Name: input.ExtensionConfigName}})
}, 10*time.Second, 1*time.Second).Should(Succeed(), "Deleting ExtensionConfig failed")
}
Byf("Deleting namespace used for hosting the %q test spec", specName)
framework.DeleteNamespace(ctx, framework.DeleteNamespaceInput{
Deleter: input.BootstrapClusterProxy.GetClient(),
Name: namespace.Name,
})
if deployClusterInSeparateNamespaces {
Byf("Deleting namespace used for hosting the %q test spec ClusterClass", specName)
for _, clusterName := range clusterNames {
namespaceName := clusterName
framework.DeleteNamespace(ctx, framework.DeleteNamespaceInput{
Deleter: input.BootstrapClusterProxy.GetClient(),
Name: namespaceName,
})
}
}
}
cancelWatches()
})
Expand Down