Skip to content

Commit

Permalink
Incorporated review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Parag Kamble <pakamble@redhat.com>
  • Loading branch information
paraggit committed May 22, 2024
1 parent a8c0158 commit cf30097
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions ocs_ci/helpers/keyrotation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,19 @@ def enable_keyrotation(self):
self.storagecluster_obj.patch(
params=param, format_type="merge", resource_name=self.cluster_name
)
self.storagecluster_obj.wait_for_resource(
resource_status = self.storagecluster_obj.wait_for_resource(
constants.STATUS_READY,
self.storagecluster_obj.resource_name,
column="PHASE",
timeout=180,
)

if not resource_status:
log.info(
f"StorageCluster resource is not reach to state {constants.STATUS_READY}"
)
return False

self.storagecluster_obj.reload_data()
log.info("Keyrotation is enabled in storegeclujster object.")
return True
Expand All @@ -123,12 +130,19 @@ def disable_keyrotation(self):

param = '[{"op":"replace","path":"/spec/encryption/keyRotation/enable","value":False}]'
self.storagecluster_obj.patch(params=param, format_type="json")
self.storagecluster_obj.wait_for_resource(
resource_status = self.storagecluster_obj.wait_for_resource(
constants.STATUS_READY,
self.storagecluster_obj.resource_name,
column="PHASE",
timeout=180,
)

if not resource_status:
log.info(
f"StorageCluster resource is not reach to state {constants.STATUS_READY}"
)
return False

self.storagecluster_obj.reload_data()
log.info("Keyrotation is Disabled in storagecluster object.")
return True
Expand Down Expand Up @@ -199,7 +213,7 @@ def get_noobaa_backend_secret(self):
Retrieves the backend secret for Noobaa.
Returns:
str, str: A tuple containing the Noobaa backend root key and secret.
tuple (str, str): containing the Noobaa backend root key and secret.
Raises:
ValueError: If failed to retrieve the backend secret.
Expand All @@ -219,7 +233,7 @@ def get_noobaa_volume_secret(self):
Retrieves the volume secret for Noobaa.
Returns:
str, str: A tuple containing the Noobaa volume root key and secret.
tuple (str, str): containing the Noobaa volume root key and secret.
Raises:
ValueError: If failed to retrieve the volume secret.
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/encryption/test_encryption_keyrotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def finalizer():

request.addfinalizer(finalizer)

@pytest.mark.polarion_id("OCS-5790")
def test_osd_keyrotation(self):
"""
Test to verify the key rotation of the OSD
Expand Down Expand Up @@ -123,6 +124,7 @@ def compare_old_with_new_keys():
log.info("Changing the keyrotation value to default.")
osd_keyrotation.set_keyrotation_schedule("@weekly")

@pytest.mark.polarion_id("OCS-5791")
def test_noobaa_keyrotation(self):
"""
Test to verify the keyrotation for noobaa.
Expand Down

0 comments on commit cf30097

Please sign in to comment.