Conversation
|
Droid finished @torcolvin's task —— View job |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Sync Gateway’s REST test harness and related tests to replace custom WaitForCondition* polling (used around dbconfig/config-polling scenarios) with testify’s EventuallyWithT-style helpers for clearer failure output and less bespoke polling logic.
Changes:
- Added
RestTester.WaitForDatabaseandRestTester.WaitForInvalidDatabasehelpers built onrequire.EventuallyWithT. - Refactored several dbconfig/config-polling tests to use the new helpers (and
EventuallyWithT/Neverdirectly in a couple spots). - Relaxed
ServerContext.AllInvalidDatabaseNames’s testing-only signature from*testing.Ttotesting.TB.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
rest/utilities_testing.go |
Adds new RestTester wait helpers and adjusts AllInvalidDatabaseNames to accept testing.TB. |
rest/config_test.go |
Switches invalid-db polling from inline EventuallyWithT to rt.WaitForInvalidDatabase. |
rest/adminapitest/resync_test.go |
Replaces a generic “any db exists” poll with rt2.WaitForDatabase("db"). |
rest/adminapitest/admin_api_test.go |
Refactors multiple config-polling/invalid-config waits to use the new helpers and EventuallyWithT. |
Suppressed comments (3)
rest/adminapitest/admin_api_test.go:1205
- This call waits for "db1" to be tracked as invalid, but the previous logic required exactly one invalid database config. If that's still the intended invariant for this scenario, keep the count check to prevent the test passing with unexpected extra invalid configs.
rt3.WaitForInvalidDatabase("db1")
rest/adminapitest/admin_api_test.go:1273
- This wait no longer asserts that there is exactly 1 invalid database config (it only checks presence of "db1"). If the test expects a single invalid config here, add a length assertion to preserve the original check and avoid masking additional invalid configs.
rt3.WaitForInvalidDatabase("db1")
rest/adminapitest/admin_api_test.go:1334
- This now only waits for "db1" to appear as invalid; previously the test asserted there was exactly one invalid database. If that strictness is still desired, add a length assertion so the test fails when additional invalid configs are present unexpectedly.
rt.WaitForInvalidDatabase("db1")
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| invalidDatabases := rt.ServerContext().AllInvalidDatabaseNames(t) | ||
| assert.Equal(c, 1, len(invalidDatabases)) | ||
| }, time.Second*10, time.Millisecond*100) | ||
| rt.WaitForInvalidDatabase("db1") |
| return len(invalidDatabases) == 1 | ||
| }, 200, 1000) | ||
| require.NoError(t, err) | ||
| rt.WaitForInvalidDatabase("db1") |
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.
CBG-5702 replace WaitForCondition test helpers for dbconfig
Remove
WaitForConditionwith testify helpers which give better output.Integration Tests