diff --git a/tests/build/multi-platform.go b/tests/build/multi-platform.go index c3d5ed8fb8..ebb3f6f0e8 100644 --- a/tests/build/multi-platform.go +++ b/tests/build/multi-platform.go @@ -40,7 +40,7 @@ const ( Ec2User = "ec2-user" AwsRegion = "us-east-1" AwsPlatform = "linux/arm64" - DynamicInstanceTag = "dynamic-test-instance" + DynamicMaxInstances = "3" MultiPlatformSecretKey = "build.appstudio.redhat.com/multi-platform-secret" MultiPlatformConfigKey = "build.appstudio.redhat.com/multi-platform-config" ) @@ -237,7 +237,7 @@ var _ = framework.MultiPlatformBuildSuiteDescribe("Multi Platform Controller E2E }) }) Describe("aws dynamic allocation", Label("aws-dynamic"), func() { - var testNamespace, applicationName, componentName, multiPlatformSecretName, multiPlatformTaskName, instanceId string + var testNamespace, applicationName, componentName, multiPlatformSecretName, multiPlatformTaskName, dynamicInstanceTag, instanceId string var component *appservice.Component var timeout, interval time.Duration @@ -271,6 +271,9 @@ var _ = framework.MultiPlatformBuildSuiteDescribe("Multi Platform Controller E2E Expect(testNamespace).NotTo(BeNil(), "failed to create sandbox user namespace") Expect(err).ShouldNot(HaveOccurred()) + dynamicInstanceTag := "dynamic-instance" + "-" + util.GenerateRandomString(4) + GinkgoWriter.Printf("Generated dynamic instance tag: %q\n", dynamicInstanceTag) + // Restart multi-platform-controller pod to reload configMap again podList, err := f.AsKubeAdmin.CommonController.ListAllPods(ControllerNamespace) Expect(err).ShouldNot(HaveOccurred()) @@ -286,7 +289,7 @@ var _ = framework.MultiPlatformBuildSuiteDescribe("Multi Platform Controller E2E // sleep for 10 sec so that multi-platform-controller pod comes up time.Sleep(10 * time.Second) - err = createConfigMapForDynamicInstance(f) + err = createConfigMapForDynamicInstance(f, dynamicInstanceTag) Expect(err).ShouldNot(HaveOccurred()) err = createSecretsForDynamicInstance(f) @@ -382,6 +385,7 @@ var _ = framework.MultiPlatformBuildSuiteDescribe("Multi Platform Controller E2E Expect(err).ShouldNot(HaveOccurred()) instanceId = taskRun.Annotations["build.appstudio.redhat.com/cloud-instance-id"] GinkgoWriter.Printf("INSTANCE ID: %s\n", instanceId) + Expect(instanceId).ShouldNot(BeEmpty()) }) It("that PipelineRun completes successfully", func() { @@ -394,7 +398,7 @@ var _ = framework.MultiPlatformBuildSuiteDescribe("Multi Platform Controller E2E It("check cleanup happened successfully", func() { Eventually(func() error { - instances, err := getDynamicAwsInstance(DynamicInstanceTag) + instances, err := getDynamicAwsInstance(dynamicInstanceTag) if err != nil { return err } @@ -475,7 +479,7 @@ func createConfigMapForHostPool(f *framework.Framework) error { return nil } -func createConfigMapForDynamicInstance(f *framework.Framework) error { +func createConfigMapForDynamicInstance(f *framework.Framework, instanceTag string) error { hostConfig := &v1.ConfigMap{} hostConfig.Name = HostConfig hostConfig.Namespace = ControllerNamespace @@ -483,16 +487,16 @@ func createConfigMapForDynamicInstance(f *framework.Framework) error { hostConfig.Data = map[string]string{} hostConfig.Data["dynamic-platforms"] = AwsPlatform - hostConfig.Data["instance-tag"] = DynamicInstanceTag + hostConfig.Data["instance-tag"] = instanceTag hostConfig.Data["dynamic.linux-arm64.type"] = "aws" hostConfig.Data["dynamic.linux-arm64.region"] = AwsRegion hostConfig.Data["dynamic.linux-arm64.ami"] = "ami-09d5d0912f52f9514" - hostConfig.Data["dynamic.linux-arm64.instance-type"] = "t4g.medium" + hostConfig.Data["dynamic.linux-arm64.instance-type"] = "t4g.micro" hostConfig.Data["dynamic.linux-arm64.key-name"] = "multi-platform-e2e" hostConfig.Data["dynamic.linux-arm64.aws-secret"] = AwsSecretName hostConfig.Data["dynamic.linux-arm64.ssh-secret"] = SshSecretName hostConfig.Data["dynamic.linux-arm64.security-group"] = "launch-wizard-7" - hostConfig.Data["dynamic.linux-arm64.max-instances"] = "1" + hostConfig.Data["dynamic.linux-arm64.max-instances"] = DynamicMaxInstances _, err := f.AsKubeAdmin.CommonController.CreateConfigMap(hostConfig, ControllerNamespace) if err != nil {