Add a service catalog override to the functional tests

This allows us to run the functional tests against environments than
what's in the service catalog.

note: ideally, this would allow us to run against a Designate in
noauth mode. And it does, however there's not a way to pass in the
X-Auth-Project-ID header, so the tests will always use the
noauth-project (tests involving multiple users like, zone transfer
tests, won't work).

Change-Id: If9306b27d78d7c774911d3c1abb46bfbf72539f1
This commit is contained in:
Paul Glass 2016-02-24 20:20:47 +00:00
parent e9e6ab9e89
commit 38e9fa8505
2 changed files with 27 additions and 1 deletions

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
import logging
import os
from tempest_lib.cli import base
@ -269,6 +270,10 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands,
resp = FieldValueModel(self.keystone('token-get'))
self.project_id = resp.tenant_id
@property
def using_auth_override(self):
return bool(cfg.CONF.identity.override_endpoint)
@classmethod
def get_clients(cls):
if not cls._CLIENTS:
@ -309,8 +314,24 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands,
raise Exception("User '{0}' does not exist".format(user))
def parsed_cmd(self, cmd, model=None, *args, **kwargs):
out = self.openstack(cmd, *args, **kwargs)
if self.using_auth_override:
# use --os-url and --os-token
func = self._openstack_noauth
else:
# use --os-username --os-tenant-name --os-password --os-auth-url
func = self.openstack
out = func(cmd, *args, **kwargs)
LOG.debug(out)
if model is not None:
return model(out)
return out
def _openstack_noauth(self, cmd, *args, **kwargs):
exe = os.path.join(cfg.CONF.designateclient.directory, 'openstack')
options = build_option_string({
'--os-url': cfg.CONF.identity.override_endpoint,
'--os-token': cfg.CONF.identity.override_token,
})
cmd = options + " " + cmd
return base.execute(exe, cmd, *args, **kwargs)

View File

@ -46,6 +46,11 @@ cfg.CONF.register_opts([
cfg.StrOpt('admin_tenant_name'),
cfg.StrOpt('admin_password', secret=True),
cfg.StrOpt('admin_domain_name'),
cfg.StrOpt("override_endpoint",
help="use this url instead of the url in the service catalog"),
cfg.StrOpt("override_token",
help="with the override endpoint, pass this token to the api"),
], group='identity')