Skip to content

Commit

Permalink
Address review comment + minor semantics
Browse files Browse the repository at this point in the history
Signed-off-by: Sagi Hirshfeld <[email protected]>
  • Loading branch information
sagihirshfeld committed Oct 13, 2024
1 parent 68cead7 commit 19cea6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ocs_ci/ocs/resources/bucket_logging_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def enable_bucket_logging_on_cr(self, logs_pvc=None):
format_type="json",
)
except CommandFailed as e:
if "already exists" in str(e):
if "already exists" in str(e).lower():
patch_params[0]["op"] = "replace"
self.nb_config_resource.patch(
params=json.dumps(patch_params),
Expand Down Expand Up @@ -116,7 +116,6 @@ def disable_bucket_logging_on_cr(self):
"""
Unset the guaranteed bucket logs feature
"""

logger.info("Disabling guaranteed bucket logs")

try:
Expand Down Expand Up @@ -469,14 +468,17 @@ def verify_logs_integrity(self, logs, expected_ops, check_intent=False):
for op, obj in expected_ops:
success_code = "200" if op != "DELETE" else "204"
expected_ops_set.add(f"{op}-{obj}-{success_code}")

# The http_status field is 102 for intent logs
if check_intent:
for op, obj in expected_ops:
expected_ops_set.append(f"{op}-{obj}-102")

# Parse the logs into a set of strings with the same format
logs_set = {
f"{log['op']}-{log['object_key']}-{log['http_status']}" for log in logs
}

# Use set comparison to check if all expected operations are present
return expected_ops_set.issubset(logs_set)

def _parse_log_file_str(self, log_file_str):
Expand Down
1 change: 0 additions & 1 deletion tests/functional/object/mcg/test_bucket_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def test_guaranteed_bucket_logs_management(
11. Wait for the nb pods to restart without the mounts
12. Validate the logs PVC hasn't been deleted
"""

logs_manager = BucketLoggingManager(mcg_obj_session, awscli_pod_session)

provided_logs_pvc = None
Expand Down

0 comments on commit 19cea6f

Please sign in to comment.