diff --git a/python/tests/scripts/test_update_storage.py b/python/tests/scripts/test_update_storage.py index 4a3388cf73..f93b01345b 100644 --- a/python/tests/scripts/test_update_storage.py +++ b/python/tests/scripts/test_update_storage.py @@ -93,13 +93,20 @@ def test_upgrade_script_s3(moto_s3_endpoint_and_credentials): assert s3_storage.credential_key == "" -@pytest.mark.skipif(sys.platform == "win32", reason="Test fixture issue with creds") -def test_upgrade_script_s3_rbac_ok(moto_s3_endpoint_and_credentials, monkeypatch): - """Just _RBAC_ as creds is a placeholder. Leave config with that alone.""" +def get_s3_aws_auth_uri_bucket_and_setup_server(moto_s3_endpoint_and_credentials, monkeypatch): endpoint, port, bucket, aws_access_key, aws_secret_key = moto_s3_endpoint_and_credentials - uri = endpoint.replace("http://", "s3://").rsplit(":", 1)[0] + ":" + bucket + "?aws_auth=true" + "&port=" + port monkeypatch.setenv("AWS_ACCESS_KEY_ID", aws_access_key) monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", aws_secret_key) + return ( + endpoint.replace("http://", "s3://").rsplit(":", 1)[0] + ":" + bucket + "?aws_auth=true" + "&port=" + port, + bucket, + ) + + +@pytest.mark.skipif(sys.platform == "win32", reason="Test fixture issue with creds") +def test_upgrade_script_s3_rbac_ok(moto_s3_endpoint_and_credentials, monkeypatch): + """Just _RBAC_ as creds is a placeholder. Leave config with that alone.""" + uri, bucket = get_s3_aws_auth_uri_bucket_and_setup_server(moto_s3_endpoint_and_credentials, monkeypatch) ac = Arctic(uri) create_library_config(ac, LIB_NAME) @@ -112,9 +119,14 @@ def test_upgrade_script_s3_rbac_ok(moto_s3_endpoint_and_credentials, monkeypatch assert s3_storage.credential_name == USE_AWS_CRED_PROVIDERS_TOKEN assert s3_storage.credential_key == USE_AWS_CRED_PROVIDERS_TOKEN + +@pytest.mark.skipif(sys.platform == "win32", reason="Test fixture issue with creds") +def test_aws_auth_with_storage_overrider(moto_s3_endpoint_and_credentials, monkeypatch): + uri, _ = get_s3_aws_auth_uri_bucket_and_setup_server(moto_s3_endpoint_and_credentials, monkeypatch) expected = pd.DataFrame({"col1": [1, 2, 3], "col2": [4, 5, 6]}) sym = "test" ac = Arctic(uri) + ac.create_library(LIB_NAME) ac[LIB_NAME].write(sym, expected) ac = Arctic(uri) # Force load lib config from storage, to check "storage-overridened" config