diff --git a/internal/server/options.go b/internal/server/options.go index 697673c6d6..354caed81c 100644 --- a/internal/server/options.go +++ b/internal/server/options.go @@ -40,6 +40,7 @@ type options struct { withTestPkiWorkerKeyId *string withWorkerType WorkerType withRoot string + withStopAfter uint } func getDefaultOptions() options { @@ -180,3 +181,10 @@ func WithRoot(workerId string) Option { o.withRoot = workerId } } + +// WithStopAfter provides an optional stop after count +func WithStopAfter(stopAfter uint) Option { + return func(o *options) { + o.withStopAfter = stopAfter + } +} diff --git a/internal/server/options_test.go b/internal/server/options_test.go index 9eb071b241..77bf79446d 100644 --- a/internal/server/options_test.go +++ b/internal/server/options_test.go @@ -170,4 +170,10 @@ func Test_GetOpts(t *testing.T) { opts = getOpts(WithRoot("a")) assert.Equal(t, "a", opts.withRoot) }) + t.Run("WithStopAfter", func(t *testing.T) { + opts := getDefaultOptions() + assert.Empty(t, opts.withStopAfter) + opts = getOpts(WithStopAfter(10)) + assert.Equal(t, uint(10), opts.withStopAfter) + }) }