Add testenv:venvfix, fix test so Jenkins passes

These tests are expected to run outside the context of an
available IPA server but there are still two conditions.

The first is no IPA is configured so that will be detected
and no OTP returned. In this case no OTP is returned so there
is nothing to test against.

The second is IPA is configured but there is no keytab so
no host can be added. In this case the OTP is still returned
so it can be checked at least that it matches the expected
pattern.

Change-Id: I56b59f33cca64eb90b378172af3fe0e2ef8171e3
This commit is contained in:
Rob Crittenden 2016-12-07 00:12:26 +00:00
parent b9698f3bab
commit 0de474d3b0
2 changed files with 13 additions and 5 deletions

View File

@ -180,11 +180,12 @@ class JoinTest(test.TestCase):
req.body = jsonutils.dump_as_bytes(body)
res_dict = self.join_controller.create(req, body)
# Manually check the response dict for an OTP pattern and
# what the default hostname should be.
self.assertThat(res_dict.get('ipaotp'),
MatchesRegex('^[a-z0-9]{32}'))
self.assertEqual(len(res_dict.get('ipaotp', 0)), 32)
# There should be no OTP because IPA shouldn't be
# configured, but we'll handle both cases.
if res_dict.get('ipaotp'):
self.assertThat(res_dict.get('ipaotp'),
MatchesRegex('^[a-z0-9]{32}'))
self.assertEqual(len(res_dict.get('ipaotp', 0)), 32)
self.assertEqual(res_dict.get('hostname'), 'test.test')
# Note that on failures this will generate to stdout a Krb5Error

View File

@ -51,5 +51,12 @@ ignore = E251,D100,D101,D102,D202,D208
exclude = .git,.venv,.tox,dist,tools,doc,*egg,build
max-complexity=30
[testenv:venv]
# NOTE(jaegerandi): This target does not use constraints because
# upstream infra does not yet support it. Once that's fixed, we can
# drop the install_command.
install_command = pip install -U --force-reinstall {opts} {packages}
commands = {posargs}
[testenv:docs]
commands = sphinx-build -W -b html doc/source doc/build/html