Skip to content

Commit

Permalink
Split the test
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoebus Mak authored and phoebusm committed Sep 8, 2023
1 parent 0596c47 commit f6a9797
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions python/tests/scripts/test_update_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit f6a9797

Please sign in to comment.