Skip to content

Commit

Permalink
Merge pull request #614 from viduship/vim-archive-notification-sync
Browse files Browse the repository at this point in the history
Adding bucket notification for archive zone for ObjectSync events
  • Loading branch information
mergify[bot] authored Jul 18, 2024
2 parents 040ec84 + 07eff6d commit 0f50d57
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# test case CEPH-83575922
# script test_bucket_notifications.py
config:
user_count: 1
bucket_count: 1
objects_count: 10
objects_size_range:
min: 5
max: 15
test_ops:
create_bucket: true
create_object: true
enable_version: false
test_delete_object_sync_archive: true
create_topic: true
get_topic_info: true
endpoint: kafka
ack_type: broker
put_get_bucket_notification: true
event_type:
- MultisiteReplication
upload_type: normal
delete_bucket_object: false
sync_source_zone_master: True
22 changes: 16 additions & 6 deletions rgw/v2/tests/s3_swift/reusables/bucket_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,17 @@ def get_bucket_notification(rgw_s3_client, bucketname, empty=False):
)


def verify_event_record(event_type, bucket, event_record_path, ceph_version):
def verify_event_record(
event_type, bucket, event_record_path, ceph_version, config=None
):
"""
verify event records
"""
if os.path.getsize(event_record_path) == 0:
raise EventRecordDataError("event record not generated! File is empty")
if config and config.test_ops.get("test_delete_object_sync_archive", False):
log.info("event record not generated! File is empty, excpected behavior")
else:
raise EventRecordDataError("event record not generated! File is empty")

# verify event record for a particular event type
notifications_received = False
Expand Down Expand Up @@ -367,11 +372,16 @@ def verify_event_record(event_type, bucket, event_record_path, ceph_version):
log.info(f"awsRegion: {awsRegion}")
else:
raise EventRecordDataError("awsRegion not in event record")

if notifications_received is False:
raise EventRecordDataError(
f"Notifications not received for event type {event_type}"
)
if config.test_ops.get("test_delete_object_sync_archive", False):
log.info("Deletion event does not occur in archive zone")
log.info(
"Notifications not received for event type {event_type}, expected behavior with archive zone"
)
else:
raise EventRecordDataError(
f"Notifications not received for event type {event_type}"
)


class NotificationService:
Expand Down
8 changes: 7 additions & 1 deletion rgw/v2/tests/s3_swift/test_bucket_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
test_bucket_notification_kafka_broker_persistent_dynamic_reshard.yaml
test_bucket_notification_kafka_broker_persistent_manual_reshard.yaml
test_sse_s3_per_bucket_with_notifications_dynamic_reshard.yaml
multisite_configs/test_bucket_notification_kafka_broker_archive_delete_replication_from_pri.yaml
Operation:
create user (tenant/non-tenant)
Create topic and get topic
Expand Down Expand Up @@ -306,7 +307,10 @@ def test_exec(config, ssh_con):
)
if status is None:
raise TestExecError("copy object failed")

# delete objects
if config.test_ops.get("test_delete_object_sync_archive", False):
bucket_resource = other_site_bucket
reusable.delete_objects(bucket_resource)
# delete objects
if config.test_ops.get("delete_bucket_object", False):
if config.test_ops.get("enable_version", False):
Expand Down Expand Up @@ -343,7 +347,9 @@ def test_exec(config, ssh_con):
bucket_name_for_verification,
event_record_path,
ceph_version_name,
config,
)

if verify is False:
raise EventRecordDataError(
"Event record is empty! notification is not seen"
Expand Down

0 comments on commit 0f50d57

Please sign in to comment.