def destroy(self) -> None: ContainerManager.destroy_all_containers(self) try: os.remove(self.rsyslog_confpath) except Exception as exc: # pylint: disable=broad-except LOGGER.warning("Unable to delete `%s': %s", self.rsyslog_confpath, exc)
def test_destroy_all(self): ContainerManager.run_container(self.node, "c2") ContainerManager.set_container_keep_alive(self.node, "c1") with self.subTest("Destroy all containers without keep-alive tag"): ContainerManager.destroy_all_containers(self.node) self.assertRaises(NotFound, ContainerManager.get_container, self.node, "c2") self.assertEqual(ContainerManager.get_container(self.node, "c1"), self.container) with self.subTest("Ignore keep-alive tag"): ContainerManager.destroy_all_containers(self.node, ignore_keepalive=True) self.assertRaises(NotFound, ContainerManager.get_container, self.node, "c1")
def __del__(self): ContainerManager.destroy_all_containers(self)