Skip to content

Commit

Permalink
test activitylogs table for unneccessary logs when in default log level
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
mashetty330 committed Apr 24, 2024
1 parent 520831e commit 8e70dbd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/functional/object/mcg/test_write_to_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
acceptance,
performance,
)
from ocs_ci.utility.utils import exec_nb_db_query
from ocs_ci.ocs import constants
from ocs_ci.ocs.bucket_utils import (
sync_object_directory,
retrieve_test_objects_to_pod,
craft_s3_command,
s3_put_object,
s3_head_object,
rm_object_recursive,
)

from ocs_ci.framework.pytest_customization.marks import (
skipif_managed_service,
bugzilla,
Expand Down Expand Up @@ -456,3 +459,42 @@ def test_content_encoding_with_write(
logger.info(
"Put object operation is preserving ContentEncoding as a object metadata"
)

@bugzilla("2259189")
@bugzilla("2264480")
@pytest.mark.polarion_id("OCS-5773")
def test_nb_db_activity_logs_on_io(
self, bucket_factory, awscli_pod_session, mcg_obj
):

"""
This test checks if the activity logs are being logged
in the activitylogs table for every object upload and
deletion when noobaa log is set to default
"""

bucket = bucket_factory()[0]
full_objectpath = f"s3://{bucket.name}"
logger.info("successfully created bucket")

sync_object_directory(
awscli_pod_session, AWSCLI_TEST_OBJ_DIR, full_objectpath, mcg_obj
)
logger.info("uploaded objects to the bucket")

rm_object_recursive(awscli_pod_session, bucket.name, mcg_obj)
logger.info("deleted all the objects from the bucket")

nb_activitylogs = exec_nb_db_query("SELECT data ->> 'event' FROM activitylogs;")
logger.info("successfully fetched noobaa db activitylogs data")

assert "obj.uploaded" not in str(
nb_activitylogs
), "Object upload event is being logged in activitylogs table"
assert "obj.deleted" not in str(
nb_activitylogs
), "Object deletion event is being logged in activitylogs table"
logger.info(
"No object upload/deletion info is being updated in the activitylogs table"
)

0 comments on commit 8e70dbd

Please sign in to comment.