cb5d9caf66
* Add calls to asyncio.get_event_loop().close() to close loop. libjuju does not do this for you and needs to be done just before exiting. * Require model to be explicitly set when running command line tools. This is part of the drive to ensure that eventually multiple runs can be performed concurrently. * Add set_juju_model/get_juju_model functions to manage which model is in focus
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import datetime
|
|
import os
|
|
|
|
import zaza.charm_lifecycle.configure as configure
|
|
import zaza.charm_lifecycle.destroy as destroy
|
|
import zaza.charm_lifecycle.utils as utils
|
|
import zaza.charm_lifecycle.prepare as prepare
|
|
import zaza.charm_lifecycle.deploy as deploy
|
|
import zaza.charm_lifecycle.test as test
|
|
|
|
|
|
def generate_model_name(charm_name, bundle_name):
|
|
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
|
return '{}{}{}'.format(charm_name, bundle_name, timestamp)
|
|
|
|
|
|
def func_test_runner():
|
|
"""Deploy the bundles and run the tests as defined by the charms tests.yaml
|
|
"""
|
|
test_config = utils.get_charm_config()
|
|
for t in test_config['gate_bundles']:
|
|
model_name = generate_model_name(test_config['charm_name'], t)
|
|
# Prepare
|
|
prepare.prepare(model_name)
|
|
# Deploy
|
|
deploy.deploy(
|
|
os.path.join(utils.BUNDLE_DIR, '{}.yaml'.format(t)),
|
|
model_name)
|
|
# Configure
|
|
configure.configure(model_name, test_config['configure'])
|
|
# Test
|
|
test.test(model_name, test_config['tests'])
|
|
# Destroy
|
|
destroy.destroy(model_name)
|
|
|
|
|
|
def main():
|
|
func_test_runner()
|