Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of tests: don't mutate global structs in core scheduler tests into release/1.2.x #16123

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #16120 to be assessed for backporting due to the inclusion of the label backport/1.2.x.

WARNING automatic cherry-pick of commits failed. Commits will require human attention.

The below text is copied from the body of the original PR.


Some of the core scheduler tests need the maximum batch size for writes to be smaller than the usual structs.MaxUUIDsPerWriteRequest. But they do so by unsafely modifying the global struct, which creates test flakes in other tests.

Modify the functions under test to take a batch size parameter. Production code will pass the global while the tests can inject smaller values. Turn the structs.MaxUUIDsPerWriteRequest into a constant, and add a semgrep rule for avoiding this kind of thing in the future.

Discovered while trying to debug #16112, but this should get backported to all supported versions whereas that will be only to 1.4.x

@hashicorp-cla
Copy link

hashicorp-cla commented Feb 10, 2023

CLA assistant check
All committers have signed the CLA.

Some of the core scheduler tests need the maximum batch size for writes to be
smaller than the usual `structs.MaxUUIDsPerWriteRequest`. But they do so by
unsafely modifying the global struct, which creates test flakes in other tests.

Modify the functions under test to take a batch size parameter. Production code
will pass the global while the tests can inject smaller values. Turn the
`structs.MaxUUIDsPerWriteRequest` into a constant, and add a semgrep rule for
avoiding this kind of thing in the future.
@tgross tgross force-pushed the backport/b-flaky-core-sched-tests/miserably-guiding-stinkbug branch from a0f8b18 to 1d2a243 Compare February 10, 2023 14:43
@tgross tgross merged commit 7ac292c into release/1.2.x Feb 10, 2023
@tgross tgross deleted the backport/b-flaky-core-sched-tests/miserably-guiding-stinkbug branch February 10, 2023 15:07
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.

None yet

3 participants