tests - add debug_fail function
This commit is contained in:
parent
07b0bb38dd
commit
2780ee190d
|
@ -116,4 +116,9 @@ class AutoconfTest(Test) :
|
|||
log("AUTOCONF", "❌", "exception while running AutoconfTest._cleanup_test()\n" + format_exc())
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _debug_fail(self) :
|
||||
autoconf = "/tmp/autoconf"
|
||||
proc = run("docker-compose logs", shell=True, cwd=autoconf)
|
||||
test = "/tmp/tests/" + self._name
|
||||
proc = run("docker-compose -f autoconf.yml logs", shell=True, cwd=test)
|
|
@ -75,4 +75,8 @@ class DockerTest(Test) :
|
|||
log("DOCKER", "❌", "exception while running DockerTest._cleanup_test()\n" + format_exc())
|
||||
return False
|
||||
return True
|
||||
|
||||
def _debug_fail(self) :
|
||||
test = "/tmp/tests/" + self._name
|
||||
proc = run("docker-compose logs", shell=True, cwd=test)
|
||||
|
|
@ -86,6 +86,7 @@ class Test(ABC) :
|
|||
return self._cleanup_test()
|
||||
log("TEST", "⚠️", "tests not ok, retrying in 1s ...")
|
||||
sleep(1)
|
||||
self._debug_fail()
|
||||
log("TEST", "❌", "failed (timeout = " + str(self.__timeout) + "s)")
|
||||
return False
|
||||
|
||||
|
@ -100,10 +101,14 @@ class Test(ABC) :
|
|||
r = get(ex_url, timeout=5)
|
||||
return test["string"].casefold() in r.text.casefold()
|
||||
except :
|
||||
log("TEST", "❌", "exception while running test of type " + test["type"] + " on URL " + test["url"] + "\n" + format_exc())
|
||||
log("TEST", "❌", "exception while running test of type " + test["type"] + " on URL " + ex_url + "\n" + format_exc())
|
||||
return False
|
||||
raise(Exception("unknow test type " + test["type"]))
|
||||
|
||||
# called when tests fail : typical case is to show logs
|
||||
def _debug_fail(self) :
|
||||
pass
|
||||
|
||||
def _replace_in_file(self, path, old, new) :
|
||||
with open(path, "r") as f :
|
||||
content = f.read()
|
||||
|
|
Loading…
Reference in New Issue