Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.21] Remove "max-instances" from e2e binary #8891

Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: 0.2

env:
variables:
INTEGRATION_TEST_MAX_EC2_COUNT: 180
INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 50
T_CLOUDSTACK_CIDR: "10.80.214.0/23"
CLOUDSTACK_PROVIDER: true
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -168,7 +167,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -230,7 +229,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
Expand Down
2 changes: 0 additions & 2 deletions cmd/integration_test/build/buildspecs/snow-test-eks-a-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -99,7 +98,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: 0.2

env:
variables:
INTEGRATION_TEST_MAX_EC2_COUNT: 220
INTEGRATION_TEST_MAX_CONCURRENT_TEST_COUNT: 80
EKSA_GIT_KNOWN_HOSTS: "/tmp/known_hosts"
EKSA_GIT_PRIVATE_KEY: "/tmp/private-key"
Expand Down Expand Up @@ -119,7 +118,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
Expand Down
4 changes: 0 additions & 4 deletions cmd/integration_test/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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,
Expand Down
34 changes: 7 additions & 27 deletions internal/test/e2e/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const (

type ParallelRunConf struct {
TestInstanceConfigFile string
MaxInstances int
MaxConcurrentTests int
InstanceProfileName string
StorageBucket string
Expand Down Expand Up @@ -351,19 +350,14 @@ 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)
nutanixTestsRe := regexp.MustCompile(nutanixRegex)
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))
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Loading