tests - add cleanup for linux tests

This commit is contained in:
bunkerity 2022-08-11 17:36:19 +02:00
parent 17b6b0fdc8
commit b5c07dda01
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
2 changed files with 11 additions and 1 deletions

View File

@ -9,4 +9,3 @@ chown -R www-data:nginx ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
cp -rp ./bw-data/www/* /opt/bunkerweb/www
cp variables.env /opt/bunkerweb/variables.env

View File

@ -118,6 +118,17 @@ class LinuxTest(Test) :
return False
return True
def _cleanup_test(self) :
try :
proc = LinuxTest.docker_exec(self.__distro, "rm -rf /opt/bunkerweb/www/* ; rm -rf /opt/bunkerweb/confs/* ; rm -rf /opt/bunkerweb/plugins/*")
if proc.returncode != 0 :
raise(Exception("docker exec rm failed (cleanup)"))
super()._cleanup_test()
except :
log("DOCKER", "", "exception while running DockerTest._cleanup_test()\n" + format_exc())
return False
return True
def _debug_fail(self) :
LinuxTest.docker_exec(self.__distro, "cat /var/log/nginx/access.log ; cat /var/log/nginx/error.log ; journalctl -u bunkerweb --no-pager")