def _clean_up(self): """ If an exception in raised in setUp, tearDown will not be called, thus we will place our cleanup in a method which is called after tearDown :return: None """ StratisCli.destroy_all() self.assertEqual(0, len(StratisCli.pool_list()))
def setUp(self): """ Ensure we are ready, which includes stratisd process is up and running and we have an empty configuration. If not we will attempt to make the configuration empty. :return: None """ self.addCleanup(self._clean_up) # The daemon should already be running, if not lets starts it and wait # a bit if process_exists('stratisd') is None: exec_command(["systemctl", "start", "stratisd"]) time.sleep(20) StratisCli.destroy_all() self.assertEqual(0, len(StratisCli.pool_list()))