Wait for gamesim_primary index online before running couchbase tests#23850
Merged
Conversation
test_index_stats_metrics asserts metrics tagged with index_name:gamesim_primary, which the Couchbase indexer only reports once the bundled GSI index for gamesim-sample finishes building. Add a WaitFor against /api/v1/stats on port 9102 (Couchbase 7+) so the environment fixture blocks until the indexer is actually reporting that keyspace. Also fix the inverted exit condition in load_sample_bucket(): the loop was breaking the moment the task appeared in /pools/default/tasks instead of when it disappeared, so it returned while the sample load was still running.
Three follow-ups from review: - Check `initial_build_progress == 100` on the keyspace; the indexer also publishes stats while an index is still building. - Use `raise_for_status()` so 401/404/5xx surface immediately instead of collapsing into a 60s WaitFor timeout. - Drop the >=7 conditional around the new WaitFor; the test matrix only covers 7.x and the test that needs the index is itself gated on 7+. - Bail out of load_sample_bucket if the install response carries no matching task entry, instead of spinning on `None == None`.
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 0b2ba9e | Docs | Datadog PR Page | Give us feedback! |
Codecov Report❌ Patch coverage is Additional details and impacted files🚀 New features to boost your workflow:
|
… path - Refactor to a list comprehension that separates 'no keyspace yet' from 'still building' so each retry path is self-documenting. - Print the keyspaces seen on the negative path so a future WaitFor timeout doesn't leave a debugging dead end. - Document why load_sample_bucket bails out when the install response carries no matching task — the next gamesim_primary_index_ready WaitFor is the real readiness gate.
Contributor
Validation ReportAll 21 validations passed. Show details
|
NouemanKHAL
approved these changes
May 28, 2026
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.
What does this PR do?
Adds a
WaitForto the couchbase test environment that blocks until the indexer reportsgamesim_primaryongamesim-samplewithinitial_build_progress == 100. Also fixes an inverted exit condition (and aNone-comparison hole) in theload_sample_bucketpolling loop.Motivation
test_index_stats_metricsis flaky on Couchbase 7.2 because the environment fixture returns before the bundled GSI index forgamesim-samplefinishes building, so/api/v1/statsdoesn't emit a keyspace forgamesim_primarywhen the check runs. The previous setup waited on the/sampleBuckets/installtask as a proxy, but the polling loop's exit condition was inverted (broke when the task was still running instead of when it disappeared), so even that proxy didn't actually block.Review checklist (to be filled by reviewers)
This PR has been created and validated using the paired-review skill from agent-integrations.