diff --git a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_encrypted.yaml b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_encrypted.yaml new file mode 100644 index 000000000..d7c2d6347 --- /dev/null +++ b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_encrypted.yaml @@ -0,0 +1,17 @@ +# script: test_cloud_transition.py +# Polarion ID : CEPH-83575497 +config: + user_count: 1 + bucket_count: 1 + objects_count: 20 + encryption_keys: s3 + etag_verification: true + objects_size_range: + min: 5 + max: 15 + test_ops: + create_bucket: true + create_object: true + lc_id: cloud_transit + retain_head_object: false + enable_encryption: true diff --git a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_false.yaml b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_false.yaml index 79a24ec18..51348289c 100644 --- a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_false.yaml +++ b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_false.yaml @@ -1,4 +1,4 @@ -# script: test_cloud_transitions.py +# script:test_cloud_transition.py # Polarion ID : CEPH-83575278 config: user_count: 1 @@ -13,3 +13,4 @@ config: create_object: true lc_id: cloud_transit retain_head_object: false + enable_encryption: false diff --git a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_true.yaml b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_true.yaml index f27cd9a2c..6014b84fe 100644 --- a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_true.yaml +++ b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_headobject_true.yaml @@ -1,4 +1,4 @@ -# script: test_cloud_transitions.py +# script:test_cloud_transition.py # Polarion ID : CEPH-83575278 config: user_count: 1 @@ -13,3 +13,4 @@ config: create_object: true lc_id: cloud_transit retain_head_object: true + enable_encryption: false diff --git a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_multipart.yaml b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_multipart.yaml index 42eb5eeaa..bea85cd85 100644 --- a/rgw/v2/tests/s3_swift/configs/test_cloud_transition_multipart.yaml +++ b/rgw/v2/tests/s3_swift/configs/test_cloud_transition_multipart.yaml @@ -1,4 +1,4 @@ -# script: test_cloud_transitions.py +# script:test_cloud_transition.py # Polarion ID : CEPH-83575283 config: user_count: 1 @@ -14,3 +14,4 @@ config: upload_type: multipart lc_id: cloud_transit retain_head_object: false + enable_encryption: false diff --git a/rgw/v2/tests/s3_swift/test_cloud_transition.py b/rgw/v2/tests/s3_swift/test_cloud_transition.py index d6de19450..70434a95c 100644 --- a/rgw/v2/tests/s3_swift/test_cloud_transition.py +++ b/rgw/v2/tests/s3_swift/test_cloud_transition.py @@ -6,6 +6,10 @@ : configs/test_cloud_transitions.yaml + configs/test_cloud_transition_encrypted.yaml + configs/test_cloud_transition_headobject_false.yaml + configs/test_cloud_transition_headobject_true.yaml + configs/test_cloud_transition_multipart.yaml """ import os import sys @@ -27,6 +31,7 @@ from v2.lib.s3.write_io_info import BasicIOInfoStructure, IOInfoInitialize from v2.tests.s3_swift import reusable from v2.tests.s3_swift.reusables import lc_policy +from v2.tests.s3_swift.reusables import server_side_encryption_s3 as sse_s3 from v2.utils.log import configure_logging from v2.utils.test_desc import AddTestInfo from v2.utils.utils import HttpResponseParser, RGWService @@ -46,6 +51,7 @@ def test_exec(config, ssh_con): # authenticate auth = Auth(user_info, ssh_con, ssl=config.ssl) rgw_conn = auth.do_auth() + s3_client1 = auth.do_auth_using_client() log.info("Create buckets and objects in source cluster") if config.test_ops["create_bucket"] is True: @@ -54,11 +60,25 @@ def test_exec(config, ssh_con): bucket_name_to_create = utils.gen_bucket_name_from_userid( user_info["user_id"], rand_no=bc ) - log.info("creating bucket with name: %s" % bucket_name_to_create) + log.info(f"creating bucket with name: {bucket_name_to_create}") bucket = reusable.create_bucket(bucket_name_to_create, rgw_conn, user_info) + + if config.test_ops["enable_encryption"]: + # enable per bucket encryption on the bucket + log.info( + f"Encryption type is per-bucket, enable it on bucket : {bucket_name_to_create}" + ) + encryption_method = config.encryption_keys + sse_s3.put_bucket_encryption( + s3_client1, bucket_name_to_create, encryption_method + ) + # get bucket encryption + log.info(f"get bucket encryption for bucket : {bucket_name_to_create}") + sse_s3.get_bucket_encryption(s3_client1, bucket_name_to_create) + if config.test_ops["create_object"] is True: # uploading data - log.info("s3 objects to create: %s" % config.objects_count) + log.info(f"s3 objects to create: {config.objects_count}") config.mapped_sizes = utils.make_mapped_sizes(config) for oc, size in list(config.mapped_sizes.items()): config.obj_size = size