test: SANDBOX-1826 - fix race condition in CreateSpaceRequest#1277
test: SANDBOX-1826 - fix race condition in CreateSpaceRequest#1277rsoaresd wants to merge 1 commit intocodeready-toolchain:masterfrom
Conversation
WalkthroughAn end-to-end test for automatic user approval is enhanced to add an additional verification that the toolchain configuration synchronization has completed, alongside existing checks for automatic approval domains and verification state. ChangesTest Enhancement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MatousJobanek, rsoaresd, xcoulon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest flaky test in TestAutomaticClusterAssignment |
| VerifyToolchainConfig(s.T(), hostAwait, | ||
| wait.UntilToolchainConfigHasAutoApprovalDomains(domains), | ||
| wait.UntilToolchainConfigHasVerificationEnabled(false), | ||
| wait.UntilToolchainConfigHasSyncedStatus(wait.ToolchainConfigSyncComplete())) |
There was a problem hiding this comment.
If I'm reading the code of the toolchainconfig controller correctly, there is no "sync in progress" state or something like that, so the sync complete status might be there for the entirety of this test function. Could you please explain in more detail how does this additional check help the situation?
There was a problem hiding this comment.
I wrongly thought that wait.ToolchainConfigSyncComplete() proves that the controller reconciled 😭 I will try to think about other solution
There was a problem hiding this comment.
Thank you so much for raising that point!



Description
Last Saturday (May 2), periodic-ci-codeready-toolchain-toolchain-e2e-master-ci-daily failed in the test
TestRunUserSignupIntegrationTest/TestAutomaticApproval. We are likely facing flakiness in this test due to a race condition between ToolchainConfig CR update and the in-memory config cache refresh in the host-operator process.The test updates ToolchainConfig to restrict auto-approval domains to anotherdomain.edu, then immediately creates a waitinglist3@redhat.com signup expecting PendingApproval. However, the UserSignup controller reads config from an in-memory cache (toolchain-common/pkg/configuration/cache.go), which is only refreshed when the ToolchainConfig controller reconciles.
If the UserSignup is reconciled before the cache is refreshed, the controller still sees the old config (all domains approved), auto-approves the user, and the test hangs forever waiting for PendingApproval conditions.
We can see in the UserSignup list that
waitinglist3was approved.Assisted-by: Cursor
Issue ticket number and link
SANDBOX-1826
Summary by CodeRabbit