Skip to content

Commit 6d8c2d0

Browse files
Merge pull request #30226 from neisw/trt-2246-agent-disruption
trt-2246: lower parallelism based on worker nodes
2 parents a08d2f3 + 0e3d554 commit 6d8c2d0

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,33 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
316316
}
317317
}
318318

319-
parallelism := o.Parallelism
320-
if parallelism == 0 {
321-
parallelism = suite.Parallelism
322-
}
323-
324-
if parallelism == 0 {
325-
parallelism = 10
326-
}
319+
// start with suite value which should be based on a 3 worker node cluster
320+
parallelism := suite.Parallelism
321+
logrus.Infof("Suite defined parallelism %d", parallelism)
327322

328323
// adjust based on the number of workers
329324
totalNodes, workerNodes, err := getClusterNodeCounts(ctx, restConfig)
330325
if err != nil {
331326
logrus.Errorf("Failed to get cluster node counts: %v", err)
327+
} else {
328+
// default to 1/3 the defined parallelism value per worker but use the min of that
329+
// and the current parallelism value so we don't increase parallelism
330+
if workerNodes > 0 && parallelism > 0 {
331+
workerParallelism := max(1, parallelism/3) * workerNodes
332+
logrus.Infof("Parallelism based on worker node count: %d", workerParallelism)
333+
parallelism = min(parallelism, workerParallelism)
334+
}
335+
}
336+
337+
// if 0 set our min value
338+
if parallelism <= 0 {
339+
parallelism = 10
340+
}
341+
342+
// if explicitly set then use the specified value
343+
if o.Parallelism > 0 {
344+
parallelism = o.Parallelism
345+
logrus.Infof("Using specified parallelism value: %d", parallelism)
332346
}
333347

334348
logrus.Infof("Total nodes: %d, Worker nodes: %d, Parallelism: %d", totalNodes, workerNodes, parallelism)

pkg/test/ginkgo/test_suite.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var (
9898
Stable ClusterStabilityDuringTest = "Stable"
9999
// TODO only bring this back if we have some reason to collect Upgrade specific information. I can't think of reason.
100100
// TODO please contact @deads2k for vetting if you think you found something
101-
//Upgrade ClusterStabilityDuringTest = "Upgrade"
101+
// Upgrade ClusterStabilityDuringTest = "Upgrade"
102102
// Disruptive means that the suite is expected to induce outages to the cluster.
103103
Disruptive ClusterStabilityDuringTest = "Disruptive"
104104
)
@@ -119,7 +119,9 @@ type TestSuite struct {
119119

120120
// The number of times to execute each test in this suite.
121121
Count int `json:"count,omitempty"`
122-
// The maximum parallelism of this suite.
122+
// The maximum parallelism of this suite based on a minimum of 3 workers.
123+
// Otherwise, parallelism is automatically scaled down using 1/3 the parallelism value x the number of workers.
124+
// Jobs can explicitly set the parallelism value via max-parallel-tests
123125
Parallelism int `json:"parallelism,omitempty"`
124126
// The number of flakes that may occur before this test is marked as a failure.
125127
MaximumAllowedFlakes int `json:"maximumAllowedFlakes,omitempty"`

pkg/testsuites/standard_suites.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ var staticSuites = []ginkgo.TestSuite{
147147
withExcludedTestsFilter(withStandardEarlyOrLateTests("name.contains('[Suite:openshift/conformance/serial')")),
148148
},
149149
TestTimeout: 40 * time.Minute,
150+
Parallelism: 1,
150151
},
151152
{
152153
Name: "openshift/disruptive",

0 commit comments

Comments
 (0)