Allow enabling S3 mock in all existing tests with an env var

This commit is contained in:
Kirill Bulatov
2022-01-20 01:02:01 +02:00
committed by Kirill Bulatov
parent 026eb64a83
commit 924d8d489a
2 changed files with 8 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ Useful environment variables:
should go.
`TEST_SHARED_FIXTURES`: Try to re-use a single pageserver for all the tests.
`ZENITH_PAGESERVER_OVERRIDES`: add a `;`-separated set of configs that will be passed as
`FORCE_MOCK_S3`: inits every test's pageserver with a mock S3 used as a remote storage.
`--pageserver-config-override=${value}` parameter values when zenith cli is invoked
`RUST_LOG`: logging configuration to pass into Zenith CLI

View File

@@ -395,9 +395,15 @@ class ZenithEnvBuilder:
self.pageserver_remote_storage = pageserver_remote_storage
self.num_safekeepers = num_safekeepers
self.pageserver_auth_enabled = pageserver_auth_enabled
self.s3_mock_server: Optional[MockS3Server] = None
self.env: Optional[ZenithEnv] = None
self.s3_mock_server: Optional[MockS3Server] = None
if os.getenv('FORCE_MOCK_S3') is not None:
bucket_name = f'{repo_dir.name}_bucket'
log.warning(f'Unconditionally initializing mock S3 server for bucket {bucket_name}')
self.enable_s3_mock_remote_storage(bucket_name)
def init(self) -> ZenithEnv:
# Cannot create more than one environment from one builder
assert self.env is None, "environment already initialized"