diff --git a/docker-compose.yml b/docker-compose.yml index 693c273b..54e3d2c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,7 +57,6 @@ services: createbuckets: profiles: - test-exporter - - test-parquet-factory image: minio/mc depends_on: minio: diff --git a/features/src/minio.py b/features/src/minio.py index 3ddf5e24..99d2d864 100644 --- a/features/src/minio.py +++ b/features/src/minio.py @@ -43,6 +43,18 @@ def minio_client(context: Context): context.minio_client = client +def create_bucket(context: Context): + """Remove the bucket if exists and re-create again.""" + bucket_name = context.S3_bucket_name + found = context.minio_client.bucket_exists(bucket_name) + + if found: + clean_bucket(context) + context.minio_client.remove_bucket(bucket_name) + + context.minio_client.make_bucket(bucket_name) + + def bucket_check(context: Context): """Check bucket existence.""" bucket_name = context.S3_bucket_name diff --git a/features/steps/exporter_s3.py b/features/steps/exporter_s3.py index b1039460..abd4bca9 100644 --- a/features/steps/exporter_s3.py +++ b/features/steps/exporter_s3.py @@ -21,6 +21,7 @@ from src.minio import ( bucket_check, clean_bucket, + create_bucket, get_object_name, minio_client, read_object_into_buffer, @@ -111,8 +112,7 @@ def assert_s3_bucket_is_empty(context): @given("The S3 bucket is empty") def ensure_s3_bucket_is_empty(context): """Ensure that the bucket is empty.""" - bucket_check(context) - clean_bucket(context) + create_bucket(context) @then("The S3 bucket is empty")