]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add tenant as parameter to User in multisite tests 27969/head
authorYuval Lifshitz <yuvalif@yahoo.com>
Sun, 5 May 2019 17:54:31 +0000 (20:54 +0300)
committerYuval Lifshitz <yuvalif@yahoo.com>
Tue, 7 May 2019 09:05:33 +0000 (12:05 +0300)
Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
src/test/rgw/rgw_multi/multisite.py
src/test/rgw/test_multi.py

index 78e8a6b56e8481616f8815acbd0ff1da22a95120..47afe052048a2b5de77d5015c9d0f5e8901172ec 100644 (file)
@@ -344,14 +344,18 @@ class Credentials:
         return ['--access-key', self.access_key, '--secret', self.secret]
 
 class User(SystemObject):
-    def __init__(self, uid, data = None, name = None, credentials = None):
+    def __init__(self, uid, data = None, name = None, credentials = None, tenant = None):
         self.name = name
         self.credentials = credentials or []
+        self.tenant = tenant
         super(User, self).__init__(data, uid)
 
     def user_arg(self):
         """ command-line argument to specify this user """
-        return ['--uid', self.id]
+        args = ['--uid', self.id]
+        if self.tenant:
+            args += ['--tenant', self.tenant]
+        return args
 
     def build_command(self, command):
         """ build a command line for the given command and args """
index ebfc5b505a1e5f926c24f270e3ed12b382baab26..980addf50a6da037d0e0cfe99b599530e90c2062 100644 (file)
@@ -232,7 +232,7 @@ def init(parse_args):
     admin_user = multisite.User('zone.user')
 
     user_creds = gen_credentials()
-    user = multisite.User('tester')
+    user = multisite.User('tester', tenant=args.tenant)
 
     realm = multisite.Realm('r')
     if bootstrap:
@@ -346,16 +346,12 @@ def init(parse_args):
                     # create test user
                     arg = ['--display-name', '"Test User"']
                     arg += user_creds.credential_args()
-                    if args.tenant:
-                        arg += ['--tenant', args.tenant]
                     user.create(zone, arg)
                 else:
                     # read users and update keys
                     admin_user.info(zone)
                     admin_creds = admin_user.credentials[0]
                     arg = []
-                    if args.tenant:
-                        arg += ['--tenant', args.tenant]
                     user.info(zone, arg)
                     user_creds = user.credentials[0]