Skip to content
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

CBG-4253 create interfaces for integration testing #7112

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

torcolvin
Copy link
Collaborator

@torcolvin torcolvin commented Sep 9, 2024

These tests are intended to support https://docs.google.com/document/d/1oiPwTNKkdBkWbACvwEBsc3EbVD-PCTO1s6WCNvtwY7k work for version vectors, but are general enough to support any type of testing that requires replication.

This package lives outside the rest package since it doesn't necessarily use a REST API at all (it can for 1.x replications) and this allows easy skipping of these tests. Even in a minimal form, they take 75 secs to run under Couchbase Server and 5 seconds for rosmar.

A few test bugs were fixed:

  • bidirectional XDCR with couchbase server didn't work because we accidentally would delete an xdcr cluster from under a running XDCR replication, since setting up a bidirectional replication requires two calls to controller/createReplication. Creating two unidirectional replications would cause one to fail.
  • rosmar xdcr wasn't doing backfill. This probably will be enhanced with future PRs to do checkpointing, but was needed to have the tests pass.
  • made blip_client_test.go code public in the rest package to facilitate moving to a separate package. Minor modifications were needed to allow calling NewBlipTesterClientOptsWithRT outside of btcRunner.Run, since the tests are not conceptually run under a blip tester, blip testing just happens to be included. The check for btcRunner.Run is used to be able to run with CBMobileReplicationV4 and CBMobileReplicationV3 in a loop correctly. With these tests, having CBMobileReplicationV3 would probably be a separate flag for a couchbase peer. A single test can have multiple CouchbaseLitePeers unlike standard testing so creating AllowCreationWithoutBlipTesterClientRunner is used only for these tests.

Integration Tests

@torcolvin torcolvin force-pushed the vv-integration-test branch 4 times, most recently from aa68be6 to 7c82870 Compare September 24, 2024 21:22
@torcolvin torcolvin changed the title prototypes for HLV integration testing CBG-4253 create interfaces for integration testing Sep 24, 2024
@torcolvin torcolvin marked this pull request as ready for review September 24, 2024 21:37
peers: map[string]PeerOptions{
"cbs1": {Type: PeerTypeCouchbaseServer, BucketID: PeerBucketID1},
"sg1": {Type: PeerTypeSyncGateway, BucketID: PeerBucketID1},
"cbl1": {Type: PeerTypeCouchbaseLiteMock, BucketID: PeerBucketID1},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can/should BucketID be omitted for CBL peers?

peers: map[string]PeerOptions{
"cbs1": {Type: PeerTypeCouchbaseServer, BucketID: PeerBucketID1},
"sg1": {Type: PeerTypeSyncGateway, BucketID: PeerBucketID1},
"cbl1": {Type: PeerTypeCouchbaseLiteMock, BucketID: PeerBucketID1},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected this to be PeerTypeCouchbaseLite (and CouchbaseLiteMock would be one possible implementation of that peer).

})
config := rt.NewDbConfig()
config.AutoImport = base.BoolPtr(true)
rest.RequireStatus(t, rt.CreateDatabase("db", config), http.StatusCreated)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should database name be name instead of "db", or is db required?

@adamcfraser adamcfraser assigned torcolvin and unassigned adamcfraser Sep 25, 2024
- move code to _test.go
- force removal of BucketID for couchbase lite peers
- remove uneeded SyncGatewayPeerID, now defined at replication time
- use a better name to define a database (since peer ids are unique, but
  test names are too long)
- define CouchbaseLitePeerType but the only implementation is a mock
  peer
@adamcfraser adamcfraser merged commit edc6407 into release/anemone Sep 26, 2024
20 checks passed
@adamcfraser adamcfraser deleted the vv-integration-test branch September 26, 2024 15:51
adamcfraser pushed a commit that referenced this pull request Nov 29, 2024
* CBG-4253 create interfaces for integration testing

* fixups:

- move code to _test.go
- force removal of BucketID for couchbase lite peers
- remove uneeded SyncGatewayPeerID, now defined at replication time
- use a better name to define a database (since peer ids are unique, but
  test names are too long)
- define CouchbaseLitePeerType but the only implementation is a mock
  peer
bbrks pushed a commit that referenced this pull request Dec 2, 2024
* CBG-4253 create interfaces for integration testing

* fixups:

- move code to _test.go
- force removal of BucketID for couchbase lite peers
- remove uneeded SyncGatewayPeerID, now defined at replication time
- use a better name to define a database (since peer ids are unique, but
  test names are too long)
- define CouchbaseLitePeerType but the only implementation is a mock
  peer
bbrks pushed a commit that referenced this pull request Dec 5, 2024
* CBG-4253 create interfaces for integration testing

* fixups:

- move code to _test.go
- force removal of BucketID for couchbase lite peers
- remove uneeded SyncGatewayPeerID, now defined at replication time
- use a better name to define a database (since peer ids are unique, but
  test names are too long)
- define CouchbaseLitePeerType but the only implementation is a mock
  peer
bbrks pushed a commit that referenced this pull request Dec 17, 2024
* CBG-4253 create interfaces for integration testing

* fixups:

- move code to _test.go
- force removal of BucketID for couchbase lite peers
- remove uneeded SyncGatewayPeerID, now defined at replication time
- use a better name to define a database (since peer ids are unique, but
  test names are too long)
- define CouchbaseLitePeerType but the only implementation is a mock
  peer
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.

2 participants