Skip to content

Conversation

@bbrks
Copy link
Member

@bbrks bbrks commented Aug 21, 2025

bbrks added 12 commits August 20, 2025 14:28
…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.
…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)
Copy link
Collaborator

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.

torcolvin
torcolvin previously approved these changes Aug 21, 2025
Base automatically changed from CBG-4776 to main August 21, 2025 20:24
@torcolvin torcolvin dismissed their stale review August 21, 2025 20:24

The base branch was changed.

Copilot AI review requested due to automatic review settings August 21, 2025 20:51
Copy link
Contributor

Copilot AI left a 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.Body parameters to JSON string format for REST operations
  • Removes unused temporary helper methods and related functionality
  • Adds a new PutDocInCollection method 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

@torcolvin torcolvin enabled auto-merge (squash) August 21, 2025 21:02
@torcolvin torcolvin merged commit c089b1b into main Aug 21, 2025
42 checks passed
@torcolvin torcolvin deleted the CBG-3778 branch August 21, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants