Skip to content

Commit

Permalink
Rename verify_ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebusm committed Mar 11, 2024
1 parent d5d9218 commit e935c80
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
10 changes: 6 additions & 4 deletions python/arcticdb/adapters/s3_library_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ParsedQuery:
else ssl.get_default_verify_paths().capath
) # CURLOPT_CAPATH in curl

verify_ssl: Optional[bool] = False
ssl: Optional[bool] = False


class S3LibraryAdapter(ArcticLibraryAdapter):
Expand Down Expand Up @@ -96,7 +96,7 @@ def __init__(self, uri: str, encoding_version: EncodingVersion, *args, **kwargs)
raise ValueError("Please use Windows Credential Manager for cert management.")
if self._ca_cert_path and self._ca_cert_dir:
raise ValueError("CA_cert_path and CA_cert_dir should not be set at the same time.")
self._verify_ssl = self._query_params.verify_ssl
self._ssl = self._query_params.ssl

if "amazonaws" in self._endpoint:
self._configure_aws()
Expand Down Expand Up @@ -129,7 +129,7 @@ def config_library(self):
use_virtual_addressing=self._query_params.use_virtual_addressing,
ca_cert_path=self._ca_cert_path,
ca_cert_dir=self._ca_cert_dir,
ssl=self._verify_ssl,
ssl=self._ssl,
)

lib = NativeVersionStore.create_store_from_config(
Expand Down Expand Up @@ -193,6 +193,8 @@ def get_storage_override(self) -> StorageOverride:
s3_override.ca_cert_path = self._ca_cert_path
if self._ca_cert_dir:
s3_override.ca_cert_dir = self._ca_cert_dir
if self._ssl:
s3_override.ssl = self._ssl

s3_override.use_virtual_addressing = self._query_params.use_virtual_addressing

Expand Down Expand Up @@ -233,7 +235,7 @@ def get_library_config(self, name, library_options: LibraryOptions):
use_virtual_addressing=self._query_params.use_virtual_addressing,
ca_cert_path=self._ca_cert_path,
ca_cert_dir=self._ca_cert_dir,
ssl=self._verify_ssl,
ssl=self._ssl,
)

library_options.encoding_version = (
Expand Down
10 changes: 5 additions & 5 deletions python/arcticdb/storage_fixtures/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def __init__(self, factory: "BaseS3StorageFixtureFactory", bucket: str):
self.arctic_uri += f"&port={port}"
if factory.default_prefix:
self.arctic_uri += f"&path_prefix={factory.default_prefix}"
if factory.verify_ssl:
self.arctic_uri += "&verify_ssl=True"
if factory.ssl:
self.arctic_uri += "&ssl=True"
if platform.system() is not "Windows":
if factory.client_cert_file:
self.arctic_uri += f"&CA_cert_path={self.factory.client_cert_file}"
Expand Down Expand Up @@ -94,7 +94,7 @@ def create_test_cfg(self, lib_name: str) -> EnvironmentConfigsMap:
is_https=self.factory.endpoint.startswith("s3s:"),
region=self.factory.region,
use_mock_storage_for_testing=self.factory.use_mock_storage_for_testing,
ssl=self.factory.verify_ssl,
ssl=self.factory.ssl,
ca_cert_path=self.factory.client_cert_file,
)
# client_cert_dir is skipped on purpose; It will be test manually in other tests
Expand Down Expand Up @@ -143,7 +143,7 @@ class BaseS3StorageFixtureFactory(StorageFixtureFactory):
def __init__(self):
self.client_cert_file = ""
self.client_cert_dir = ""
self.verify_ssl = False
self.ssl = False

def __str__(self):
return f"{type(self).__name__}[{self.default_bucket or self.endpoint}]"
Expand Down Expand Up @@ -275,7 +275,7 @@ def _start_server(self):
self.working_dir = mkdtemp(suffix="MotoS3StorageFixtureFactory")
self._iam_endpoint = f"{self.http_protocol}://localhost:{port}"

self.verify_ssl = self.http_protocol == "https" # In real world, using https protocol doesn't necessarily mean ssl will be verified
self.ssl = self.http_protocol == "https" # In real world, using https protocol doesn't necessarily mean ssl will be verified
if self.http_protocol == "https":
self.key_file = os.path.join(self.working_dir, "key.pem")
self.cert_file = os.path.join(self.working_dir, "cert.pem")
Expand Down
14 changes: 7 additions & 7 deletions python/tests/integration/arcticdb/test_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ class ParameterDisplayStatus(Enum):

@DEDICATED_S3_NON_SSL_TEST_MARK
@pytest.mark.parametrize('client_cert_file', parameter_display_status)
@pytest.mark.parametrize('verify_ssl', parameter_display_status)
def test_s3_no_ssl_verification(s3_no_ssl_storage, client_cert_file, verify_ssl):
@pytest.mark.parametrize('ssl', parameter_display_status)
def test_s3_no_ssl_verification(s3_no_ssl_storage, client_cert_file, ssl):
uri = s3_no_ssl_storage.arctic_uri
if verify_ssl == ParameterDisplayStatus.DISABLE:
uri += "&verify_ssl=False"
elif verify_ssl == ParameterDisplayStatus.ENABLE:
uri += "&verify_ssl=True"
if ssl == ParameterDisplayStatus.DISABLE:
uri += "&ssl=False"
elif ssl == ParameterDisplayStatus.ENABLE:
uri += "&ssl=True"
if client_cert_file == ParameterDisplayStatus.DISABLE:
uri += "&CA_cert_path="
elif client_cert_file == ParameterDisplayStatus.ENABLE:
Expand All @@ -192,7 +192,7 @@ def test_s3_no_ssl_verification(s3_no_ssl_storage, client_cert_file, verify_ssl)

@DEDICATED_S3_NON_SSL_TEST_MARK
def test_s3_ca_directory_ssl_verification(s3_storage):
uri = f"s3s://{s3_storage.factory.host}:{s3_storage.bucket}?access={s3_storage.key.id}&secret={s3_storage.key.secret}&CA_cert_dir={s3_storage.factory.client_cert_dir}&verify_ssl=True"
uri = f"s3s://{s3_storage.factory.host}:{s3_storage.bucket}?access={s3_storage.key.id}&secret={s3_storage.key.secret}&CA_cert_dir={s3_storage.factory.client_cert_dir}&ssl=True"
if s3_storage.factory.port:
uri += f"&port={s3_storage.factory.port}"
ac = Arctic(uri)
Expand Down

0 comments on commit e935c80

Please sign in to comment.