]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/multisite-notification: allow enabling v1/v2 in tests
authorYuval Lifshitz <ylifshit@redhat.com>
Thu, 28 Dec 2023 12:05:09 +0000 (12:05 +0000)
committerCasey Bodley <cbodley@redhat.com>
Wed, 10 Apr 2024 13:18:06 +0000 (09:18 -0400)
v1 could be enabled only in local tests. teuthology tests would run with v2

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
(cherry picked from commit d2db9df224659cf711aee80479b5d462ff3ca716)

qa/tasks/notification_tests.py
src/test/rgw/bucket_notification/README.rst
src/test/rgw/bucket_notification/__init__.py
src/test/rgw/bucket_notification/bntests.conf.SAMPLE

index 86e95dfb5f295bb54e69e95a3099a97dbadb4f2f..129937cee456fe7d98b5f66b7e2762f9f133ec49 100644 (file)
@@ -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':{}
             }
index db34545e1d539552f985ec2262c64c43b00f5f10..050a2e380c2947adbc0f9bcbb05af1be2493ba69 100644 (file)
@@ -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
index 5d8fac8e215c485516505e457384d64cc78c7fe6..222af7489f30fee9d25fce6896fc961d6195ae1c 100644 (file)
@@ -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")
index 998fcd1ef842e0539002beddd166dd74c335f4e9..2ab614c5a3e721606ad0f735567aa7a9db735c8c 100644 (file)
@@ -3,6 +3,7 @@ port = 8000
 host = localhost
 zonegroup = default
 cluster = noname
+version = v2
 
 [s3 main]
 access_key = 0555b35654ad1656d804