From 46e8f6d89d009f5b16f451b05796875f4e82d4e8 Mon Sep 17 00:00:00 2001 From: Pete Vander Giessen Date: Fri, 27 Jan 2017 18:32:50 -0500 Subject: [PATCH] Create a new model for each test run of examples/add_model.py. --- examples/add_model.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/add_model.py b/examples/add_model.py index efa325b..e703450 100644 --- a/examples/add_model.py +++ b/examples/add_model.py @@ -11,6 +11,7 @@ from juju import utils from juju.controller import Controller import asyncio from logging import getLogger +import uuid LOG = getLogger(__name__) @@ -21,7 +22,8 @@ async def main(): await controller.connect_current() try: - model_name = "quux" + model_name = "addmodeltest-{}".format(uuid.uuid4()) + print("Adding model {}".format(model_name)) model = await controller.add_model(model_name) print('Deploying ubuntu') @@ -49,6 +51,10 @@ async def main(): print("Destroying model") await controller.destroy_model(model.info.uuid) + except Exception as e: + LOG.exception( + "Test failed! Model {} may not be cleaned up".format(model_name)) + finally: print('Disconnecting from controller') await model.disconnect() -- 2.25.1