integrate with tempest sanity check
currently this plugin will not work with tempest sanity check. This will fix that by ensuring tempest run -l will run without being pointed at tempest.conf and tempest.log Change-Id: I2215c2cc0e6922b4935a6b44c2e415ff6fb2b610
This commit is contained in:
parent
ad8e669f22
commit
a14ad5d3eb
3
pylintrc
3
pylintrc
@ -65,7 +65,8 @@ disable=protected-access,fixme,too-many-branches,
|
|||||||
# Crashes, see #743.
|
# Crashes, see #743.
|
||||||
redefined-variable-type,
|
redefined-variable-type,
|
||||||
# bug in 1.7.2 https://github.com/PyCQA/pylint/issues/1493
|
# bug in 1.7.2 https://github.com/PyCQA/pylint/issues/1493
|
||||||
not-callable
|
not-callable,
|
||||||
|
C0411
|
||||||
|
|
||||||
|
|
||||||
[REPORTS]
|
[REPORTS]
|
||||||
|
@ -21,12 +21,12 @@ from tempest.lib.common.utils import data_utils
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
identity_url = CONF.identity.uri_v3.strip('/v3')
|
|
||||||
|
|
||||||
|
|
||||||
def rand_region_status(exclude=[]):
|
def rand_region_status(exclude=None):
|
||||||
|
exclusion = exclude or []
|
||||||
statuses = {'functional', 'maintenance', 'down', 'building'}.difference(
|
statuses = {'functional', 'maintenance', 'down', 'building'}.difference(
|
||||||
exclude)
|
exclusion)
|
||||||
return random.choice(list(statuses))
|
return random.choice(list(statuses))
|
||||||
|
|
||||||
|
|
||||||
@ -37,13 +37,16 @@ def rand_region_metadata():
|
|||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
||||||
def rand_region(id=None):
|
def rand_region(data_id=None):
|
||||||
if id is None:
|
_id = data_id or data_utils.rand_name()
|
||||||
id = data_utils.rand_name()
|
|
||||||
|
identity_url = CONF.identity.uri_v3 or ""
|
||||||
|
identity_url = identity_url.strip('/v3')
|
||||||
|
|
||||||
region_dict = {
|
region_dict = {
|
||||||
'status': rand_region_status(),
|
'status': rand_region_status(),
|
||||||
'id': id,
|
'id': _id,
|
||||||
'name': id,
|
'name': _id,
|
||||||
'designType': data_utils.arbitrary_string(),
|
'designType': data_utils.arbitrary_string(),
|
||||||
'locationType': data_utils.arbitrary_string(),
|
'locationType': data_utils.arbitrary_string(),
|
||||||
'vlcpName': data_utils.arbitrary_string(),
|
'vlcpName': data_utils.arbitrary_string(),
|
||||||
@ -76,12 +79,11 @@ def rand_region(id=None):
|
|||||||
return region_dict
|
return region_dict
|
||||||
|
|
||||||
|
|
||||||
def rand_region_group(region_ids, id=None):
|
def rand_region_group(region_ids, data_id=None):
|
||||||
if id is None:
|
_id = data_id or data_utils.rand_name()
|
||||||
id = data_utils.rand_name()
|
|
||||||
group_dict = {
|
group_dict = {
|
||||||
'name': id,
|
'name': _id,
|
||||||
'id': id,
|
'id': _id,
|
||||||
'description': data_utils.arbitrary_string(),
|
'description': data_utils.arbitrary_string(),
|
||||||
'regions': region_ids
|
'regions': region_ids
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,15 @@ class RangerClientBase(rest_client.RestClient):
|
|||||||
|
|
||||||
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
||||||
auth_region = CONF.identity.region
|
auth_region = CONF.identity.region
|
||||||
|
|
||||||
timeout = 10
|
timeout = 10
|
||||||
|
|
||||||
# def get_keystone_ep(rms_url, region_name):
|
# def get_keystone_ep(rms_url, region_name):
|
||||||
def get_keystone_ep(self):
|
def get_keystone_ep(self):
|
||||||
"""Get the Keystone EP from tempest conf.
|
"""Get the Keystone EP from tempest conf."""
|
||||||
"""
|
identity_url = CONF.identity.uri_v3 or ""
|
||||||
return CONF.identity.uri_v3.strip('/v3')
|
identity_url = identity_url.strip('/v3')
|
||||||
|
return identity_url
|
||||||
|
|
||||||
def get_token(self, timeout, host):
|
def get_token(self, timeout, host):
|
||||||
headers = {
|
headers = {
|
||||||
@ -87,12 +89,12 @@ class RangerClientBase(rest_client.RestClient):
|
|||||||
'Failed in get_token, host: {}, region: {}'.format(host,
|
'Failed in get_token, host: {}, region: {}'.format(host,
|
||||||
region))
|
region))
|
||||||
|
|
||||||
url = url % (keystone_ep,)
|
url = url % (keystone_ep)
|
||||||
data = data % (CONF.auth.admin_domain_name,
|
data = data % (CONF.auth.admin_domain_name,
|
||||||
CONF.auth.admin_username,
|
CONF.auth.admin_username,
|
||||||
CONF.auth.admin_password,
|
CONF.auth.admin_password,
|
||||||
CONF.auth.admin_project_name,
|
CONF.auth.admin_project_name,
|
||||||
CONF.auth.admin_domain_name,)
|
CONF.auth.admin_domain_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = requests.post(url,
|
resp = requests.post(url,
|
||||||
@ -105,10 +107,10 @@ class RangerClientBase(rest_client.RestClient):
|
|||||||
resp.status_code))
|
resp.status_code))
|
||||||
return resp.headers['x-subject-token']
|
return resp.headers['x-subject-token']
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as ex:
|
||||||
raise ConnectionError(e.message)
|
raise ConnectionError(ex.message)
|
||||||
|
|
||||||
def get_headers(self):
|
def get_headers(self, accept_type=None, send_type=None):
|
||||||
headers = {'X-Auth-Region': CONF.identity.region,
|
headers = {'X-Auth-Region': CONF.identity.region,
|
||||||
'X-Auth-Token': self.get_token(self.timeout, self.rms_url),
|
'X-Auth-Token': self.get_token(self.timeout, self.rms_url),
|
||||||
'X-RANGER-Tracking-Id': 'test',
|
'X-RANGER-Tracking-Id': 'test',
|
||||||
@ -154,7 +156,8 @@ class RangerClientBase(rest_client.RestClient):
|
|||||||
class RangerAuthProvider(auth.KeystoneV3AuthProvider):
|
class RangerAuthProvider(auth.KeystoneV3AuthProvider):
|
||||||
|
|
||||||
def __init__(self, credentials, auth_url=CONF.identity.uri_v3):
|
def __init__(self, credentials, auth_url=CONF.identity.uri_v3):
|
||||||
super(RangerAuthProvider, self).__init__(credentials, auth_url)
|
_auth = auth_url or ""
|
||||||
|
super(RangerAuthProvider, self).__init__(credentials, _auth)
|
||||||
|
|
||||||
def auth_request(self, method, url, headers=None, body=None, filters=None):
|
def auth_request(self, method, url, headers=None, body=None, filters=None):
|
||||||
filters = {'service': 'identity'}
|
filters = {'service': 'identity'}
|
||||||
|
@ -28,7 +28,8 @@ CONF = config.CONF
|
|||||||
class RmsClient(base_client.RangerClientBase):
|
class RmsClient(base_client.RangerClientBase):
|
||||||
|
|
||||||
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
rms_url = CONF.ranger.RANGER_RMS_BASE_URL
|
||||||
identity_url = CONF.identity.uri_v3.strip('/v3')
|
identity_url = CONF.identity.uri_v3 or ""
|
||||||
|
identity_url = identity_url.strip('/v3')
|
||||||
version = "v2"
|
version = "v2"
|
||||||
|
|
||||||
def create_region(self, region_id, **kwargs):
|
def create_region(self, region_id, **kwargs):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
debug = true
|
debug = true
|
||||||
log_file = tempest.log
|
log_file = tempest.log
|
||||||
log_dir =
|
log_dir = /var/log/
|
||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
test_accounts_file = /opt/stack/tempest/etc/accounts.yaml
|
test_accounts_file = /opt/stack/tempest/etc/accounts.yaml
|
||||||
|
7
tox.ini
7
tox.ini
@ -44,13 +44,11 @@ whitelist_externals =
|
|||||||
bash
|
bash
|
||||||
|
|
||||||
|
|
||||||
# At this time we are only checking for C0103(invalid-name) which in the near
|
|
||||||
# future will be expanded upon
|
|
||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
sitepackages = True
|
sitepackages = True
|
||||||
basepython = python
|
basepython = python
|
||||||
deps =
|
deps =
|
||||||
pylint==1.7.2
|
pylint==1.8.2
|
||||||
commands =
|
commands =
|
||||||
bash changed_python_files.sh {toxinidir} "pylint" {posargs}
|
bash changed_python_files.sh {toxinidir} "pylint" {posargs}
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
@ -76,6 +74,5 @@ sitepackages = True
|
|||||||
basepython = python
|
basepython = python
|
||||||
deps = -r requirements.txt
|
deps = -r requirements.txt
|
||||||
commands =
|
commands =
|
||||||
touch tempest.log
|
|
||||||
stestr init
|
stestr init
|
||||||
tempest run -l --config-file tempest_setup/tempest.conf --log-file tempest.log
|
tempest run -l
|
||||||
|
Loading…
x
Reference in New Issue
Block a user