Skip to content

Commit 0e3d554

Browse files
committed
trt-2246: update the worker parallelism calculation
1 parent 7a570af commit 0e3d554

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
352352
}
353353
}
354354

355-
// start with suite value
355+
// start with suite value which should be based on a 3 worker node cluster
356356
parallelism := suite.Parallelism
357357
logrus.Infof("Suite defined parallelism %d", parallelism)
358358

@@ -361,17 +361,17 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
361361
if err != nil {
362362
logrus.Errorf("Failed to get cluster node counts: %v", err)
363363
} else {
364-
// default to 10 concurrent tests per worker but use the min of that
365-
// and the current parallelism value
366-
if workerNodes > 0 {
367-
workerParallelism := 10 * workerNodes
364+
// default to 1/3 the defined parallelism value per worker but use the min of that
365+
// and the current parallelism value so we don't increase parallelism
366+
if workerNodes > 0 && parallelism > 0 {
367+
workerParallelism := max(1, parallelism/3) * workerNodes
368368
logrus.Infof("Parallelism based on worker node count: %d", workerParallelism)
369369
parallelism = min(parallelism, workerParallelism)
370370
}
371371
}
372372

373373
// if 0 set our min value
374-
if parallelism == 0 {
374+
if parallelism <= 0 {
375375
parallelism = 10
376376
}
377377

@@ -910,7 +910,7 @@ func determineEnvironmentFlags(ctx context.Context, upgrade bool, dryRun bool) (
910910
envFlagBuilder.AddTopology(&singleReplicaTopology)
911911
}
912912

913-
//Additional flags can only be determined if we are able to obtain the clusterState
913+
// Additional flags can only be determined if we are able to obtain the clusterState
914914
if clusterState != nil {
915915
envFlagBuilder.AddAPIGroups(clusterState.APIGroups.UnsortedList()...).
916916
AddFeatureGates(clusterState.EnabledFeatureGates.UnsortedList()...)
@@ -923,7 +923,7 @@ func determineEnvironmentFlags(ctx context.Context, upgrade bool, dryRun bool) (
923923

924924
arch := "Unknown"
925925
if len(clusterState.Masters.Items) > 0 {
926-
//TODO(sgoeddel): eventually, we may need to check every node and pass "multi" as the value if any of them differ from the masters
926+
// TODO(sgoeddel): eventually, we may need to check every node and pass "multi" as the value if any of them differ from the masters
927927
arch = clusterState.Masters.Items[0].Status.NodeInfo.Architecture
928928
}
929929
envFlagBuilder.AddArchitecture(arch)

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"`

0 commit comments

Comments
 (0)