From c29beb69a9ed679a397adcb2a332c12863485ed4 Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Thu, 6 Oct 2022 11:31:47 +0400 Subject: [PATCH] [#266] Upgrade test to S3 bucket removal Signed-off-by: Yulia Kovshova --- .../testsuites/services/s3_gate/test_s3_gate.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pytest_tests/testsuites/services/s3_gate/test_s3_gate.py b/pytest_tests/testsuites/services/s3_gate/test_s3_gate.py index 5752c348..69c543cc 100644 --- a/pytest_tests/testsuites/services/s3_gate/test_s3_gate.py +++ b/pytest_tests/testsuites/services/s3_gate/test_s3_gate.py @@ -74,7 +74,8 @@ class TestS3Gate(TestS3GateBase): file_name = self.object_key_from_file_path(file_path) with allure.step("Create buckets"): - bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client) + bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, True) + set_bucket_versioning(self.s3_client, bucket_1, s3_gate_bucket.VersioningStatus.ENABLED) bucket_2 = s3_gate_bucket.create_bucket_s3(self.s3_client) with allure.step("Check buckets are presented in the system"): @@ -102,7 +103,7 @@ class TestS3Gate(TestS3GateBase): s3_gate_bucket.head_bucket(self.s3_client, bucket_2) with allure.step("Check we can put/list object with S3 commands"): - s3_gate_object.put_object_s3(self.s3_client, bucket_1, file_path) + version_id = s3_gate_object.put_object_s3(self.s3_client, bucket_1, file_path) s3_gate_object.head_object_s3(self.s3_client, bucket_1, file_name) bucket_objects = s3_gate_object.list_objects_s3(self.s3_client, bucket_1) @@ -128,6 +129,18 @@ class TestS3Gate(TestS3GateBase): assert bucket_1 in buckets, f"Expected bucket {bucket_1} is in the list" assert bucket_2 not in buckets, f"Expected bucket {bucket_2} is not in the list" + with allure.step(f"Delete object from {bucket_1}"): + s3_gate_object.delete_object_s3(self.s3_client, bucket_1, file_name, version_id) + check_objects_in_bucket(self.s3_client, bucket_1, expected_objects=[]) + + with allure.step(f"Delete bucket {bucket_1}"): + s3_gate_bucket.delete_bucket_s3(self.s3_client, bucket_1) + tick_epoch() + + with allure.step(f"Check bucket {bucket_1} deleted"): + with pytest.raises(Exception, match=r".*Not Found.*"): + s3_gate_bucket.head_bucket(self.s3_client, bucket_1) + @allure.title("Test S3 Object API") @pytest.mark.sanity @pytest.mark.parametrize(