+ return self.state[application]['container']
+
+ @classmethod
+ async def stop():
+ """Stop the test.
+
+ - Remove charms
+ - Stop and delete containers
+ - Logout of N2VC
+ """
+ logging.warning("Stop the test.")
+ assert True
+ for application in self.charms:
+ try:
+ logging.warn("Removing charm")
+ await self.n2vc.RemoveCharms(model, application)
+
+ logging.warn(
+ "Destroying container for application {}".format(application)
+ )
+ if self.state[application]['container']:
+ destroy_lxd_container(self.state[application]['container'])
+ except Exception as e:
+ logging.warn("Error while deleting container: {}".format(e))
+
+ # Clean up any artifacts created during the test
+ logging.debug("Artifacts: {}".format(self.artifacts))
+ for charm in self.artifacts:
+ artifact = self.artifacts[charm]
+ if os.path.exists(artifact['tmpdir']):
+ logging.debug("Removing directory '{}'".format(artifact))
+ shutil.rmtree(artifact['tmpdir'])
+
+ # Logout of N2VC
+ await self.n2vc.logout()
+ self.n2vc = None
+
+ self._running = False