Conversation
…resh and its test clock-independent WaitForJobsStepExecutor evaluated the timeout after sleeping and then returned the stale "still running" result of the poll made before the sleep, so a stalled runner (or a job finishing during the last sleep) produced "Running jobs did not finish" even though the next poll would have found no jobs. This is what made testEnterMaintenanceMode flake on macos-latest / JDK 26 with its 100ms budget. Check the timeout before each sleep so the verdict is always based on the latest poll, measure elapsed time with the monotonic nanoTime, and route time and sleeping through an injectable WaitClock so the loop can be driven deterministically in tests. testEnterMaintenanceMode now uses the fake clock; a new test reproduces the CI stall and asserts that the step succeeds when the next poll finds no running jobs. Fixes OpenIdentityPlatform#219
…stead of recovering mid-install WaitForInstallDoneStepExecutor polled the update log with no time limit, so --maxUpdateWaitTimeMs was a silent no-op. The wait now uses the WaitClock from OpenIdentityPlatform#221 and checks the budget before each sleep. When the budget is exceeded, the thread is interrupted or the status cannot be read, the update may still be running on the server. The command then marks the execution state as detached: the recovery steps (exit maintenance mode, resume scheduler, force restart) are skipped and the log names the update id, the last status and how to follow up. The default becomes 0 (wait until a terminal status), which matches the effective behaviour so far; CLI descriptor, config Javadoc and chap-update.adoc are updated accordingly. testTimeoutInstallUpdateArchive is re-enabled on FakeWaitClock, tests for a polling error and for the unlimited default are added, and the install tests move to FakeWaitClock so the enforced budget cannot make them flaky. Fixes OpenIdentityPlatform#222
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #222
Problem
--maxUpdateWaitTimeMswas a silent no-op:WaitForInstallDoneStepExecutorpolled the update log until a terminal status with no time limit, and its "failed to complete within the allotted time" branch was unreachable (upstream9cc8612fdremoved the check and disabledtestTimeoutInstallUpdateArchive). Simply re-enabling a 30 s timeout would have run the recovery steps (maintenance/disable,scheduler/resumeJobs) while the server-side install was still in progress. The same happened already today on a polling error.Change
WaitClockand checks the budget before each sleep, asWaitForJobsStepExecutordoes after [#219] Make UpdateCommand job-wait loop verdict fresh and its test clock-independent #221.UpdateExecutionState.detachedis set, the recovery stepsEXIT_MAINTENANCE_MODE,ENABLE_SCHEDULERandFORCE_RESTARTare skipped, and the log names the update id, the last known status,maintenance/update/log/{id}, and — forrestartRequired=false— the manualmaintenance/disable+scheduler/resumeJobsfollow-up. The step returnsFAIL.maxUpdateWaitTimeMs→0(wait until a terminal status), matching the effective behaviour so far. CLI@Descriptor,UpdateCommandConfigJavadoc andchap-update.adocupdated.Tests
testTimeoutInstallUpdateArchivere-enabled onFakeWaitClock; asserts detached, no recovery step, nomaintenance/disable/resumeJobscalls.testPollingErrorDetachesFromInstall(restartRequired=true, asserts no restart either).testDefaultWaitsForInstallWithoutLimit: four polls stalling 40 s each still reachCOMPLETEwith the default.testSuccessfulInstall,testSuccessfulInstallWithRestart,testFailedInstallUpdateArchivemoved toFakeWaitClock, so the now enforced budget cannot make them wall-clock dependent (the UpdateCommandTest.testEnterMaintenanceMode is wall-clock dependent and flakes on macos-latest / JDK 26 #219 failure mode).mvn -pl openidm-shell -am test -Dtest=UpdateCommandTest: 12 tests, 0 failures.