Skip to content

Commit d9b0e78

Browse files
author
Shilpa Jagannath
committed
qa/multisite: add a create_bucket test with tenanted user
Signed-off-by: Shilpa Jagannath <[email protected]>
1 parent da3545d commit d9b0e78

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

qa/suites/rgw/multisite/tasks/test_multi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ tasks:
1515
- rgw-multisite-tests:
1616
config:
1717
reconfigure_delay: 90
18-
tenant: testx

src/test/rgw/rgw_multi/tests.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,50 @@ def test_bucket_create():
586586
for zone in zonegroup_conns.zones:
587587
assert check_all_buckets_exist(zone, buckets)
588588

589+
def test_bucket_create_with_tenant():
590+
591+
''' create a bucket from secondary zone under tenant namespace. check if it successfully syncs
592+
under the same namespace'''
593+
594+
zonegroup = realm.master_zonegroup()
595+
zonegroup_conns = ZonegroupConns(zonegroup)
596+
primary = zonegroup_conns.rw_zones[0]
597+
secondary = zonegroup_conns.rw_zones[1]
598+
599+
access_key = 'abcd'
600+
secret_key = 'efgh'
601+
tenant = 'testx'
602+
uid = 'test'
603+
604+
tenant_secondary_conn = boto.s3.connection.S3Connection(aws_access_key_id=access_key,
605+
aws_secret_access_key=secret_key,
606+
is_secure=False,
607+
port=secondary.zone.gateways[0].port,
608+
host=secondary.zone.gateways[0].host,
609+
calling_format='boto.s3.connection.OrdinaryCallingFormat')
610+
611+
tenant_primary_conn = boto.s3.connection.S3Connection(aws_access_key_id=access_key,
612+
aws_secret_access_key=secret_key,
613+
is_secure=False,
614+
port=primary.zone.gateways[0].port,
615+
host=primary.zone.gateways[0].host,
616+
calling_format='boto.s3.connection.OrdinaryCallingFormat')
617+
618+
cmd = ['user', 'create', '--tenant', tenant, '--uid', uid, '--access-key', access_key, '--secret-key', secret_key, '--display-name', 'tenanted-user']
619+
primary.zone.cluster.admin(cmd)
620+
zonegroup_meta_checkpoint(zonegroup)
621+
try:
622+
bucket = tenant_secondary_conn.create_bucket('tenanted-bucket')
623+
zonegroup_meta_checkpoint(zonegroup)
624+
assert tenant_primary_conn.get_bucket(bucket.name)
625+
log.info("bucket exists in tenant namespace")
626+
e = assert_raises(boto.exception.S3ResponseError, primary.get_bucket, bucket.name)
627+
assert e.error_code == 'NoSuchBucket'
628+
log.info("bucket does not exist in default user namespace")
629+
finally:
630+
cmd = ['user', 'rm', '--tenant', tenant, '--uid', uid, '--purge-data']
631+
primary.zone.cluster.admin(cmd)
632+
589633
def test_bucket_recreate():
590634
zonegroup = realm.master_zonegroup()
591635
zonegroup_conns = ZonegroupConns(zonegroup)

0 commit comments

Comments
 (0)