Fix flaky TestControllerGameServerCount race condition#4392
Fix flaky TestControllerGameServerCount race condition#4392markmandel merged 2 commits intoagones-dev:mainfrom
Conversation
The test was flaky due to a race condition in the wait loop. The condition only checked that 4 time series existed (len(m.TimeSeries) == 4), but did not verify the actual count values. This allowed the test to proceed even when only 1 of 2 PortAllocation GameServers had been added to the informer cache. The fix updates the wait condition to explicitly verify that the PortAllocation metric has a count of 2 before proceeding to assertions. This ensures both GameServers are present in the cache and counted correctly, eliminating the race condition. Closes agones-dev#4389
7b4fe73 to
d9d9f4b
Compare
|
Build Succeeded 🥳 Build Id: b10926fc-124a-4876-acf1-1d5e9bd450fc The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
Build Failed 😭 Build Id: 5c2ab7cd-f872-4c18-b3c9-1a232f44ea98 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Failed 😭 Build Id: 9057fb67-573f-4fbe-a082-c62de9ef3c1b Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Succeeded 🥳 Build Id: a1872f61-e958-421a-b643-4ff15cd2ec56 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
The test was flaky due to a race condition in the wait loop. The condition only checked that 4 time series existed (len(m.TimeSeries) == 4), but did not verify the actual count values. This allowed the test to proceed even when only 1 of 2 PortAllocation GameServers had been added to the informer cache. The fix updates the wait condition to explicitly verify that the PortAllocation metric has a count of 2 before proceeding to assertions. This ensures both GameServers are present in the cache and counted correctly, eliminating the race condition. Closes agones-dev#4389
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
The test was flaky due to a race condition in the wait loop. The condition only checked that 4 time series existed (len(m.TimeSeries) == 4), but did not verify the actual count values. This allowed the test to proceed even when only 1 of 2 PortAllocation GameServers had been added to the informer cache.
The fix updates the wait condition to explicitly verify that the PortAllocation metric has a count of 2 before proceeding to assertions. This ensures both GameServers are present in the cache and counted correctly, eliminating the race condition.
Which issue(s) this PR fixes:
Closes #4389
Special notes for your reviewer: