Details
-
Task
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
Description
The failure:
Error MessageFailed: Timeout >1800sStacktraceparams_from_base_test_setup = {'base_url': 'http://10.100.150.148:8080', 'cbl_db': 'cbl-test1708686260.262461', 'cbs_ce': False, 'cluster_config': 'resources/cluster_configs/multiple_sync_gateways_cc', ...} |
setup_customized_teardown_test = {'cbl_db1': <CBLClient.MemoryPointer.MemoryPointer object at 0x113356a90>, 'cbl_db2': <CBLClient.MemoryPointer.MemoryP...l_db3': <CBLClient.MemoryPointer.MemoryPointer object at 0x11154b650>, 'cbl_db_name1': 'cbl_db11708686260.456683', ...} |
sg_conf_name = 'listener_tests/multiple_sync_gateways', num_of_docs = 10 |
|
@pytest.mark.listener |
@pytest.mark.replication |
@pytest.mark.parametrize("sg_conf_name, num_of_docs", [ |
pytest.param('listener_tests/multiple_sync_gateways', 10, marks=pytest.mark.sanity), |
('listener_tests/multiple_sync_gateways', 100), |
('listener_tests/multiple_sync_gateways', 1000) |
])
|
def test_multiple_sgs_with_CBLs(params_from_base_test_setup, setup_customized_teardown_test, sg_conf_name, num_of_docs):
|
""" |
@summary: |
1. Create 2 DBs and Create docs in CBL |
2. Do push replication to two SGS(each DB |
to each SG)
|
3. exchange DBs of SG and do pull replication. |
4. stop one of the sg. |
5. pull again |
6. Verify one CBL DB should be successful |
other CBL DB should fail as associated Sg is down
|
|
""" |
sg_db1 = "sg_db1" |
sg_db2 = "sg_db2" |
protocol = "ws" |
sg_mode = params_from_base_test_setup["mode"] |
cluster_config = params_from_base_test_setup["cluster_config"] |
base_url = params_from_base_test_setup["base_url"] |
sync_gateway_version = params_from_base_test_setup["sync_gateway_version"] |
liteserv_platform = params_from_base_test_setup["liteserv_platform"] |
sg_ssl = params_from_base_test_setup["sg_ssl"] |
need_sgw_admin_auth = params_from_base_test_setup["need_sgw_admin_auth"] |
|
channels1 = ["Replication1"] |
channels2 = ["Replication2"] |
name1 = "autotest1" |
name2 = "autotest2" |
sg_client = MobileRestClient()
|
|
if sync_gateway_version < "2.0": |
pytest.skip('It does not work with sg < 2.0 , so skipping the test') |
# Modify sync-gateway config to use no-conflicts config
|
|
cluster_config = "{}/multiple_sync_gateways_{}".format(CLUSTER_CONFIGS_DIR, sg_mode) |
c = cluster.Cluster(config=cluster_config)
|
sg_config = sync_gateway_config_path_for_mode(sg_conf_name, sg_mode)
|
c.reset(sg_config_path=sg_config)
|
db = Database(base_url)
|
|
sg1, sg2 = create_sync_gateways(
|
cluster_config=cluster_config,
|
sg_config_path=sg_config
|
)
|
|
admin = Admin(sg1)
|
admin.admin_url = sg1.url
|
|
sg1_ip = sg1.ip
|
sg2_ip = sg2.ip
|
sg1_admin_url = sg1.admin.admin_url
|
sg2_admin_url = sg2.admin.admin_url
|
if sg_ssl: |
protocol = "wss" |
sg1_blip_url = "{}://{}:4984/{}".format(protocol, sg1_ip, sg_db1) |
sg2_blip_url = "{}://{}:4984/{}".format(protocol, sg2_ip, sg_db2) |
|
auth = need_sgw_admin_auth and (RBAC_FULL_ADMIN['user'], RBAC_FULL_ADMIN['pwd']) or None |
sg_client.create_user(sg1_admin_url, sg_db1, "autotest1", password="password", channels=channels1, auth=auth) |
sg_client.create_user(sg2_admin_url, sg_db2, "autotest2", password="password", channels=channels2, auth=auth) |
# Create bulk doc json
|
cbl_db1 = setup_customized_teardown_test["cbl_db1"] |
cbl_db2 = setup_customized_teardown_test["cbl_db2"] |
db.create_bulk_docs(num_of_docs, "Replication1", db=cbl_db1, channels=channels1) |
cbl_doc_ids1 = db.getDocIds(cbl_db1)
|
db.create_bulk_docs(num_of_docs, "Replication2", db=cbl_db2, channels=channels2) |
cbl_doc_ids2 = db.getDocIds(cbl_db2)
|
|
# 2. Do push replication to two SGS(each DB to each SG) |
replicator = Replication(base_url)
|
cookie, session_id = sg_client.create_session(sg1_admin_url, sg_db1, name1, auth=auth)
|
authenticator = Authenticator(base_url)
|
replicator_authenticator1 = authenticator.authentication(session_id, cookie, authentication_type="session") |
repl1 = replicator.configure_and_replicate(
|
source_db=cbl_db1, replicator_authenticator=replicator_authenticator1, target_url=sg1_blip_url, replication_type="push") |
|
cookie, session_id = sg_client.create_session(sg2_admin_url, sg_db2, name2, auth=auth)
|
authenticator = Authenticator(base_url)
|
replicator_authenticator2 = authenticator.authentication(session_id, cookie, authentication_type="session") |
repl2 = replicator.configure_and_replicate(
|
source_db=cbl_db2, replicator_authenticator=replicator_authenticator2, target_url=sg2_blip_url, replication_type="push") |
replicator.stop(repl1)
|
replicator.stop(repl2)
|
|
time.sleep(280) |
# 3. exchange DBs of SG and do pull replication. |
repl1 = replicator.configure_and_replicate(
|
source_db=cbl_db1, replicator_authenticator=replicator_authenticator2, target_url=sg2_blip_url, replication_type="pull") |
repl2 = replicator.configure_and_replicate(
|
source_db=cbl_db2, replicator_authenticator=replicator_authenticator1, target_url=sg1_blip_url, replication_type="pull") |
|
replicator.stop(repl1)
|
replicator.stop(repl2)
|
|
# 4. stop one of the sg. |
sg1.stop()
|
# Add docs on cbl_db2
|
db.create_bulk_docs(1, "Replication2-2", db=cbl_db2, channels=channels2) |
# 5. Pull again |
repl1 = replicator.configure_and_replicate(
|
source_db=cbl_db1, replicator_authenticator=replicator_authenticator2, target_url=sg2_blip_url, replication_type="pull") |
repl2 = replicator.configure_and_replicate(
|
> source_db=cbl_db2, replicator_authenticator=replicator_authenticator1, target_url=sg1_blip_url, replication_type="pull", err_check=False) |