-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-3778: Remove usages of RestTester DocDirectly functions #7697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ociated attachment endpoints) using existing `rev` parameter - which can automatically detect RevTreeID/CV. Switch test helpers to use CV in writes when available for coverage, and allow fallback to RevTreeID. Prevent CV OCC value in doc updates for docs in conflict or against non-current versions, since we don't maintain linear version history like we do for RevTrees and can't correlate an old CV with a branched revision ID.
… Rev generation but makes the code simpler
…ter.GetDocVersion for general test coverage.
| func RequireDocVersionNotEqual(t *testing.T, expected, actual DocVersion) { | ||
| // CBG-4751: should be able to uncomment this line once cv is included in write response | ||
| //require.NotEqual(t, expected.CV.String(), actual.CV.String(), "Versions mismatch. Expected: %v, Actual: %v", expected, actual) | ||
| require.NotEqual(t, expected.CV.String(), actual.CV.String(), "Versions mismatch. Expected: %v, Actual: %v", expected, actual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where these are 0, then this is going to compare @ == @.
This isn't a problem but it could be confusing and maybe add a check if one is empty and the other isn't? Or leave it, it obviously didn't cause test failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes usage of deprecated DocDirectly functions from the RestTester testing utility, replacing them with REST API-based alternatives that follow standard testing patterns. This is part of a broader effort to clean up testing infrastructure and remove deprecated testing methods.
- Replaces direct database operations (
PutDocDirectly,UpdateDocDirectly,DeleteDocDirectly) with REST API calls - Converts
db.Bodyparameters to JSON string format for REST operations - Removes unused temporary helper methods and related functionality
- Adds a new
PutDocInCollectionmethod for collection-specific document operations
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
rest/utilities_testing_resttester.go |
Removes deprecated DocDirectly methods, updates existing methods to use http.Method* constants, adds PutDocInCollection method |
rest/utilities_testing.go |
Uncomments CV comparison logic in RequireDocVersionNotEqual |
rest/revocation_test.go |
Converts PutDocDirectly/UpdateDocDirectly calls to REST API equivalents |
rest/replicatortest/replicator_test.go |
Updates test methods to use REST API calls instead of direct database operations |
rest/replicatortest/replicator_revtree_test.go |
Converts direct database operations to REST API calls |
rest/importtest/import_test.go |
Updates import tests to use REST API methods |
rest/doc_api_test.go |
Converts document creation to use REST API |
rest/changestest/changes_api_test.go |
Simplifies document update logic using REST API |
rest/blip_legacy_revid_test.go |
Updates BLIP tests to use REST API for document operations |
rest/blip_channel_filter_test.go |
Converts channel filter tests to use REST API |
rest/blip_api_replication_test.go |
Updates replication tests, removes unused import |
rest/blip_api_delta_sync_test.go |
Converts delta sync tests to REST API, updates skip reason |
rest/blip_api_crud_test.go |
Updates CRUD tests to use REST API methods |
rest/blip_api_collections_test.go |
Updates collections tests to use new PutDocInCollection method |
rest/attachment_test.go |
Converts attachment tests to use REST API |
rest/api_test.go |
Updates API tests to use REST methods |
rest/access_test.go |
Converts access tests to use REST API |
db/changes.go |
Removes outdated TODO comment |
CBG-3778
Dependencies