Commit 88a73f75 authored by Jérome Perrin's avatar Jérome Perrin

testcase: improve leaked partitions detection and cleanup

- We should only try to remove leaked partitions if we detected some,
  otherwise it may produce a strange message "unable to delete leaked
  partitions".
- If some supervisor configuration is still present after partition
  deletion, they must be removed not to block next test and the current
  test must be marked failed.
parent a620b0b5
...@@ -461,6 +461,11 @@ class SlapOSInstanceTestCase(unittest.TestCase): ...@@ -461,6 +461,11 @@ class SlapOSInstanceTestCase(unittest.TestCase):
cls.slap.stop() cls.slap.stop()
except: except:
cls.logger.exception("Error during stop") cls.logger.exception("Error during stop")
leaked_supervisor_configs = glob.glob(
os.path.join(cls.slap.instance_directory, 'etc', 'supervisord.conf.d', '*.conf'))
if leaked_supervisor_configs:
[os.unlink(config) for config in leaked_supervisor_configs]
raise AssertionError("Test leaked supervisor configurations: %s" % leaked_supervisor_configs)
@classmethod @classmethod
def requestDefaultInstance(cls, state='started'): def requestDefaultInstance(cls, state='started'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment