tests - fix cp and end_fun for LinuxTest
This commit is contained in:
parent
2505bc015f
commit
6f35561fae
|
@ -81,23 +81,18 @@ class LinuxTest(Test) :
|
|||
try :
|
||||
super()._setup_test()
|
||||
test = "/tmp/tests/" + self._name
|
||||
example_data = "./examples/" + self._name + "/bw-data"
|
||||
for ex_domain, test_domain in self._domains.items() :
|
||||
Test.replace_in_files(test, ex_domain, test_domain)
|
||||
Test.rename(test, ex_domain, test_domain)
|
||||
Test.replace_in_files(test, "example.com", getenv("ROOT_DOMAIN"))
|
||||
setup = test + "/setup-linux.sh"
|
||||
if isfile(setup) :
|
||||
proc = LinuxTest.docker_cp(self.__distro, "/tmp/" + self._name, "/opt/tests")
|
||||
proc = LinuxTest.docker_cp(self.__distro, test, "/opt/tests")
|
||||
if proc.returncode != 0 :
|
||||
raise(Exception("docker cp failed (linux stack)"))
|
||||
proc = LinuxTest.docker_exec(self.__distro, "cd /opt/tests/" + self._name + " && ./setup-linux.sh")
|
||||
proc = LinuxTest.docker_exec(self.__distro, "cd /opt/tests/ && ./setup-linux.sh")
|
||||
if proc.returncode != 0 :
|
||||
raise(Exception("docker exec setup failed (linux stack)"))
|
||||
if isdir(example_data) :
|
||||
for cp_dir in listdir(example_data) :
|
||||
if isdir(join(example_data, cp_dir)) :
|
||||
copytree(join(example_data, cp_dir), join("/tmp/bw-data", cp_dir))
|
||||
proc = LinuxTest.docker_exec(self.__distro, "systemctl restart bunkerweb")
|
||||
if proc.returncode != 0 :
|
||||
raise(Exception("docker exec systemctl restart failed (linux stack)"))
|
||||
|
|
|
@ -70,11 +70,17 @@ for example in glob("./examples/*") :
|
|||
test_obj = LinuxTest(tests["name"], tests["timeout"], tests["tests"], distro)
|
||||
if not test_obj.run_tests() :
|
||||
log("TESTS", "❌", "Tests failed for " + tests["name"])
|
||||
end_fun()
|
||||
if test_type == "linux" :
|
||||
ret = end_fun(distro)
|
||||
else :
|
||||
ret = end_fun()
|
||||
_exit(1)
|
||||
except :
|
||||
log("TESTS", "❌", "Exception while executing test for example " + example + " : " + format_exc())
|
||||
end_fun()
|
||||
if test_type == "linux" :
|
||||
ret = end_fun(distro)
|
||||
else :
|
||||
ret = end_fun()
|
||||
exit(1)
|
||||
|
||||
if test_type == "linux" :
|
||||
|
|
Loading…
Reference in New Issue