Skip to content

Commit

Permalink
[Azure blob] fix test_private_bucket for azure blob (#3791)
Browse files Browse the repository at this point in the history
* update tests

* lint
  • Loading branch information
romilbhardwaj authored Jul 26, 2024
1 parent a378a08 commit 5bd26d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sky/adaptors/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def get_client(name: str,
if 'ERROR: AADSTS50020' in str(e):
with ux_utils.print_exception_no_traceback():
raise sky_exceptions.StorageBucketGetError(
'Attempted to fetch a non-existant public '
'Attempted to fetch a non-existent public '
'container name: '
f'{container_client.container_name}. '
'Please check if the name is correct.')
Expand Down
2 changes: 1 addition & 1 deletion sky/data/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,7 @@ def _get_bucket(self) -> Tuple[str, bool]:
if 'Name or service not known' in error_message:
with ux_utils.print_exception_no_traceback():
raise exceptions.StorageBucketGetError(
'Attempted to fetch the container from non-existant '
'Attempted to fetch the container from non-existent '
'storage account '
f'name: {self.storage_account_name}. Please check '
'if the name is correct.')
Expand Down
12 changes: 8 additions & 4 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -4895,10 +4895,14 @@ def test_private_bucket(self, private_bucket):
private_bucket).path.strip('/')
else:
private_bucket_name = urllib.parse.urlsplit(private_bucket).netloc
with pytest.raises(
sky.exceptions.StorageBucketGetError,
match=storage_lib._BUCKET_FAIL_TO_CONNECT_MESSAGE.format(
name=private_bucket_name)):
match_str = storage_lib._BUCKET_FAIL_TO_CONNECT_MESSAGE.format(
name=private_bucket_name)
if store_type == 'https':
# Azure blob uses a different error string since container may
# not exist even though the bucket name is ok.
match_str = 'Attempted to fetch a non-existent public container'
with pytest.raises(sky.exceptions.StorageBucketGetError,
match=match_str):
storage_obj = storage_lib.Storage(source=private_bucket)

@pytest.mark.no_fluidstack
Expand Down

0 comments on commit 5bd26d9

Please sign in to comment.