Add in a test to kill start.sh and then ensure that pihole-FTL is gracefully exited.

We add in some sleeps to ensure that the log file is being written to before we check it
Log entry tests are based on many different passes of running this locally with all sorts of timeouts and sleeps, this seems to be the most consistent

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2023-08-09 23:31:39 +01:00
parent b41d50b94f
commit 374f6f2537
3 changed files with 28 additions and 2 deletions

View File

@@ -11,3 +11,20 @@ def test_pihole_uid_env_var(docker):
def test_pihole_gid_env_var(docker):
func = docker.run("id -g pihole")
assert "456" in func.stdout
# We immediately remove the adlists.list file so that gravity does not attempt to download a default list
# Wait 5 seconds for gravity to finish, then kill the start.sh script
# Finally, tail the FTL log to see if it shuts down cleanly
@pytest.mark.parametrize("test_args", ['-e "PH_VERBOSE=1"'])
def test_pihole_ftl_clean_shutdown(docker):
func = docker.run(
"""
sleep 5
killall --signal 15 start.sh
sleep 5
tail -f /var/log/pihole-FTL.log
"""
)
assert "INFO: Shutting down... // exit code 0 // jmpret 0" in func.stdout
assert "INFO: ########## FTL terminated after" in func.stdout