From: Adam Israel Date: Tue, 19 Mar 2019 21:21:08 +0000 (+0100) Subject: Merge "Fix bug 564" X-Git-Tag: v6.0.0~15 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=29ad6453fb8cdece73b8c2f623cf81d5d730982d;hp=7bf2f4d5ba51d8a6909a8709aeda200ddb153b03 Merge "Fix bug 564" --- diff --git a/n2vc/vnf.py b/n2vc/vnf.py index 9cdbb33..1bdfe2f 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -769,11 +769,11 @@ class N2VC: await self.disconnect_model(self.monitors[model_name]) - # Notify the callback that this charm has been removed. self.notify_callback( model_name, application_name, "removed", + "Removing charm {}".format(application_name), callback, *callback_args, ) @@ -823,7 +823,7 @@ class N2VC: # Do not delete the default model. The default model was used by all # Network Services, prior to the implementation of a model per NS. - if ns_uuid.lower() is "default": + if ns_uuid.lower() == "default": return False if not self.authenticated: @@ -836,7 +836,7 @@ class N2VC: try: await self.controller.destroy_models(ns_uuid) - except JujuError as e: + except JujuError: raise NetworkServiceDoesNotExist( "The Network Service '{}' does not exist".format(ns_uuid) ) diff --git a/tests/base.py b/tests/base.py index 41fa191..3ae5f4f 100644 --- a/tests/base.py +++ b/tests/base.py @@ -568,12 +568,17 @@ class TestN2VC(object): ) subprocess.check_call(shlex.split(cmd)) - self.artifacts[charm] = { - 'tmpdir': builds, - 'charm': "{}/builds/{}".format(builds, charm), - } except subprocess.CalledProcessError as e: - raise Exception("charm build failed: {}.".format(e)) + # charm build will return error code 100 if the charm fails + # the auto-run of charm proof, which we can safely ignore for + # our CI charms. + if e.returncode != 100: + raise Exception("charm build failed: {}.".format(e)) + + self.artifacts[charm] = { + 'tmpdir': builds, + 'charm': "{}/builds/{}".format(builds, charm), + } return self.artifacts[charm]['charm'] @@ -902,6 +907,7 @@ class TestN2VC(object): application, ): break + await self.n2vc.DestroyNetworkService(self.ns_name) # Need to wait for the charm to finish, because native charms if self.state[application]['container']: diff --git a/tests/test_model.py b/tests/test_model.py index b54a7bb..ff164fa 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -2,10 +2,8 @@ Test N2VC's ssh key generation """ import n2vc -import os import pytest from . import base -import tempfile import uuid