]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/multisite: add a create_bucket test with tenanted user 61433/head
authorShilpa Jagannath <smanjara@redhat.com>
Mon, 10 Feb 2025 19:14:40 +0000 (19:14 +0000)
committerShilpa Jagannath <smanjara@redhat.com>
Tue, 11 Feb 2025 20:22:28 +0000 (20:22 +0000)
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
qa/suites/rgw/multisite/tasks/test_multi.yaml
src/test/rgw/rgw_multi/tests.py

index a72ac028a4a6428caebb2ef5328f7f24de7bef00..422535db6099c0f6dfafaeed22a31a4e651e1ae7 100644 (file)
@@ -15,4 +15,3 @@ tasks:
 - rgw-multisite-tests:
     config:
       reconfigure_delay: 90
-      tenant: testx
index 433cd034fe0b5a7b090151ca79df9233e61924c2..90abd1f08e63b6207a53b116240d6d7d8ef267f9 100644 (file)
@@ -586,6 +586,50 @@ def test_bucket_create():
     for zone in zonegroup_conns.zones:
         assert check_all_buckets_exist(zone, buckets)
 
+def test_bucket_create_with_tenant():
+
+    ''' create a bucket from secondary zone under tenant namespace. check if it successfully syncs
+        under the same namespace'''
+
+    zonegroup = realm.master_zonegroup()
+    zonegroup_conns = ZonegroupConns(zonegroup)
+    primary = zonegroup_conns.rw_zones[0]
+    secondary = zonegroup_conns.rw_zones[1]
+
+    access_key = 'abcd'
+    secret_key = 'efgh'
+    tenant = 'testx'
+    uid = 'test'
+
+    tenant_secondary_conn = boto.s3.connection.S3Connection(aws_access_key_id=access_key,
+                                aws_secret_access_key=secret_key,
+                                is_secure=False,
+                                port=secondary.zone.gateways[0].port,
+                                host=secondary.zone.gateways[0].host,
+                                calling_format='boto.s3.connection.OrdinaryCallingFormat')
+
+    tenant_primary_conn = boto.s3.connection.S3Connection(aws_access_key_id=access_key,
+                                aws_secret_access_key=secret_key,
+                                is_secure=False,
+                                port=primary.zone.gateways[0].port,
+                                host=primary.zone.gateways[0].host,
+                                calling_format='boto.s3.connection.OrdinaryCallingFormat')
+
+    cmd = ['user', 'create', '--tenant', tenant, '--uid', uid, '--access-key', access_key, '--secret-key', secret_key, '--display-name', 'tenanted-user']
+    primary.zone.cluster.admin(cmd)
+    zonegroup_meta_checkpoint(zonegroup)
+    try:
+        bucket = tenant_secondary_conn.create_bucket('tenanted-bucket')
+        zonegroup_meta_checkpoint(zonegroup)
+        assert tenant_primary_conn.get_bucket(bucket.name)
+        log.info("bucket exists in tenant namespace")
+        e = assert_raises(boto.exception.S3ResponseError, primary.get_bucket, bucket.name)
+        assert e.error_code == 'NoSuchBucket'
+        log.info("bucket does not exist in default user namespace")
+    finally:
+        cmd = ['user', 'rm', '--tenant', tenant, '--uid', uid, '--purge-data']
+        primary.zone.cluster.admin(cmd)
+
 def test_bucket_recreate():
     zonegroup = realm.master_zonegroup()
     zonegroup_conns = ZonegroupConns(zonegroup)