Commit e2607bea authored by Tom Niget's avatar Tom Niget Committed by Tom Niget

tests: cleanup test folder in teardown

Same as demo, tests expect a clean work directory, otherwise weird behavior will occur.
parent 829117fd
......@@ -29,12 +29,12 @@ class TestRegistryClientInteract(unittest.TestCase):
@classmethod
def setUpClass(cls):
re6st_wrap.initial()
# if running in net ns, set lo up
subprocess.check_call(("ip", "link", "set", "lo", "up"))
def setUp(self):
re6st_wrap.initial()
self.port = 18080
self.url = "http://localhost:{}/".format(self.port)
# not important, used in network_config check
......
......@@ -29,7 +29,8 @@ RE6ST_CONF = PYTHON + " -m re6st.cli.conf"
def initial():
"""create the workplace"""
if not WORK_DIR.exists():
if WORK_DIR.exists():
shutil.rmtree(str(WORK_DIR))
WORK_DIR.mkdir()
def ip_to_serial(ip6):
......
......@@ -57,6 +57,8 @@ class TestNet(unittest.TestCase):
def setUpClass(cls):
"""create work dir"""
logging.basicConfig(level=logging.INFO)
def setUp(self):
re6st_wrap.initial()
def deploy_re6st(self, nm, recreate=False):
......
  • The commit message does not match the change.

  • BTW, since I am rebasing, just tell me how to fix.

  • Oh I only saw the subject. The body describes the diff better, but shouldn't we instead try to actually clean up at the end of the test ?

  • Commit message could be tests: tie lifetime of data folder to test execution, I guess? It was originally done in the teardown but I changed it to instead remove if exist on création so logs would be easier to probe.

  • It was originally done in the teardown but I changed it to instead remove if exist on création so logs would be easier to probe.

    I wondered about that use case. Well, ok I'll just reword.

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