From d287292c83df5bbf07b75f5417b513c7d6758497 Mon Sep 17 00:00:00 2001 From: Rahul Ganesh <31204974+rahulbabu95@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:46:18 -0700 Subject: [PATCH] Remove "max-instances" from e2e binary (#8887) Signed-off-by: Rahul Ganesh Co-authored-by: Rahul Ganesh --- .../buildspecs/cloudstack-test-eks-a-cli.yml | 2 -- .../buildspecs/conformance-eks-a-cli.yml | 2 -- .../buildspecs/docker-test-eks-a-cli.yml | 2 -- .../buildspecs/nutanix-test-eks-a-cli.yml | 2 -- .../build/buildspecs/quick-test-eks-a-cli.yml | 2 -- .../build/buildspecs/snow-test-eks-a-cli.yml | 2 -- .../buildspecs/tinkerbell-test-eks-a-cli.yml | 2 -- .../buildspecs/vsphere-test-eks-a-cli.yml | 2 -- cmd/integration_test/cmd/run.go | 4 --- internal/test/e2e/run.go | 34 ++++--------------- 10 files changed, 7 insertions(+), 47 deletions(-) diff --git a/cmd/integration_test/build/buildspecs/cloudstack-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/cloudstack-test-eks-a-cli.yml index 50584ea748c2..917b21b31150 100644 --- a/cmd/integration_test/build/buildspecs/cloudstack-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/cloudstack-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 180 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 30 T_CLOUDSTACK_CIDR: "10.80.214.0/23" CLOUDSTACK_PROVIDER: true @@ -101,7 +100,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml index 6e44911dcf7c..a26fe294d337 100644 --- a/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 25 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 25 T_TINKERBELL_MAX_HARDWARE_PER_TEST: 2 T_CLOUDSTACK_CIDR: "10.80.191.0/24" @@ -154,7 +153,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/docker-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/docker-test-eks-a-cli.yml index a0a25e0abced..139fe825092c 100644 --- a/cmd/integration_test/build/buildspecs/docker-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/docker-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 180 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 180 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -51,7 +50,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml index 2865acf2b0d3..a328eabd2e7c 100644 --- a/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 180 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 50 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -84,7 +83,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/quick-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/quick-test-eks-a-cli.yml index 861cd10b7eb4..10fac88bcf5b 100644 --- a/cmd/integration_test/build/buildspecs/quick-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/quick-test-eks-a-cli.yml @@ -3,7 +3,6 @@ version: 0.2 env: variables: INTEGRATION_TEST_CLOUDWATCH_NAMESPACE_OVERRIDE: EksaQuickE2ETests - INTEGRATION_TEST_MAX_EC2_COUNT: 180 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 180 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -216,7 +215,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r ${TESTS} -v 4 diff --git a/cmd/integration_test/build/buildspecs/snow-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/snow-test-eks-a-cli.yml index c7fe1db38e79..205822d66652 100644 --- a/cmd/integration_test/build/buildspecs/snow-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/snow-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 9999 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 3 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -51,7 +50,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/tinkerbell-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/tinkerbell-test-eks-a-cli.yml index bd00e69e731d..fa00bd74fc94 100644 --- a/cmd/integration_test/build/buildspecs/tinkerbell-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/tinkerbell-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 180 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 20 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -93,7 +92,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/build/buildspecs/vsphere-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/vsphere-test-eks-a-cli.yml index e6f6250580aa..903b2a392169 100644 --- a/cmd/integration_test/build/buildspecs/vsphere-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/vsphere-test-eks-a-cli.yml @@ -2,7 +2,6 @@ version: 0.2 env: variables: - INTEGRATION_TEST_MAX_EC2_COUNT: 200 INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 60 EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts" EKSA_GIT_PRIVATE_KEY: "/tmp/private-key" @@ -115,7 +114,6 @@ phases: -s ${INTEGRATION_TEST_STORAGE_BUCKET} -j ${JOB_ID} -i ${INTEGRATION_TEST_INSTANCE_PROFILE} - -m ${INTEGRATION_TEST_MAX_EC2_COUNT} -p ${INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT} -r 'Test' -v 4 diff --git a/cmd/integration_test/cmd/run.go b/cmd/integration_test/cmd/run.go index fbb4580cc77f..cb2eb112a694 100644 --- a/cmd/integration_test/cmd/run.go +++ b/cmd/integration_test/cmd/run.go @@ -18,7 +18,6 @@ const ( jobIdFlagName = "job-id" instanceProfileFlagName = "instance-profile-name" regexFlagName = "regex" - maxInstancesFlagName = "max-instances" maxConcurrentTestsFlagName = "max-concurrent-tests" skipFlagName = "skip" bundlesOverrideFlagName = "bundles-override" @@ -62,7 +61,6 @@ func init() { runE2ECmd.Flags().StringP(jobIdFlagName, "j", "", "Id of the job being run") runE2ECmd.Flags().StringP(instanceProfileFlagName, "i", "", "IAM instance profile name to attach to ssm instances") runE2ECmd.Flags().StringP(regexFlagName, "r", "", "Run only those tests and examples matching the regular expression. Equivalent to go test -run") - runE2ECmd.Flags().IntP(maxInstancesFlagName, "m", 1, "Run tests in parallel on same instance within the max EC2 instance count") runE2ECmd.Flags().IntP(maxConcurrentTestsFlagName, "p", 1, "Maximum number of parallel tests that can be run at a time") runE2ECmd.Flags().StringSlice(skipFlagName, nil, "List of tests to skip") runE2ECmd.Flags().Bool(bundlesOverrideFlagName, false, "Flag to indicate if the tests should run with a bundles override") @@ -84,7 +82,6 @@ func runE2E(ctx context.Context) error { jobId := viper.GetString(jobIdFlagName) instanceProfileName := viper.GetString(instanceProfileFlagName) testRegex := viper.GetString(regexFlagName) - maxInstances := viper.GetInt(maxInstancesFlagName) maxConcurrentTests := viper.GetInt(maxConcurrentTestsFlagName) testsToSkip := viper.GetStringSlice(skipFlagName) bundlesOverride := viper.GetBool(bundlesOverrideFlagName) @@ -94,7 +91,6 @@ func runE2E(ctx context.Context) error { baremetalBranchName := viper.GetString(baremetalBranchFlagName) runConf := e2e.ParallelRunConf{ - MaxInstances: maxInstances, MaxConcurrentTests: maxConcurrentTests, InstanceProfileName: instanceProfileName, StorageBucket: storageBucket, diff --git a/internal/test/e2e/run.go b/internal/test/e2e/run.go index 83b1f0a1c1bc..569bd5bb1bf4 100644 --- a/internal/test/e2e/run.go +++ b/internal/test/e2e/run.go @@ -40,7 +40,6 @@ const ( type ParallelRunConf struct { TestInstanceConfigFile string - MaxInstances int MaxConcurrentTests int InstanceProfileName string StorageBucket string @@ -351,11 +350,6 @@ func (e *E2ESession) commandWithEnvVars(command string) string { } func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, error) { - testPerInstance := len(testsList) / conf.MaxInstances - if testPerInstance == 0 { - testPerInstance = 1 - } - vsphereTestsRe := regexp.MustCompile(vsphereRegex) tinkerbellTestsRe := regexp.MustCompile(tinkerbellTestsRe) cloudstackTestRe := regexp.MustCompile(cloudstackRegex) @@ -363,7 +357,7 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er privateNetworkTestsRe := regexp.MustCompile(`^.*(Proxy|RegistryMirror).*$`) multiClusterTestsRe := regexp.MustCompile(`^.*Multicluster.*$`) - runConfs := make([]instanceRunConf, 0, conf.MaxInstances) + runConfs := make([]instanceRunConf, 0, conf.MaxConcurrentTests) vsphereIPMan := newE2EIPManager(conf.Logger, os.Getenv(vsphereCidrVar)) vspherePrivateIPMan := newE2EIPManager(conf.Logger, os.Getenv(vspherePrivateNetworkCidrVar)) cloudstackIPMan := newE2EIPManager(conf.Logger, os.Getenv(cloudstackCidrVar)) @@ -379,13 +373,10 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er return nil, fmt.Errorf("creating test runner config for tests: %v", err) } - testsInEC2Instance := make([]string, 0, testPerInstance) - for i, testName := range testsList { + for _, testName := range testsList { if tinkerbellTestsRe.MatchString(testName) { continue } - - testsInEC2Instance = append(testsInEC2Instance, testName) multiClusterTest := multiClusterTestsRe.MatchString(testName) var ips networkutils.IPPool @@ -413,10 +404,7 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er } } - if len(testsInEC2Instance) == testPerInstance || (len(testsList)-1) == i { - runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), strings.Join(testsInEC2Instance, "|"), ips, []*api.Hardware{}, 0, false, Ec2TestRunnerType, testRunnerConfig)) - testsInEC2Instance = make([]string, 0, testPerInstance) - } + runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), testName, ips, []*api.Hardware{}, 0, false, Ec2TestRunnerType, testRunnerConfig)) } if strings.EqualFold(conf.BranchName, conf.BaremetalBranchName) { @@ -438,7 +426,7 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er //nolint:gocyclo // This legacy function is complex but the team too busy to simplify it func appendNonAirgappedTinkerbellRunConfs(awsSession *session.Session, testsList []string, conf ParallelRunConf, testRunnerConfig *TestInfraConfig, runConfs []instanceRunConf, ipManager *E2EIPManager) ([]instanceRunConf, error) { nonAirgappedTinkerbellTests := getTinkerbellNonAirgappedTests(testsList) - conf.Logger.V(1).Info("INFO:", "tinkerbellTests", len(nonAirgappedTinkerbellTests), "MaxInstances", conf.MaxInstances, "ConcurrentInstances", conf.MaxConcurrentTests) + conf.Logger.V(1).Info("INFO:", "tinkerbellTests", len(nonAirgappedTinkerbellTests), "ConcurrentInstances", conf.MaxConcurrentTests) nonAirgappedTinkerbellTestsWithCount, err := getTinkerbellTestsWithCount(nonAirgappedTinkerbellTests, conf) if err != nil { @@ -470,22 +458,14 @@ func appendAirgappedTinkerbellRunConfs(awsSession *session.Session, testsList [] return runConfs, nil } conf.Logger.V(1).Info("INFO:", "tinkerbellAirGappedTests", len(airgappedTinkerbellTests)) - testPerInstance := len(airgappedTinkerbellTests) / conf.MaxInstances - if testPerInstance == 0 { - testPerInstance = 1 - } - testsInVSphereInstance := make([]string, 0, testPerInstance) + airgappedTinkerbellTestsWithCount, err := getTinkerbellTestsWithCount(airgappedTinkerbellTests, conf) if err != nil { return nil, err } - for i, test := range airgappedTinkerbellTestsWithCount { - testsInVSphereInstance = append(testsInVSphereInstance, test.Name) + for _, test := range airgappedTinkerbellTestsWithCount { ipPool := ipManager.reserveIPPool(tinkerbellIPPoolSize) - if len(testsInVSphereInstance) == testPerInstance || (len(testsList)-1) == i { - runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), strings.Join(testsInVSphereInstance, "|"), ipPool, []*api.Hardware{}, test.Count, true, VSphereTestRunnerType, testRunnerConfig)) - testsInVSphereInstance = make([]string, 0, testPerInstance) - } + runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), test.Name, ipPool, []*api.Hardware{}, test.Count, true, VSphereTestRunnerType, testRunnerConfig)) } return runConfs, nil