From a48dd1950d2999cb7fdc2856a827da4780715b1e Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Mon, 5 Aug 2019 14:48:54 -0700 Subject: [PATCH] Allow non-default domain to be used in func tests Change-Id: I7afa7e367103bb9caaf74788a49cd055eca53cf6 --- test/functional/__init__.py | 10 ++++++++++ test/functional/swift_test_client.py | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/functional/__init__.py b/test/functional/__init__.py index b2f66aa787..4307b11578 100644 --- a/test/functional/__init__.py +++ b/test/functional/__init__.py @@ -918,12 +918,18 @@ def setup_package(): swift_test_user[0] = config['username'] swift_test_tenant[0] = config['account'] swift_test_key[0] = config['password'] + if 'domain' in config: + swift_test_domain[0] = config['domain'] swift_test_user[1] = config['username2'] swift_test_tenant[1] = config['account2'] swift_test_key[1] = config['password2'] + if 'domain2' in config: + swift_test_domain[1] = config['domain2'] swift_test_user[2] = config['username3'] swift_test_tenant[2] = config['account'] swift_test_key[2] = config['password3'] + if 'domain3' in config: + swift_test_domain[2] = config['domain3'] if 'username4' in config: swift_test_user[3] = config['username4'] swift_test_tenant[3] = config['account4'] @@ -933,10 +939,14 @@ def setup_package(): swift_test_user[4] = config['username5'] swift_test_tenant[4] = config['account5'] swift_test_key[4] = config['password5'] + if 'domain5' in config: + swift_test_domain[4] = config['domain5'] if 'username6' in config: swift_test_user[5] = config['username6'] swift_test_tenant[5] = config['account6'] swift_test_key[5] = config['password6'] + if 'domain6' in config: + swift_test_domain[5] = config['domain6'] for _ in range(5): swift_test_perm[_] = swift_test_tenant[_] + ':' \ diff --git a/test/functional/swift_test_client.py b/test/functional/swift_test_client.py index b275ed0599..abe136eddf 100644 --- a/test/functional/swift_test_client.py +++ b/test/functional/swift_test_client.py @@ -208,6 +208,7 @@ class Connection(object): self.insecure = config_true_value(config.get('insecure', 'false')) self.auth_version = str(config.get('auth_version', '1')) + self.domain = config.get('domain') self.account = config.get('account') self.username = config['username'] self.password = config['password'] @@ -269,8 +270,13 @@ class Connection(object): else: requests.packages.urllib3.disable_warnings( InsecureRequestWarning) + if self.domain: + os_opts = {'project_domain_name': self.domain, + 'user_domain_name': self.domain} + else: + os_opts = {} authargs = dict(snet=False, tenant_name=self.account, - auth_version=self.auth_version, os_options={}, + auth_version=self.auth_version, os_options=os_opts, insecure=self.insecure) (storage_url, storage_token) = get_auth( self.auth_url, auth_user, self.password, **authargs)