Skip to content

Commit 3f61c87

Browse files
Merge pull request #30666 from openshift-cherrypick-robot/cherry-pick-30618-to-release-4.20
[release-4.20] OCPBUGS-72412, OCPBUGS-72413: only run Netpol two at a time
2 parents b3dfe24 + 56fe3ec commit 3f61c87

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
447447
return strings.Contains(t.name, "[sig-network]")
448448
})
449449

450+
netpolTests, networkK8sTests := splitTests(networkK8sTests, func(t *testCase) bool {
451+
return strings.Contains(t.name, "Netpol")
452+
})
453+
450454
buildsTests, openshiftTests := splitTests(openshiftTests, func(t *testCase) bool {
451455
return strings.Contains(t.name, "[sig-builds]")
452456
})
@@ -460,6 +464,7 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
460464
logrus.Infof("Found %d storage tests", len(storageTests))
461465
logrus.Infof("Found %d network k8s tests", len(networkK8sTests))
462466
logrus.Infof("Found %d network tests", len(networkTests))
467+
logrus.Infof("Found %d netpol tests", len(netpolTests))
463468
logrus.Infof("Found %d builds tests", len(buildsTests))
464469
logrus.Infof("Found %d must-gather tests", len(mustGatherTests))
465470

@@ -471,6 +476,7 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
471476
originalStorage := storageTests
472477
originalNetworkK8s := networkK8sTests
473478
originalNetwork := networkTests
479+
originalNetpol := netpolTests
474480
originalBuilds := buildsTests
475481
originalMustGather := mustGatherTests
476482

@@ -480,11 +486,12 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
480486
storageTests = append(storageTests, copyTests(originalStorage)...)
481487
networkK8sTests = append(networkK8sTests, copyTests(originalNetworkK8s)...)
482488
networkTests = append(networkTests, copyTests(originalNetwork)...)
489+
netpolTests = append(netpolTests, copyTests(originalNetpol)...)
483490
buildsTests = append(buildsTests, copyTests(originalBuilds)...)
484491
mustGatherTests = append(mustGatherTests, copyTests(originalMustGather)...)
485492
}
486493
}
487-
expectedTestCount += len(openshiftTests) + len(kubeTests) + len(storageTests) + len(networkK8sTests) + len(networkTests) + len(buildsTests) + len(mustGatherTests)
494+
expectedTestCount += len(openshiftTests) + len(kubeTests) + len(storageTests) + len(networkK8sTests) + len(networkTests) + len(netpolTests) + len(buildsTests) + len(mustGatherTests)
488495

489496
abortFn := neverAbort
490497
testCtx := ctx
@@ -522,6 +529,14 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
522529
q.Execute(testCtx, networkTestsCopy, max(1, parallelism/2), testOutputConfig, abortFn) // run network tests separately.
523530
tests = append(tests, networkTestsCopy...)
524531

532+
// k8s netpol tests are known to be heavy and there are cases when run in parallel it can overload
533+
// a cluster causing negative side effects (e.g., https://issues.redhat.com/browse/OCPBUGS-57665)
534+
// https://github.com/openshift/origin/pull/26775/changes#diff-998be43366fe821c61ca242aa34949870c9c6df2572cc060000e4cd990a72bebL58-L62
535+
// this will only run 2 in parallel at once
536+
netpolTestsCopy := copyTests(netpolTests)
537+
q.Execute(testCtx, netpolTestsCopy, 2, testOutputConfig, abortFn)
538+
tests = append(tests, netpolTestsCopy...)
539+
525540
buildsTestsCopy := copyTests(buildsTests)
526541
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.
527542
tests = append(tests, buildsTestsCopy...)

0 commit comments

Comments
 (0)