Skip to content

Keep the configured interval test's update check from running before its verify - #161

Draft
jwrosewell wants to merge 1 commit into
rcfrom
test/data-update-zero-delay
Draft

jwrosewell wants to merge 1 commit into
rcfrom
test/data-update-zero-delay

Conversation

@jwrosewell

Copy link
Copy Markdown
Contributor

Tests only. DataUpdateServiceTests.DataUpdateService_Register_AutoUpdateConfiguredInterval fails about once in 600 runs, and it failed Ubuntu_Java_17 in full build 43667464820 of #156, which changes nothing in pipeline.engines. This fixes the cause rather than leaving it to a re-run, which is the rule for a test that fails on timing that #122 writes into AGENTS.md.

The cause

The test registers a data file with automatic updates on and a polling interval of 0, then verifies that futureFactory.schedule was called once with a delay no longer than the randomisation maximum. With no polling interval, the delay is only the random part, a whole number of seconds below 600 (DataUpdateServiceDefault.java lines 736 to 761, random.nextInt(config.getMaxRandomisationSeconds())), so it is 0 about once in 600 registrations. The test class's future factory runs each scheduled task on a real executor (DataUpdateServiceTests.java lines 129 to 150), so a check scheduled at 0 runs straight away. A check that finds no update schedules again (DataUpdateServiceDefault.java lines 287 to 298), and the verify then sees two calls. The failure in 43667464820 shows exactly that, "Wanted 1 time ... But was 2 times", the second call from checkForUpdate at line 298.

What changed

The test now has the future factory return a ScheduledFuture that never runs, as it checks only the delay passed to schedule. The other tests in the class schedule with a delay of at least the update's availability or the 30 minute polling default, so they cannot hit the same race. No package code changes.

Tests

Test change 6f98bec3.

The red and green force the case the race needs, by setting the test's maximum randomisation to 1 second (so the delay is always 0) and waiting 2 seconds before the verify, plus a throwaway workflow, Java 17. Red 43674099493 ran that on rc de74c8c and the test failed in all four of its parameter runs with TooManyActualInvocations ("Wanted 1 time ... But was 67374 times", as each check at 0 schedules the next at 0). Green 43674088956 ran the same forcing on the head, and DataUpdateServiceTests passed 132 of 132.

Full build

Under way, without macOS under the 9 November decision. This section is replaced with the run, its result and the head it built when it ends.

What it releases

Nothing. The change is under src/test, which the release plan leaves out (ci/README.md).

Base branch

rc at de74c8c.

…its verify

With no polling interval, registerDataFile schedules the check after a
random number of whole seconds below 600, which is 0 about once in 600
registrations. The test's future factory runs the check on a real
executor, and a check that finds no update schedules again, so the test
then saw two schedule calls where it verifies one. That failed
Ubuntu_Java_17 in full build 43667464820. The test now has the factory
return a future that never runs, as it checks only the delay.
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.

1 participant