From 062675bce52bf95c2691df3bb303d948700dd26f Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Thu, 28 Dec 2023 12:05:09 +0000 Subject: [PATCH] rgw/multisite-notification: allow enabling v1/v2 in tests v1 could be enabled only in local tests. teuthology tests would run with v2 Signed-off-by: Yuval Lifshitz (cherry picked from commit d2db9df224659cf711aee80479b5d462ff3ca716) --- qa/tasks/notification_tests.py | 3 ++- src/test/rgw/bucket_notification/README.rst | 6 ++++-- src/test/rgw/bucket_notification/__init__.py | 12 ++++++++++++ src/test/rgw/bucket_notification/bntests.conf.SAMPLE | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qa/tasks/notification_tests.py b/qa/tasks/notification_tests.py index 86e95dfb5f295..129937cee456f 100644 --- a/qa/tasks/notification_tests.py +++ b/qa/tasks/notification_tests.py @@ -299,7 +299,8 @@ def task(ctx,config): 'port':endpoint.port, 'host':endpoint.dns_name, 'zonegroup':'default', - 'cluster':'noname' + 'cluster':'noname', + 'version':'v2' }, 's3 main':{} } diff --git a/src/test/rgw/bucket_notification/README.rst b/src/test/rgw/bucket_notification/README.rst index db34545e1d539..050a2e380c294 100644 --- a/src/test/rgw/bucket_notification/README.rst +++ b/src/test/rgw/bucket_notification/README.rst @@ -9,8 +9,9 @@ with the `vstart.sh` script. For the tests covering Kafka and RabbitMQ security, the RGW will need to accept use/password without TLS connection between the client and the RGW. So, the cluster will have to be started with the following ``rgw_allow_notification_secrets_in_cleartext`` parameter set to ``true``. -The test suite can be run against a multisite setup, in the configuration file we will have to decide which RGW and which cluster will be used for the test. -For example, if the ``test-rgw-multisite.sh`` script is used to setup multisite, and we want to run the test agianst the first RGW in the first cluster, +The test suite can be run against a multisite setup, in the configuration file we will have to decide which RGW and which cluster will be used for the test, +and using which version (v1 or v2) of topics/notifications we should use. By default, a new cluster would use v2, which means that if a realm was never defined, v1 cannot be used. +For example, if the ``test-rgw-multisite.sh`` script is used to setup multisite, and we want to test v1 against the first RGW in the first cluster, we would need the following configuration file:: [DEFAULT] @@ -18,6 +19,7 @@ we would need the following configuration file:: host = localhost zonegroup = zg1 cluster = c1 + version = v1 [s3 main] access_key = 1234567890 diff --git a/src/test/rgw/bucket_notification/__init__.py b/src/test/rgw/bucket_notification/__init__.py index 5d8fac8e215c4..222af7489f30f 100644 --- a/src/test/rgw/bucket_notification/__init__.py +++ b/src/test/rgw/bucket_notification/__init__.py @@ -1,5 +1,6 @@ import configparser import os +from .api import admin def setup(): cfg = configparser.RawConfigParser() @@ -30,6 +31,17 @@ def setup(): global default_cluster default_cluster = defaults.get("cluster") + + version = defaults.get("version") + if version == "v1": + _, result = admin(['zonegroup', 'modify', '--disable-feature=notification_v2'], default_cluster) + if result != 0: + raise RuntimeError('Failed to disable v2 notifications feature. error: '+str(result)) + _, result = admin(['period', 'update', '--commit'], default_cluster) + if result != 0: + raise RuntimeError('Failed to commit changes to period. error: '+str(result)) + elif version != "v2": + raise RuntimeError('Invalid notification version: '+version) global main_access_key main_access_key = cfg.get('s3 main',"access_key") diff --git a/src/test/rgw/bucket_notification/bntests.conf.SAMPLE b/src/test/rgw/bucket_notification/bntests.conf.SAMPLE index 998fcd1ef842e..2ab614c5a3e72 100644 --- a/src/test/rgw/bucket_notification/bntests.conf.SAMPLE +++ b/src/test/rgw/bucket_notification/bntests.conf.SAMPLE @@ -3,6 +3,7 @@ port = 8000 host = localhost zonegroup = default cluster = noname +version = v2 [s3 main] access_key = 0555b35654ad1656d804 -- 2.39.5