@@ -26,7 +26,7 @@ const (
2626 testResultError = "error"
2727 nonAirgappedHardware = "nonAirgappedHardware"
2828 airgappedHardware = "AirgappedHardware"
29- maxIPPoolSize = 10
29+ maxIPPoolSize = 7
3030 minIPPoolSize = 1
3131 tinkerbellIPPoolSize = 2
3232
@@ -388,24 +388,33 @@ func splitTests(testsList []string, conf ParallelRunConf) ([]instanceRunConf, er
388388 if vsphereTestsRe .MatchString (testName ) {
389389 if privateNetworkTestsRe .MatchString (testName ) {
390390 if multiClusterTest {
391- ips = vspherePrivateIPMan .reserveIPPool (maxIPPoolSize )
391+ ips , err = vspherePrivateIPMan .reserveIPPool (maxIPPoolSize )
392392 } else {
393- ips = vspherePrivateIPMan .reserveIPPool (minIPPoolSize )
393+ ips , err = vspherePrivateIPMan .reserveIPPool (minIPPoolSize )
394394 }
395395 } else {
396396 if multiClusterTest {
397- ips = vsphereIPMan .reserveIPPool (maxIPPoolSize )
397+ ips , err = vsphereIPMan .reserveIPPool (maxIPPoolSize )
398398 } else {
399- ips = vsphereIPMan .reserveIPPool (minIPPoolSize )
399+ ips , err = vsphereIPMan .reserveIPPool (minIPPoolSize )
400400 }
401401 }
402+ if err != nil {
403+ return nil , fmt .Errorf ("failed to reserve IP pool for test %s: %v" , testName , err )
404+ }
402405 } else if nutanixTestsRe .MatchString (testName ) {
403- ips = nutanixIPMan .reserveIPPool (minIPPoolSize )
406+ ips , err = nutanixIPMan .reserveIPPool (minIPPoolSize )
407+ if err != nil {
408+ return nil , fmt .Errorf ("failed to reserve IP pool for test %s: %v" , testName , err )
409+ }
404410 } else if cloudstackTestRe .MatchString (testName ) {
405411 if multiClusterTest {
406- ips = cloudstackIPMan .reserveIPPool (maxIPPoolSize )
412+ ips , err = cloudstackIPMan .reserveIPPool (maxIPPoolSize )
407413 } else {
408- ips = cloudstackIPMan .reserveIPPool (minIPPoolSize )
414+ ips , err = cloudstackIPMan .reserveIPPool (minIPPoolSize )
415+ }
416+ if err != nil {
417+ return nil , fmt .Errorf ("failed to reserve IP pool for test %s: %v" , testName , err )
409418 }
410419 }
411420
@@ -442,13 +451,19 @@ func appendNonAirgappedTinkerbellRunConfs(awsSession *session.Session, testsList
442451 if start > end / 2 {
443452 break
444453 }
445- ipPool := ipManager .reserveIPPool (tinkerbellIPPoolSize )
454+ ipPool , err := ipManager .reserveIPPool (tinkerbellIPPoolSize )
455+ if err != nil {
456+ return nil , fmt .Errorf ("failed to reserve IP pool for tinkerbell test %s: %v" , nonAirgappedTinkerbellTestsWithCount [start ].Name , err )
457+ }
446458 runConfs = append (runConfs , newInstanceRunConf (awsSession , conf , len (runConfs ), nonAirgappedTinkerbellTestsWithCount [start ].Name , ipPool , []* api.Hardware {}, nonAirgappedTinkerbellTestsWithCount [start ].Count , false , VSphereTestRunnerType , testRunnerConfig ))
447459
448460 // Pop from both ends to run a longer count tests and shorter count tests together
449461 // to efficiently use the available hardware.
450462 if end - start > start {
451- ipPool := ipManager .reserveIPPool (tinkerbellIPPoolSize )
463+ ipPool , err := ipManager .reserveIPPool (tinkerbellIPPoolSize )
464+ if err != nil {
465+ return nil , fmt .Errorf ("failed to reserve IP pool for tinkerbell test %s: %v" , nonAirgappedTinkerbellTestsWithCount [end - start ].Name , err )
466+ }
452467 runConfs = append (runConfs , newInstanceRunConf (awsSession , conf , len (runConfs ), nonAirgappedTinkerbellTestsWithCount [end - start ].Name , ipPool , []* api.Hardware {}, nonAirgappedTinkerbellTestsWithCount [end - start ].Count , false , VSphereTestRunnerType , testRunnerConfig ))
453468 }
454469 }
@@ -469,7 +484,10 @@ func appendAirgappedTinkerbellRunConfs(awsSession *session.Session, testsList []
469484 return nil , err
470485 }
471486 for _ , test := range airgappedTinkerbellTestsWithCount {
472- ipPool := ipManager .reserveIPPool (tinkerbellIPPoolSize )
487+ ipPool , err := ipManager .reserveIPPool (tinkerbellIPPoolSize )
488+ if err != nil {
489+ return nil , fmt .Errorf ("failed to reserve IP pool for airgapped tinkerbell test %s: %v" , test .Name , err )
490+ }
473491 runConfs = append (runConfs , newInstanceRunConf (awsSession , conf , len (runConfs ), test .Name , ipPool , []* api.Hardware {}, test .Count , true , VSphereTestRunnerType , testRunnerConfig ))
474492 }
475493
0 commit comments