-
Notifications
You must be signed in to change notification settings - Fork 1
Add URLEndpointListener QE tests and TLS support in iOS TestServer #384
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0c4641b
Modified prebuild Jenkinsfile and android build.gradle to fix kotlin …
barkha06 e808a27
Modified prebuild Jenkinsfile and android build.gradle to fix kotlin …
barkha06 73afb3b
Added peer to peer TLS changes for IOS testserver and P2P tests
barkha06 3569675
Fixed syntax errors
barkha06 8fed5b8
Added spec file
barkha06 edbedae
Added spec file
barkha06 a92a751
Fixed lint errors
barkha06 7733116
Fixed ty check errors
barkha06 4cf6a57
Fixed format issue
barkha06 aa18542
Update servers/ios/TestServer/ContentTypes/StartListenerRequest.swift
barkha06 d19e200
Update tests/QE/test_peer_to_peer.py to require minimum 3 testserver
barkha06 4334ff5
Fixed indentation
barkha06 7a7d04c
Fixed indentation
barkha06 715d404
Changed MultipeerReplicatorIdentity to TLSIdentityData
barkha06 6e82c53
Fixed syntax issues
barkha06 f0769a7
Removed reuseIdentity
barkha06 02356af
Added set_identity()
barkha06 f79c858
Modified API spec and testserver version
barkha06 ff7d8fb
Modified IOS testserver version
barkha06 1317e69
Added space after TLSIdentityData?
barkha06 e60bfe8
Modified API spec - version and changes
barkha06 2dec1b6
Modified API spec - version and changes
barkha06 6606b2d
Made port a private property and added a getter
barkha06 d5633c6
Removed version check test step from spec
barkha06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Peer-to-Peer Tests | ||
|
|
||
| This document describes the test cases for Couchbase Lite peer-to-peer URLEndpointListener replication, covering concurrent updates, various topology setups (one-to-many, many-to-one), multiple databases, and server failure/restart scenarios. | ||
|
|
||
| ## test_peer_to_peer_concurrent_replication | ||
|
|
||
| Test peer-to-peer replication between a listener and a client, including concurrent document updates on both devices while replication is active. | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
|
barkha06 marked this conversation as resolved.
Outdated
|
||
| 2. Reset local databases and create `db1` on Device-1 and Device-2. | ||
| 3. Start listener on Device-1: | ||
| * database: `db1` | ||
| * collections: `["_default._default"]` | ||
| * port: 59840 | ||
| 4. Add `num_of_docs` documents to `db1` on Device-2. | ||
| 5. Setup and start a replicator on Device-2: | ||
| * endpoint: Device-1's listener URL | ||
| * collections: `["_default._default"]` | ||
| * type: `replicator_type` | ||
| * continuous: `continuous` | ||
| 6. Wait for replication to complete (Target activity: IDLE if continuous, STOPPED if not). | ||
| 7. Check that all documents are replicated correctly and both databases have the same content. | ||
| 8. Perform concurrent updates to documents on both the listener (Device-1) and the client (Device-2). | ||
| 9. Wait for replication to complete after the updates. | ||
| 10. Check that all updated documents are replicated correctly and databases match. | ||
| 11. Stop the listener on Device-1. | ||
|
|
||
| ## test_peer_to_peer_oneClient_toManyServers | ||
|
|
||
| Test a peer-to-peer topology where a single client device replicates concurrently to multiple listener servers (one-to-many). | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
| 2. Reset local databases and create `db1` on Device-1, Device-2, and Device-3. | ||
| 3. Add `num_of_docs` documents to `db1` on Device-1. | ||
| 4. Start listeners on Device-2 and Device-3 (database: `db1`, collections: `["_default._default"]`, port: 59840). | ||
| 5. Setup and start Replicator 1 on Device-1 pointing to Device-2's listener endpoint. | ||
| 6. Setup and start Replicator 2 on Device-1 pointing to Device-3's listener endpoint. | ||
| 7. Wait for both Replicator 1 and Replicator 2 to complete replication. | ||
| 8. Check that all documents are replicated correctly across all three databases. | ||
| 9. Stop the listeners on Device-2 and Device-3. | ||
|
|
||
| ## test_peer_to_peer_oneServer_toManyClients | ||
|
|
||
| Test a peer-to-peer topology where multiple client devices replicate concurrently from a single listener server (many-to-one). | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
| 2. Reset local databases and create `db1` on Device-1, Device-2, and Device-3. | ||
| 3. Add `num_of_docs` documents to `db1` on Device-1. | ||
| 4. Start a listener on Device-1 (database: `db1`, collections: `["_default._default"]`, port: 59840). | ||
| 5. Setup and start a Replicator on Device-2 pointing to Device-1's listener endpoint. | ||
| 6. Setup and start a Replicator on Device-3 pointing to Device-1's listener endpoint. | ||
| 7. Wait for both replicators on Device-2 and Device-3 to complete. | ||
| 8. Check that all documents are replicated correctly across all three databases. | ||
| 9. Stop the listener on Device-1. | ||
|
|
||
| ## test_peer_to_peer_oneServer_twoClients_on_single_db | ||
|
|
||
| Test peer-to-peer replication behavior when multiple distinct replication sessions are established from a single client database to the same listener endpoint. | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
| 2. Reset local databases and create `db1` on Device-1 and Device-2. | ||
| 3. Add `num_of_docs` documents to `db1` on Device-1. | ||
| 4. Start a listener on Device-1 (database: `db1`, collections: `["_default._default"]`, port: 59840). | ||
| 5. Setup and start three separate replicator sessions on Device-2, all using Device-2's `db1` and pointing to Device-1's listener endpoint. | ||
| 6. Wait for replication to complete on all 3 sessions. | ||
| 7. Check that all documents are replicated correctly and both databases match. | ||
| 8. Stop the listener on Device-1. | ||
|
|
||
| ## test_peer_to_peer_replication_with_multiple_dbs | ||
|
|
||
| Test concurrent peer-to-peer replication scaling across multiple databases (DB1, DB2, DB3) on two devices. | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
| 2. Create and reset 3 local databases (`db1`, `db2`, `db3`) on Device-1 and Device-2. | ||
| 3. Add `num_of_docs` documents to each of the 3 databases on Device-1. | ||
| 4. Start 3 listeners on Device-2, one for each database: | ||
| * `db1` on port 59840 | ||
| * `db2` on port 59841 | ||
| * `db3` on port 59842 | ||
| 5. Setup and start 3 separate replicators on Device-1 corresponding to each database, pointing to their respective listener endpoints on Device-2. | ||
| 6. Wait for replication to complete on all 3 replicator sessions. | ||
| 7. Check that all documents are replicated correctly across all database pairs (Device-1 DBs match Device-2 DBs). | ||
| 8. Stop all 3 listeners on Device-2. | ||
|
|
||
| ## test_peer_to_peer_with_server_down | ||
|
|
||
| Test the resilience of peer-to-peer replication when the listener server goes offline and is restarted during active client database updates. | ||
|
|
||
| 1. Verify CBL version >= 2.8.0 on all test servers. | ||
| 2. Reset local databases and create `db1` on Device-1 and Device-2. | ||
| 3. Add `num_of_docs` documents to `db1` on Device-2. | ||
| 4. Start a listener on Device-1 (database: `db1`, collections: `["_default._default"]`, port: 59840). | ||
| 5. Setup and start a replicator on Device-2 pointing to Device-1's listener endpoint. | ||
| 6. Asynchronously execute the following actions concurrently: | ||
| * Stop the listener on Device-1. | ||
| * Start a new listener on Device-1 on the same port, re-using the previous TLS identity. | ||
| * Perform document updates on Device-2. | ||
| 7. Restart the replicator on Device-2 if necessary, and wait for replication to complete. | ||
| 8. Check that all updated documents are successfully replicated to Device-1 despite the listener restart. | ||
| 9. Stop the new listener on Device-1. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I don't see a reason to make this have a default.
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.
This is a required parameter because the replication URL needs to be generated based on the port, so the ty lint check failed since it was marked optional but it needs to have int value later.
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.
It will still have an int value after it is started. I think the ty lint isn't getting all of the information.
couchbase-lite-tests/client/src/cbltest/api/listener.py
Line 78 in d19e200
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.
I still don't get why the above is not enough to satisfy this situation.
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.
I am not sure, but here's the failure:
--> /Users/barkha.goyal/Desktop/temp2/couchbase-lite-tests/tests/QE/test_peer_to_peer.py:376:24 | 374 | all_dbs[1], 375 | endpoint=cblpytest.test_servers[0].replication_url( 376 | "db1", listener1.port, tls=True | ^^^^^^^^^^^^^^ Expected int, found Unknown | int | None 377 | ), 378 | replicator_type=replicator_type, | info: Element None of this union is not assignable to int info: Method defined here --> /Users/barkha.goyal/Desktop/temp2/couchbase-lite-tests/client/src/cbltest/api/testserver.py:146:9 | 144 | await self.__request_factory.send_request(self.__index, request) 145 | 146 | def replication_url(self, db_name: str, port: int, tls: bool = False): | ^^^^^^^^^^^^^^^ --------- Parameter declared here 147 | """
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.
One way to avoid would this is to make port a private parameter and define a getter for it, since the getter will always return an int, the ty lint would accept it.