Skip to content

Commit 77e8d2b

Browse files
authored
feat: add configurable timeouts to exp scaletest dynamic-parameters (coder#20355)
Adds timeout configuration to `exp scaletest dynamic-parameters` closes: coder/internal#912
1 parent ccf0b34 commit 77e8d2b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cli/exp_scaletest_dynamicparameters.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func (r *RootCmd) scaletestDynamicParameters() *serpent.Command {
3030
numEvals int64
3131
tracingFlags = &scaletestTracingFlags{}
3232
prometheusFlags = &scaletestPrometheusFlags{}
33+
// This test requires unlimited concurrency
34+
timeoutStrategy = &timeoutFlags{}
3335
)
3436
orgContext := NewOrganizationContext()
3537
output := &scaletestOutputFlags{}
@@ -102,7 +104,10 @@ func (r *RootCmd) scaletestDynamicParameters() *serpent.Command {
102104
return xerrors.Errorf("setup dynamic parameters partitions: %w", err)
103105
}
104106

105-
th := harness.NewTestHarness(harness.ConcurrentExecutionStrategy{}, harness.ConcurrentExecutionStrategy{})
107+
th := harness.NewTestHarness(
108+
timeoutStrategy.wrapStrategy(harness.ConcurrentExecutionStrategy{}),
109+
// there is no cleanup since it's just a connection that we sever.
110+
nil)
106111

107112
for i, part := range partitions {
108113
for j := range part.ConcurrentEvaluations {
@@ -123,7 +128,9 @@ func (r *RootCmd) scaletestDynamicParameters() *serpent.Command {
123128
}
124129
}
125130

126-
err = th.Run(ctx)
131+
testCtx, testCancel := timeoutStrategy.toContext(ctx)
132+
defer testCancel()
133+
err = th.Run(testCtx)
127134
if err != nil {
128135
return xerrors.Errorf("run test harness: %w", err)
129136
}
@@ -158,5 +165,6 @@ func (r *RootCmd) scaletestDynamicParameters() *serpent.Command {
158165
output.attach(&cmd.Options)
159166
tracingFlags.attach(&cmd.Options)
160167
prometheusFlags.attach(&cmd.Options)
168+
timeoutStrategy.attach(&cmd.Options)
161169
return cmd
162170
}

0 commit comments

Comments
 (0)