LS, I want to run an integration test (for LDAP but that is irrelevant) and marvin does not cleanup resources I isolated the problem like so: ``` #Import Local Modules
import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.lib.utils import * from marvin.lib.base import * from marvin.lib.common import * from marvin.lib.utils import (random_gen) from nose.plugins.attrib import attr #Import System modules import time import logging logger = logging.getLogger(__name__) logger_handler = logging.FileHandler('/tmp/MarvinLogs/{}.log'.format(__name__)) logger_formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') logger_handler.setFormatter(logger_formatter) logger.addHandler(logger_handler) logger.setLevel(logging.DEBUG) class TestData: parentDomain = "TEST" name = "name" id = "id" notAvailable = "N/A" domains = "domains" def __init__(self): self.testdata = { TestData.domains : [ { TestData.name : TestData.parentDomain, TestData.id : TestData.notAvailable }, ], } class TestTestCleanup(cloudstackTestCase): @classmethod def setUpClass(cls): logger.info("Setting up Class") testClient = super(TestTestCleanup, cls).getClsTestClient() cls.apiclient = testClient.getApiClient() # Setup test data td = TestData() logger.debug(td) cls.services = testClient.getParsedTestDataConfig() logging.debug("standards") # Get Zone, Domain cls.domain = get_domain(cls.apiclient) logging.debug(cls.domain) cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests()) logging.debug("standard zone: %s" % cls.zone) # Build the test env # create a parent domain logger.info("Creating domain: " + TestData.parentDomain) tmpDomain = Domain.create(cls.apiclient,td.testdata["domains"][0]) logger.debug("created domain: %s" % tmpDomain.name ) cls.parentDomain = Domain.list(cls.apiclient,id=tmpDomain.id)[0] logger.debug("found just created domain by id %s" % cls.parentDomain.id) cls._cleanup = [tmpDomain] # cls._cleanup.append( cls.parentDomain ) for obj in reversed(cls._cleanup): logger.debug(obj.name) return @classmethod def tearDownClass(cls): logger.info("Tearing Down Class") try: for obj in reversed(cls._cleanup): logger.debug(obj.name) obj.delete() logger.debug("deleted %s " % obj.id) cleanup_resources(cls.apiClient, reversed(cls._cleanup)) logging.debug("done cleaning up resources in tearDownClass(cls)") except Exception as e: logging.debug("Exception in tearDownClass(cls): %s" % e) def setUp(self): self.apiclient = self.testClient.getApiClient() self.hypervisor = self.testClient.getHypervisorInfo() self.dbclient = self.testClient.getDbConnection() self.services = self.testClient.getParsedTestDataConfig() self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests()) self.pod = get_pod(self.apiclient, self.zone.id) td = TestData() logger.info("Creating domain: " + TestData.parentDomain) tmpDomain = Domain.create(self.apiclient,td.testdata["domains"][0]) logger.debug("created domain: %s" % tmpDomain.name ) self.parentDomain = Domain.list(self.apiclient,id=tmpDomain.id)[0] logger.debug("found just created domain by id %s" % self.parentDomain.id) self.cleanup = [tmpDomain] for obj in reversed(self.cleanup): logger.debug(obj.name) return def tearDown(self): logger.info("Tearing Down Object") try: for obj in reversed(self.cleanup): logger.debug(obj.name) obj.delete() logger.debug("deleted %s " % obj.id) cleanup_resources(self.apiclient, reversed(self.cleanup) ) logging.debug("done cleaning up resources in tearDownObject") except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return @attr(tags=["smoke", "advanced"], required_hardware="false") def test_01_manual(self): return ``` neither the class nor the object cleanup seem to happen. Can anybody see where I go wrong? output: ``` 2019-10-04 11:38:46,069 INFO Setting up Class 2019-10-04 11:38:46,069 DEBUG <integration.plugins.test.test_cleanup.TestData instance at 0x107374878> 2019-10-04 11:38:46,159 INFO Creating domain: TEST 2019-10-04 11:38:46,252 DEBUG created domain: TEST-GDMX1C 2019-10-04 11:38:46,300 DEBUG found just created domain by id f6c0113f-a7ef-4547-87d4-d3ac98ef3e73 2019-10-04 11:38:46,300 DEBUG TEST-GDMX1C 2019-10-04 11:38:46,362 INFO Creating domain: TEST 2019-10-04 11:38:46,460 DEBUG created domain: TEST-TDVYUU 2019-10-04 11:38:46,507 DEBUG found just created domain by id db463a21-eef0-4d94-8524-7e0db1430732 2019-10-04 11:38:46,507 DEBUG TEST-TDVYUU 2019-10-04 11:38:46,507 INFO Tearing Down Object 2019-10-04 11:38:46,507 DEBUG TEST-TDVYUU 2019-10-04 11:38:46,511 INFO Tearing Down Class 2019-10-04 11:38:46,511 DEBUG TEST-GDMX1C ``` note that the delete() methods on the objects seem to 'continue the loop. no logging messages afterwards and no exceptions raised??? any pointers appreciated /me googling further in the meanwhile -- Daan