Allow to use none auth in functional tests

This change will make possible adding a new functional job running
ironic in noauth mode, and accessing it with none auth plugin from
the tests. There was no decision if such job is needed, but still
seems to be a good thing to keep the code updated to correspond to
what is the intended way of working with noauth ironic.

Change-Id: I48cf37c87fdb74a3b38742a929698c9bd146d7d1
This commit is contained in:
Vladyslav Drok 2017-09-29 00:08:23 +02:00
parent 69f1bb8c01
commit 40a87d534f
2 changed files with 11 additions and 12 deletions

View File

@ -52,10 +52,8 @@ class FunctionalTestBase(base.ClientTestBase):
setattr(self, domain_attr, config[domain_attr])
else:
self.ironic_url = config['ironic_url']
self.os_auth_token = config['os_auth_token']
client = base.CLIClient(cli_dir=cli_dir,
ironic_url=self.ironic_url,
os_auth_token=self.os_auth_token)
ironic_url=self.ironic_url)
return client
def _get_config(self):
@ -86,7 +84,7 @@ class FunctionalTestBase(base.ClientTestBase):
'os_project_domain_id',
'os_identity_api_version']
else:
conf_settings += ['os_auth_token', 'ironic_url']
conf_settings += ['ironic_url']
cli_flags = {}
missing = []
@ -119,10 +117,9 @@ class FunctionalTestBase(base.ClientTestBase):
:param params: optional positional args to use
:type params: string
"""
flags = ('--os_auth_token %(token)s --ironic_url %(url)s %(flags)s'
flags = ('--os-endpoint %(url)s %(flags)s'
%
{'token': self.os_auth_token,
'url': self.ironic_url,
{'url': self.ironic_url,
'flags': flags})
return base.execute(cmd, action, flags, params,
cli_dir=self.client.cli_dir)
@ -144,12 +141,15 @@ class FunctionalTestBase(base.ClientTestBase):
"""
if cmd == 'openstack':
config = self._get_config()
id_api_version = config['os_identity_api_version']
flags += ' --os-identity-api-version {0}'.format(id_api_version)
id_api_version = config.get('os_identity_api_version')
if id_api_version:
flags += ' --os-identity-api-version {}'.format(id_api_version)
else:
flags += ' --os-endpoint-type publicURL'
if hasattr(self, 'os_auth_token'):
if hasattr(self, 'ironic_url'):
if cmd == 'openstack':
flags += ' --os-auth-type none'
return self._cmd_no_auth(cmd, action, flags, params)
else:
for keystone_object in 'user', 'project':

View File

@ -3,12 +3,11 @@
FUNC_TEST_DIR=$(dirname $0)/../ironicclient/tests/functional/
CONFIG_FILE=$FUNC_TEST_DIR/test.conf
if [[ -n "$OS_AUTH_TOKEN" ]] && [[ -n "$IRONIC_URL" ]]; then
if [[ -n "$IRONIC_URL" ]]; then
cat <<END >$CONFIG_FILE
[functional]
api_version = 1
auth_strategy=noauth
os_auth_token=$OS_AUTH_TOKEN
ironic_url=$IRONIC_URL
END
else