Skip to content

Commit 9b677a4

Browse files
committed
TRT-2403: Isolate k8s/network tests
1 parent dfb1d4a commit 9b677a4

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -450,22 +450,30 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
450450
return err
451451
}
452452

453-
storageTests, openshiftTests := splitTests(primaryTests, func(t *testCase) bool {
453+
kubeTests, openshiftTests := splitTests(primaryTests, func(t *testCase) bool {
454+
return k8sTestNames[t.name]
455+
})
456+
457+
storageTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
454458
return strings.Contains(t.name, "[sig-storage]")
455459
})
456460

457-
cliTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
461+
cliTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
458462
return strings.Contains(t.name, "[sig-cli]")
459463
})
460464

461-
appsTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
465+
appsTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
462466
return strings.Contains(t.name, "[sig-apps]")
463467
})
464468

465-
nodeTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
469+
nodeTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
466470
return strings.Contains(t.name, "[sig-node]")
467471
})
468472

473+
networkK8sTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
474+
return strings.Contains(t.name, "[sig-network]")
475+
})
476+
469477
networkTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
470478
return strings.Contains(t.name, "[sig-network]")
471479
})
@@ -479,13 +487,10 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
479487
return strings.Contains(t.name, "[sig-cli] oc adm must-gather")
480488
})
481489

482-
k8sTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
483-
return k8sTestNames[t.name]
484-
})
485-
486490
logrus.Infof("Found %d openshift tests", len(openshiftTests))
487-
logrus.Infof("Found %d kubernetes tests", len(k8sTests))
491+
logrus.Infof("Found %d kubernetes tests", len(kubeTests))
488492
logrus.Infof("Found %d storage tests", len(storageTests))
493+
logrus.Infof("Found %d network k8s tests", len(networkK8sTests))
489494
logrus.Infof("Found %d cli tests", len(cliTests))
490495
logrus.Infof("Found %d apps tests", len(appsTests))
491496
logrus.Infof("Found %d node tests", len(nodeTests))
@@ -496,29 +501,31 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
496501
// If user specifies a count, duplicate the kube and openshift tests that many times.
497502
expectedTestCount := len(early) + len(late)
498503
if count != -1 {
504+
originalKube := kubeTests
499505
originalOpenshift := openshiftTests
500506
originalStorage := storageTests
507+
originalNetworkK8s := networkK8sTests
501508
originalCLI := cliTests
502509
originalApps := appsTests
503510
originalNode := nodeTests
504511
originalNetwork := networkTests
505512
originalBuilds := buildsTests
506-
originalK8sTests := k8sTests
507513
originalMustGather := mustGatherTests
508514

509515
for i := 1; i < count; i++ {
516+
kubeTests = append(kubeTests, copyTests(originalKube)...)
510517
openshiftTests = append(openshiftTests, copyTests(originalOpenshift)...)
511518
storageTests = append(storageTests, copyTests(originalStorage)...)
512519
cliTests = append(cliTests, copyTests(originalCLI)...)
513520
appsTests = append(appsTests, copyTests(originalApps)...)
514521
nodeTests = append(nodeTests, copyTests(originalNode)...)
522+
networkK8sTests = append(networkK8sTests, copyTests(originalNetworkK8s)...)
515523
networkTests = append(networkTests, copyTests(originalNetwork)...)
516524
buildsTests = append(buildsTests, copyTests(originalBuilds)...)
517-
k8sTests = append(k8sTests, copyTests(originalK8sTests)...)
518525
mustGatherTests = append(mustGatherTests, copyTests(originalMustGather)...)
519526
}
520527
}
521-
expectedTestCount += len(openshiftTests) + len(storageTests) + len(cliTests) + len(appsTests) + len(nodeTests) + len(networkTests) + len(buildsTests) + len(k8sTests) + len(mustGatherTests)
528+
expectedTestCount += len(openshiftTests) + len(kubeTests) + len(storageTests) + len(cliTests) + len(appsTests) + len(nodeTests) + len(networkK8sTests) + len(networkTests) + len(buildsTests) + len(mustGatherTests)
522529

523530
abortFn := neverAbort
524531
testCtx := ctx
@@ -540,11 +547,19 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
540547
// we loop indefinitely.
541548
for i := 0; (i < 1 || count == -1) && testCtx.Err() == nil; i++ {
542549

550+
kubeTestsCopy := copyTests(kubeTests)
551+
q.Execute(testCtx, kubeTestsCopy, parallelism, testOutputConfig, abortFn)
552+
tests = append(tests, kubeTestsCopy...)
553+
543554
// I thought about randomizing the order of the kube, storage, and openshift tests, but storage dominates our e2e runs, so it doesn't help much.
544555
storageTestsCopy := copyTests(storageTests)
545556
q.Execute(testCtx, storageTestsCopy, max(1, parallelism/2), testOutputConfig, abortFn) // storage tests only run at half the parallelism, so we can avoid cloud provider quota problems.
546557
tests = append(tests, storageTestsCopy...)
547558

559+
networkK8sTestsCopy := copyTests(networkK8sTests)
560+
q.Execute(testCtx, networkK8sTestsCopy, max(1, parallelism/2), testOutputConfig, abortFn) // run network tests separately.
561+
tests = append(tests, networkK8sTestsCopy...)
562+
548563
cliTestsCopy := copyTests(cliTests)
549564
q.Execute(testCtx, cliTestsCopy, max(1, parallelism/2), testOutputConfig, abortFn) // cli tests only run at half the parallelism, so we can avoid high cpu problems.
550565
tests = append(tests, cliTestsCopy...)
@@ -565,10 +580,6 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
565580
q.Execute(testCtx, buildsTestsCopy, max(1, parallelism/2), testOutputConfig, abortFn) // builds tests only run at half the parallelism, so we can avoid high cpu problems.
566581
tests = append(tests, buildsTestsCopy...)
567582

568-
k8sTestCopy := copyTests(k8sTests)
569-
q.Execute(testCtx, k8sTestCopy, parallelism, testOutputConfig, abortFn)
570-
tests = append(tests, k8sTestCopy...)
571-
572583
openshiftTestsCopy := copyTests(openshiftTests)
573584
q.Execute(testCtx, openshiftTestsCopy, parallelism, testOutputConfig, abortFn)
574585
tests = append(tests, openshiftTestsCopy...)

0 commit comments

Comments
 (0)