mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Make the CI test a bit more complex so we actually get some stack traceback
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+3
-3
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
mg.write("Hello, world!\n")
|
||||
mg.include("does_not_exist.lp", "r")
|
||||
?>
|
||||
mg.write("Hello, world 1!\n")
|
||||
mg.include("broken_lua_2.lp", "r")
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?
|
||||
mg.write("Hello, world 2!\n")
|
||||
mg.include("does_not_exist.lp", "r")
|
||||
?>
|
||||
@@ -64,6 +64,7 @@ cp test/versions /etc/pihole/versions
|
||||
|
||||
# Prepare Lua test script
|
||||
cp test/broken_lua.lp /var/www/html/broken_lua.lp
|
||||
cp test/broken_lua_2.lp /var/www/html/broken_lua_2.lp
|
||||
|
||||
# Prepare local powerDNS resolver
|
||||
bash test/pdns/setup.sh
|
||||
|
||||
@@ -1689,12 +1689,17 @@
|
||||
# Run a page with a syntax error
|
||||
run bash -c 'curl -s 127.0.0.1/broken_lua'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == 'Hello, world!' ]]
|
||||
[[ ${lines[1]} == '[string "/var/www/html/broken_lua.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' ]]
|
||||
[[ ${lines[2]} == '' ]]
|
||||
[[ ${lines[0]} == 'Hello, world 1!' ]]
|
||||
[[ ${lines[1]} == 'Hello, world 2!' ]]
|
||||
[[ ${lines[2]} == '[string "/var/www/html/broken_lua_2.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' ]]
|
||||
[[ ${lines[3]} == 'stack traceback:' ]]
|
||||
[[ ${lines[4]} == " [C]: in field 'include'" ]]
|
||||
[[ ${lines[5]} == ' [string "/var/www/html/broken_lua.lp"]:4: in main chunk' ]]
|
||||
[[ ${lines[6]} == 'aborting' ]]
|
||||
[[ ${lines[7]} == '' ]]
|
||||
|
||||
# Check if the error is logged (-F = fixed string (no regex), -q = quiet)
|
||||
run grep -qF 'LSP Kepler: call failed: runtime error: [string "/var/www/html/broken_lua.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' /var/log/pihole/webserver.log
|
||||
run grep -qF 'LSP Kepler: call failed: runtime error: [string "/var/www/html/broken_lua_2.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' /var/log/pihole/webserver.log
|
||||
[[ $status == 0 ]]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user