Enable Zesty-Ocata Amulet Tests
- Turn on Zesty-Ocata Amulet test definitions. - Standardize test-requirements.txt - Sync charm helpers for various fixes - Fixup src/actions/run-tempest.py to work with charms.reactiv 0.4.6 Change-Id: I720f6e9a8be8af653e82be3f27cb43c3611e8fb3
This commit is contained in:
parent
0459569160
commit
f514805458
|
@ -4,9 +4,26 @@ sys.path.append('lib')
|
|||
|
||||
import charm.openstack.tempest as tempest
|
||||
import charms.reactive as reactive
|
||||
import charms.reactive.bus as bus
|
||||
import charmhelpers.core.hookenv as hookenv
|
||||
|
||||
# Make sure that reactive is bootstrapped and all the states are setup
|
||||
# properly
|
||||
from charms.layer import basic
|
||||
basic.bootstrap_charm_deps()
|
||||
basic.init_config_states()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# charms.reactive 0.4.6 moved the auto discovery of interfaces out of the
|
||||
# module load and into the main() function. Actions don't want to run the
|
||||
# main (as we don't want the handlers/hooks to run) so this just finds the
|
||||
# interfaces to the '.from_state()' function will get the interface object.
|
||||
bus.discover()
|
||||
identity_int = reactive.RelationBase.from_state('identity-admin.available')
|
||||
tempest.render_configs([identity_int])
|
||||
tempest.run_test('smoke')
|
||||
if identity_int is None:
|
||||
# The interface isn't connected, so we can't do this yet
|
||||
hookenv.action_fail(
|
||||
"The identity-admin interface is not available - bailing")
|
||||
else:
|
||||
tempest.render_configs([identity_int])
|
||||
tempest.run_test('smoke')
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# charm-proof
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
coverage>=3.6
|
||||
mock>=1.2
|
||||
flake8>=2.2.4,<=2.4.1
|
||||
os-testr>=0.4.1
|
||||
charm-tools>=2.0.0
|
||||
requests==2.6.0
|
||||
# amulet deployment helpers
|
||||
bzr+lp:charm-helpers#egg=charmhelpers
|
||||
# BEGIN: Amulet OpenStack Charm Helper Requirements
|
||||
|
@ -7,15 +14,18 @@ bzr+lp:charm-helpers#egg=charmhelpers
|
|||
amulet>=1.14.3,<2.0
|
||||
bundletester>=0.6.1,<1.0
|
||||
aodhclient>=0.1.0
|
||||
python-ceilometerclient>=1.5.0,<2.0
|
||||
python-cinderclient>=1.4.0,<2.0
|
||||
python-glanceclient>=1.1.0,<2.0
|
||||
python-heatclient>=0.8.0,<1.0
|
||||
python-keystoneclient>=1.7.1,<2.0
|
||||
python-neutronclient>=3.1.0,<4.0
|
||||
python-novaclient>=2.30.1,<3.0
|
||||
python-openstackclient>=1.7.0,<2.0
|
||||
python-swiftclient>=2.6.0,<3.0
|
||||
python-barbicanclient>=4.0.1
|
||||
python-ceilometerclient>=1.5.0
|
||||
python-cinderclient>=1.4.0
|
||||
python-designateclient>=1.5
|
||||
python-glanceclient>=1.1.0
|
||||
python-heatclient>=0.8.0
|
||||
python-keystoneclient>=1.7.1
|
||||
python-manilaclient>=1.8.1
|
||||
python-neutronclient>=3.1.0
|
||||
python-novaclient>=2.30.1
|
||||
python-openstackclient>=1.7.0
|
||||
python-swiftclient>=2.6.0
|
||||
pika>=0.10.0,<1.0
|
||||
distro-info
|
||||
# END: Amulet OpenStack Charm Helper Requirements
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import subprocess
|
||||
import json
|
||||
import time
|
||||
|
||||
from charmhelpers.contrib.openstack.amulet.deployment import (
|
||||
OpenStackAmuletDeployment
|
||||
|
@ -98,36 +95,10 @@ class TempestBasicDeployment(OpenStackAmuletDeployment):
|
|||
u.log.debug('openstack release str: {}'.format(
|
||||
self._get_openstack_release_string()))
|
||||
|
||||
def _run_action(self, unit_id, action, *args):
|
||||
command = ["juju", "action", "do", "--format=json", unit_id, action]
|
||||
command.extend(args)
|
||||
print("Running command: %s\n" % " ".join(command))
|
||||
output = subprocess.check_output(command)
|
||||
output_json = output.decode(encoding="UTF-8")
|
||||
data = json.loads(output_json)
|
||||
action_id = data[u'Action queued with id']
|
||||
return action_id
|
||||
|
||||
def _wait_on_action(self, action_id):
|
||||
command = ["juju", "action", "fetch", "--format=json", action_id]
|
||||
while True:
|
||||
try:
|
||||
output = subprocess.check_output(command)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return False
|
||||
output_json = output.decode(encoding="UTF-8")
|
||||
data = json.loads(output_json)
|
||||
if data[u"status"] == "completed":
|
||||
return True
|
||||
elif data[u"status"] == "failed":
|
||||
return False
|
||||
time.sleep(2)
|
||||
|
||||
def test_run_tempest(self):
|
||||
u.log.debug('Running Tempest...')
|
||||
unit = self.tempest_sentry
|
||||
assert u.status_get(unit)[0] == "active"
|
||||
|
||||
action_id = self._run_action(unit.info['unit_name'], "run-tempest")
|
||||
assert self._wait_on_action(action_id), "run-tempest action failed."
|
||||
action_id = u.run_action(unit, "run-tempest")
|
||||
assert u.wait_on_action(action_id), "run-tempest action failed."
|
||||
|
|
|
@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir}
|
|||
PYTHONHASHSEED=0
|
||||
AMULET_SETUP_TIMEOUT=2700
|
||||
whitelist_externals = juju
|
||||
passenv = HOME TERM AMULET_* CS_API_URL
|
||||
passenv = HOME TERM AMULET_* CS_API_*
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
install_command =
|
||||
pip install --allow-unverified python-apt {opts} {packages}
|
||||
|
|
Loading…
Reference in New Issue