Details
-
Task
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
Description
The failure:
Error MessageAssertionError: Failed to start to Sync GatewayStacktraceparams_from_base_test_setup = {'base_url': 'http://10.100.150.21:8080', 'cbl_ce': False, 'cbl_db': 'cbl-test1707826116.071193', 'cbl_log_decoder_build': None, ...} |
x509_cert_auth = True
|
|
@pytest.mark.channels |
@pytest.mark.syncgateway |
@pytest.mark.parametrize("x509_cert_auth", [ |
pytest.param(False, marks=pytest.mark.ce_sanity),
|
pytest.param(True, marks=pytest.mark.sanity)
|
])
|
def test_xattrs_grant_automatic_imports(params_from_base_test_setup, x509_cert_auth):
|
""" |
@summary: |
"1. Set xattr key in config |
2. Write a sync function to assign user xattrs value as channel |
3. Create doc via SGW . Verify docs via SGW cannot be access by user |
4. Update doc with SDK to add user xattr |
5. Perform raw GET to ensure added user xattrs is visbible |
6. Verify doc is accessed by the user who has acess to the channel defined in user xattrs" |
""" |
sg_db = "db" |
sg_url = params_from_base_test_setup["sg_url"] |
sg_admin_url = params_from_base_test_setup["sg_admin_url"] |
cluster_config = params_from_base_test_setup["cluster_config"] |
sg_blip_url = params_from_base_test_setup["target_url"] |
base_url = params_from_base_test_setup["base_url"] |
db = params_from_base_test_setup["db"] |
cbl_db = params_from_base_test_setup["source_db"] |
mode = params_from_base_test_setup["mode"] |
ssl_enabled = params_from_base_test_setup["ssl_enabled"] |
sync_gateway_version = params_from_base_test_setup["sync_gateway_version"] |
xattrs_enabled = params_from_base_test_setup["xattrs_enabled"] |
need_sgw_admin_auth = params_from_base_test_setup["need_sgw_admin_auth"] |
|
if not xattrs_enabled or sync_gateway_version < "3.0.0": |
pytest.skip('Test did not enable xattrs or sgw version is not 3.0 and above') |
|
sg_channel1_value = "abc" |
sg_channels1 = [sg_channel1_value]
|
username = "autotest" |
password = "password" |
user_custom_channel = "channel1" |
sg_doc_xattrs_id = 'sg_xattrs_0' |
sg_conf_name = "custom_sync/sync_gateway_custom_sync" |
continuous = True
|
num_of_docs = 10 |
sg_config = sync_gateway_config_path_for_mode(sg_conf_name, mode)
|
|
sg_client = MobileRestClient()
|
|
# 1. Set xattr key in config |
# 2. Write a sync function to assign user xattrs value as channel |
# Replace with sync function on sgw config to use user xattrs for channels |
temp_sg_config = replace_xattrs_sync_func_in_config(sg_config, user_custom_channel)
|
|
# Reset cluster to ensure no data in system
|
disable_tls_server = params_from_base_test_setup["disable_tls_server"] |
if x509_cert_auth and disable_tls_server: |
pytest.skip("x509 test cannot run tls server disabled") |
if x509_cert_auth: |
temp_cluster_config = copy_to_temp_conf(cluster_config, mode)
|
persist_cluster_config_environment_prop(temp_cluster_config, 'x509_certs', True) |
persist_cluster_config_environment_prop(temp_cluster_config, 'server_tls_skip_verify', False) |
cluster_config = temp_cluster_config
|
c_cluster = cluster.Cluster(config=cluster_config)
|
> c_cluster.reset(sg_config_path=temp_sg_config)
|