Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f06e41b
added 2 more tests, second test is a combination of two tests
vipbhardwaj Nov 10, 2025
2037c7c
Merged the second and third tests into a single test.
vipbhardwaj Nov 12, 2025
f1e4cf3
ssh removal + need to work on Caddy for the 2nd test, currently unabl…
vipbhardwaj Nov 27, 2025
57c9e0e
Merge branch 'main' into log_redaction_phase2
vipbhardwaj Nov 29, 2025
2c953c0
Log redaction in-line with merged SG refactoring
vipbhardwaj Nov 29, 2025
34bcb01
Refactored syncgateway file to segregate the admin and public APIs
vipbhardwaj Nov 22, 2025
b261f65
Added the code supporting multi-CBS, and first test replying on it
vipbhardwaj Nov 24, 2025
cb2df40
Mypy error fix, added hostname as a prop to class
vipbhardwaj Nov 25, 2025
3ab82dc
Added CBS methods to support the 2nd added test
vipbhardwaj Nov 26, 2025
eb28f60
Fixed the issues related to the commetns ^
vipbhardwaj Nov 26, 2025
efb6d5b
Comment fixes for couchbaseserver.py
vipbhardwaj Nov 28, 2025
299c233
Fixing mypy error, rebased latest sg.py
vipbhardwaj Dec 1, 2025
a255a41
Added fail-fast for cluster-node obj
vipbhardwaj Dec 2, 2025
494a628
Removed a mistakenly added snippet
vipbhardwaj Dec 3, 2025
c73f396
Merge branch 'main' into sgw-multi_cbs-migration
vipbhardwaj Dec 5, 2025
0ac696e
Merge branch 'main' of https://github.com/couchbaselabs/couchbase-lit…
vipbhardwaj Dec 6, 2025
b44e794
Merge branch 'main' of https://github.com/couchbaselabs/couchbase-lit…
vipbhardwaj Dec 6, 2025
836013d
added helpers + session avoked at init instead of multiple for every …
vipbhardwaj Dec 6, 2025
d3a9073
added another test to multi-CBS and fixes for last comment
vipbhardwaj Dec 10, 2025
134ebdc
optimized the test + infra overall
vipbhardwaj Dec 11, 2025
d63a51b
added ISGR class, missing specs
vipbhardwaj Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
461 changes: 459 additions & 2 deletions client/src/cbltest/api/couchbaseserver.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions client/src/cbltest/api/syncgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,9 @@ async def _send_request(

async def get_version(self) -> CouchbaseVersion:
# Telemetry not really important for this call
scheme = "https://" if self.__secure else "http://"
scheme = "https://" if self.secure else "http://"
async with self._create_session(
self.__secure, scheme, self.__hostname, 4984, None
self.secure, scheme, self.hostname, 4984, None
) as s:
resp = await self._send_request("get", "/", session=s)
assert isinstance(resp, dict)
Expand All @@ -544,13 +544,13 @@ async def get_version(self) -> CouchbaseVersion:
return SyncGatewayVersion(raw_version.split("/")[1])

def tls_cert(self) -> str | None:
if not self.__secure:
if not self.secure:
cbl_warning(
"Sync Gateway instance not using TLS, returning empty tls_cert..."
)
return None

return ssl.get_server_certificate((self.__hostname, self.__port))
return ssl.get_server_certificate((self.hostname, self.port))

def replication_url(self, db_name: str, load_balancer: str | None = None) -> str:
"""
Expand All @@ -563,7 +563,7 @@ def replication_url(self, db_name: str, load_balancer: str | None = None) -> str
if not load_balancer:
return sgw_address

return sgw_address.replace("wss", "ws").replace(self.__hostname, load_balancer)
return sgw_address.replace("wss", "ws").replace(self.hostname, load_balancer)

async def bytes_transferred(self, dataset_name: str) -> tuple[int, int]:
"""
Expand Down Expand Up @@ -1090,9 +1090,9 @@ async def get_document_revision_public(
)
params = {"rev": revision}

scheme = "https://" if self.__secure else "http://"
scheme = "https://" if self.secure else "http://"
async with self._create_session(
self.__secure, scheme, self.__hostname, 4984, auth
self.secure, scheme, self.hostname, 4984, auth
) as session:
return await self._send_request("GET", path, params=params, session=session)

Expand Down
17 changes: 13 additions & 4 deletions environment/aws/server_setup/configure-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ curl_check() {
wait_for_uri 200 http://localhost:8091/ui/index.html
echo "Couchbase Server up!"

my_ip=$(ifconfig | grep "inet 10" | awk '{print $2}')

if [[ ! -z $E2E_PARENT_CLUSTER ]]; then
my_ip=$(ifconfig | grep "inet 10" | awk '{print $2}')
echo "Adding node to cluster $E2E_PARENT_CLUSTER"
couchbase_cli_check server-add -c $E2E_PARENT_CLUSTER -u Administrator -p password --server-add $my_ip \
echo "Adding node to cluster $E2E_PARENT_CLUSTER with private IP $my_ip"
couchbase_cli_check server-add -c $E2E_PARENT_CLUSTER -u Administrator -p password --server-add $my_ip \
--server-add-username Administrator --server-add-password password --services data,index,query
echo
echo "Rebalancing cluster"
Expand All @@ -82,6 +83,14 @@ else
echo
fi

# Set alternate address for external access (after cluster init/join)
if [[ ! -z $E2E_PUBLIC_HOSTNAME ]]; then
echo "Setting alternate address to $E2E_PUBLIC_HOSTNAME for external access (node: $my_ip)"
couchbase_cli_check setting-alternate-address -c localhost -u Administrator -p password \
--set --node $my_ip --hostname $E2E_PUBLIC_HOSTNAME
echo
fi

echo "Verify credentials"
curl_check http://localhost:8091/settings/web -d port=8091 -d username=Administrator -d password=password -u Administrator:password
echo
Expand All @@ -91,7 +100,7 @@ couchbase_cli_check user-manage --set \
-c localhost -u Administrator -p password \
--rbac-username admin --rbac-password password \
--auth-domain local \
--roles 'sync_gateway_dev_ops,sync_gateway_configurator[*],mobile_sync_gateway[*],bucket_full_access[*],bucket_admin[*]'
--roles 'admin'
echo

echo "Couchbase Server configured"
Expand Down
6 changes: 5 additions & 1 deletion environment/aws/server_setup/setup_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def setup_node(
"/tmp/configure-node.sh:/etc/service/couchbase-config/run",
"-v",
"/home/ec2-user/log:/opt/couchbase/var/lib/couchbase/logs",
"-e",
f"E2E_PUBLIC_HOSTNAME={hostname}",
]

if cluster is not None:
Expand Down Expand Up @@ -147,5 +149,7 @@ def main(topology: TopologyConfig) -> None:
server,
topology.ssh_key,
cluster_config.version,
cluster_config.internal_hostnames[0],
cluster_config.public_hostnames[
0
], # Use public hostname for external access
)
2 changes: 1 addition & 1 deletion jenkins/pipelines/QE/sgw/topology.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"test_servers": [],
"clusters": [
{
"server_count": 1
"server_count": 2
}
],
"sync_gateways": [
Expand Down
20 changes: 20 additions & 0 deletions spec/tests/QE/test_multiple_servers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Multiple Couchbase Server Tests

## test_rebalance_sanity

Test that Sync Gateway handles Couchbase Server cluster rebalancing correctly during concurrent document updates.

1. Create bucket on CBS cluster
2. Configure database on SGW with distributed indexing enabled
3. Create user with specific channels
4. Create user client for SGW access
5. Add 100 docs to Sync Gateway
6. Verify all docs were created and store original revisions and version vectors
7. Start concurrent updates (100 updates per doc) and rebalance CBS cluster
8. Rebalance OUT cbs_two from cluster
9. Add cbs_two back to cluster
10. Rebalance IN cbs_two to cluster
11. Wait for all updates to complete
12. Verify all docs are present and revisions/version vectors changed
13. Cleanup: Delete database and bucket

Loading
Loading