Skip to content

expose DisableStaggerStart via TestOnlyConfig - #385

Closed
bgentry wants to merge 1 commit into
masterfrom
bg-expose-disable-stagger-start-for-test-usage
Closed

expose DisableStaggerStart via TestOnlyConfig#385
bgentry wants to merge 1 commit into
masterfrom
bg-expose-disable-stagger-start-for-test-usage

Conversation

@bgentry

@bgentry bgentry commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

I ran into an issue with some external testing where I needed to run a full River client. These tests were quite slow, and I realized it was because of StaggerStartStop—a setting that is currently not exposed outside the river package.

I'm not sure this is the right way to expose it. If we end up having a set of related knobs that can be tweaked for test usage (lowering buffers, sleep durations, etc) it's likely most of the time they'll be used all together. Open to other ways to expose this.

@bgentry
bgentry requested a review from brandur June 10, 2024 04:14
@brandur

brandur commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

As discussed on Slack, my fear with the granularity here is that it's not very forward compatibility friendly. Meaning that in the future if more options were to be added like DisableStaggerStart that most tests would want to disable, people trying to disable this type of thing in tests wouldn't get the new ones unless they were paying very close attention to the changelog.

I was thinking about this one a little more overnight — what do you think about exposing TestOnly boolean for the time being, and then if the need called for it in the future, we could then expose a more granular TestOnlyConfig TestOnlyConfig property with more options?

brandur added a commit that referenced this pull request Jul 3, 2024
… start

This one's a continuation of #385. Maintenance services have a staggered
start feature that causes them to sleep for a random amount of jittered
time on startup so they don't all try to work simultaneously. This is
useful in production, but somewhat harmful in tests because it makes
start and stop slower and thereby integration test cases slower.

River has an internal flag that allows staggered start to be disabled in
its own test suite, but external users of River have no way to access
this functionality.

Here, introduce `Config.TestOnly` that can be provided to client
configuration in test suites regardless of whether the caller is
internal or not.

This differs slightly from #385 in that it provides only a boolean, with
the idea being that if we find it useful to disable other features for
tests in the future, a boolean keeps third party code for forwards
compatible in that they get these disabled automatically. In case it
does become important to distinguish between individual features at some
later time, I figure we can add an additional `TestOnlyConfig` property
that allows full configuration beyond defaults.
brandur added a commit that referenced this pull request Jul 3, 2024
… start

This one's a continuation of #385. Maintenance services have a staggered
start feature that causes them to sleep for a random amount of jittered
time on startup so they don't all try to work simultaneously. This is
useful in production, but somewhat harmful in tests because it makes
start and stop slower and thereby integration test cases slower.

River has an internal flag that allows staggered start to be disabled in
its own test suite, but external users of River have no way to access
this functionality.

Here, introduce `Config.TestOnly` that can be provided to client
configuration in test suites regardless of whether the caller is
internal or not.

This differs slightly from #385 in that it provides only a boolean, with
the idea being that if we find it useful to disable other features for
tests in the future, a boolean keeps third party code for forwards
compatible in that they get these disabled automatically. In case it
does become important to distinguish between individual features at some
later time, I figure we can add an additional `TestOnlyConfig` property
that allows full configuration beyond defaults.
@bgentry

bgentry commented Jul 3, 2024

Copy link
Copy Markdown
Contributor Author

Superseded by #414.

@bgentry bgentry closed this Jul 3, 2024
@bgentry
bgentry deleted the bg-expose-disable-stagger-start-for-test-usage branch July 3, 2024 14:33
brandur added a commit that referenced this pull request Jul 3, 2024
… start (#414)

This one's a continuation of #385. Maintenance services have a staggered
start feature that causes them to sleep for a random amount of jittered
time on startup so they don't all try to work simultaneously. This is
useful in production, but somewhat harmful in tests because it makes
start and stop slower and thereby integration test cases slower.

River has an internal flag that allows staggered start to be disabled in
its own test suite, but external users of River have no way to access
this functionality.

Here, introduce `Config.TestOnly` that can be provided to client
configuration in test suites regardless of whether the caller is
internal or not.

This differs slightly from #385 in that it provides only a boolean, with
the idea being that if we find it useful to disable other features for
tests in the future, a boolean keeps third party code for forwards
compatible in that they get these disabled automatically. In case it
does become important to distinguish between individual features at some
later time, I figure we can add an additional `TestOnlyConfig` property
that allows full configuration beyond defaults.

---------

Co-authored-by: Blake Gentry <blakesgentry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants