Update fixtures to be properly reflected in the allure report #84

Merged
abereziny merged 1 commit from abereziny/frostfs-testcases:feature-correct-bucket-fixture into master 2023-08-29 18:28:40 +00:00
2 changed files with 13 additions and 9 deletions

View file

@ -187,15 +187,19 @@ def s3_client(
yield client yield client
@pytest.fixture
def versioning_status(request: pytest.FixtureRequest) -> VersioningStatus:
if "param" in request.__dict__:
return request.param
return VersioningStatus.UNDEFINED
@allure.step("Create/delete bucket") @allure.step("Create/delete bucket")
@pytest.fixture @pytest.fixture
def bucket(s3_client: S3ClientWrapper, request: pytest.FixtureRequest): def bucket(s3_client: S3ClientWrapper, versioning_status: VersioningStatus):
bucket_name = s3_client.create_bucket() bucket_name = s3_client.create_bucket()
versioning_status: Optional[VersioningStatus] = None
if "param" in request.__dict__:
versioning_status = request.param
if versioning_status: if versioning_status:
s3_helper.set_bucket_versioning(s3_client, bucket_name, versioning_status) s3_helper.set_bucket_versioning(s3_client, bucket_name, versioning_status)

View file

@ -24,7 +24,7 @@ class TestS3GateMultipart(ClusterTestBase):
) )
@allure.title("{s3_client}: Object Multipart API") @allure.title("{s3_client}: Object Multipart API")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str): def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str):
parts_count = 5 parts_count = 5
file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part
@ -58,8 +58,8 @@ class TestS3GateMultipart(ClusterTestBase):
got_object = s3_client.get_object(bucket, object_key) got_object = s3_client.get_object(bucket, object_key)
assert get_file_hash(got_object) == get_file_hash(file_name_large) assert get_file_hash(got_object) == get_file_hash(file_name_large)
@allure.title("{s3_client}: Multipart abort with") @allure.title("{s3_client}: Abort Multipart Upload")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_abort_multipart( def test_s3_abort_multipart(
self, self,
s3_client: S3ClientWrapper, s3_client: S3ClientWrapper,
@ -114,7 +114,7 @@ class TestS3GateMultipart(ClusterTestBase):
assert len(objects) == 0, f"Expected no objects in container, got\n{objects}" assert len(objects) == 0, f"Expected no objects in container, got\n{objects}"
@allure.title("{s3_client}: Upload Part Copy") @allure.title("{s3_client}: Upload Part Copy")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_multipart_copy(self, s3_client: S3ClientWrapper, bucket: str): def test_s3_multipart_copy(self, s3_client: S3ClientWrapper, bucket: str):
parts_count = 3 parts_count = 3
file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part