From 04b8ce1a6715421972476af9505f59f5e8898759 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Fri, 26 Jul 2024 09:07:40 -0700 Subject: [PATCH 1/2] update tests --- sky/adaptors/azure.py | 2 +- sky/data/storage.py | 2 +- tests/test_smoke.py | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sky/adaptors/azure.py b/sky/adaptors/azure.py index 731d7e836c3..0cadb0b2bd8 100644 --- a/sky/adaptors/azure.py +++ b/sky/adaptors/azure.py @@ -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.') diff --git a/sky/data/storage.py b/sky/data/storage.py index d2f052edb8c..0caeef2bc7a 100644 --- a/sky/data/storage.py +++ b/sky/data/storage.py @@ -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.') diff --git a/tests/test_smoke.py b/tests/test_smoke.py index 0413447dcec..e2cdeeff18b 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -4895,10 +4895,15 @@ def test_private_bucket(self, private_bucket): private_bucket).path.strip('/') else: private_bucket_name = urllib.parse.urlsplit(private_bucket).netloc + 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=storage_lib._BUCKET_FAIL_TO_CONNECT_MESSAGE.format( - name=private_bucket_name)): + match=match_str): storage_obj = storage_lib.Storage(source=private_bucket) @pytest.mark.no_fluidstack From a1c941ecd941e1a80f3b85ed7f13e8264d55ee88 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Fri, 26 Jul 2024 09:43:40 -0700 Subject: [PATCH 2/2] lint --- tests/test_smoke.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_smoke.py b/tests/test_smoke.py index e2cdeeff18b..6bde58708db 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -4896,14 +4896,13 @@ def test_private_bucket(self, private_bucket): else: private_bucket_name = urllib.parse.urlsplit(private_bucket).netloc match_str = storage_lib._BUCKET_FAIL_TO_CONNECT_MESSAGE.format( - name=private_bucket_name) + 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): + with pytest.raises(sky.exceptions.StorageBucketGetError, + match=match_str): storage_obj = storage_lib.Storage(source=private_bucket) @pytest.mark.no_fluidstack