Skip to content

Commit

Permalink
Change tinkerbell e2e run algorithm to use 2 pointer technique
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
  • Loading branch information
Rahul Ganesh authored and eks-distro-pr-bot committed Oct 24, 2024
1 parent 1eb4b6c commit f7bd647
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions internal/test/e2e/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,23 +438,25 @@ 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))
conf.Logger.V(1).Info("INFO:", "tinkerbellTests", len(nonAirgappedTinkerbellTests), "MaxInstances", conf.MaxInstances, "ConcurrentInstances", conf.MaxConcurrentTests)

testPerInstance := len(nonAirgappedTinkerbellTests) / conf.MaxInstances
if testPerInstance == 0 {
testPerInstance = 1
}
testsInVSphereInstance := make([]string, 0, testPerInstance)
nonAirgappedTinkerbellTestsWithCount, err := getTinkerbellTestsWithCount(nonAirgappedTinkerbellTests, conf)
if err != nil {
return nil, err
}
for i, test := range nonAirgappedTinkerbellTestsWithCount {
testsInVSphereInstance = append(testsInVSphereInstance, test.Name)
end := len(nonAirgappedTinkerbellTestsWithCount) - 1
for start := range nonAirgappedTinkerbellTestsWithCount {
if start > end/2 {
break
}
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, false, VSphereTestRunnerType, testRunnerConfig))
testsInVSphereInstance = make([]string, 0, testPerInstance)
runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), nonAirgappedTinkerbellTestsWithCount[start].Name, ipPool, []*api.Hardware{}, nonAirgappedTinkerbellTestsWithCount[start].Count, false, VSphereTestRunnerType, testRunnerConfig))

// Pop from both ends to run a longer count tests and shorter count tests together
// to efficiently use the available hardware.
if end-start > start {
ipPool := ipManager.reserveIPPool(tinkerbellIPPoolSize)
runConfs = append(runConfs, newInstanceRunConf(awsSession, conf, len(runConfs), nonAirgappedTinkerbellTestsWithCount[end-start].Name, ipPool, []*api.Hardware{}, nonAirgappedTinkerbellTestsWithCount[end-start].Count, false, VSphereTestRunnerType, testRunnerConfig))
}
}

Expand Down

0 comments on commit f7bd647

Please sign in to comment.