nixos/tests/home-assistant: fix reload expectations
When sending SIGHUP to hass it will exit with code 100, which is the codified exit code to trigger a restart. This is useful, because it can allow triggering a restart from within the frontend. It was previously assumed that it would result in a reload, which would keep the same interpreter process intact. That is not the case and so the assumption that the PID would stay the same was flawed and only succeeded due to race conditions.
This commit is contained in:
@@ -206,21 +206,21 @@ in {
|
||||
with subtest("Check extra components are considered in systemd unit hardening"):
|
||||
hass.succeed("systemctl show -p DeviceAllow home-assistant.service | grep -q char-ttyUSB")
|
||||
|
||||
with subtest("Check service reloads when configuration changes"):
|
||||
with subtest("Check service restart from SIGHUP"):
|
||||
pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
|
||||
cursor = get_journal_cursor()
|
||||
hass.succeed("${system}/specialisation/differentName/bin/switch-to-configuration test")
|
||||
new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
|
||||
assert pid == new_pid, "The PID of the process should not change between process reloads"
|
||||
wait_for_homeassistant(cursor)
|
||||
new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
|
||||
assert pid != new_pid, "The PID of the process must change after sending SIGHUP"
|
||||
|
||||
with subtest("Check service restarts when dependencies change"):
|
||||
pid = new_pid
|
||||
cursor = get_journal_cursor()
|
||||
hass.succeed("${system}/specialisation/newFeature/bin/switch-to-configuration test")
|
||||
new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
|
||||
assert pid != new_pid, "The PID of the process should change when its PYTHONPATH changess"
|
||||
wait_for_homeassistant(cursor)
|
||||
new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
|
||||
assert pid != new_pid, "The PID of the process must change when its PYTHONPATH changess"
|
||||
|
||||
with subtest("Check that new components get setup after restart"):
|
||||
journal = get_journal_since(cursor)
|
||||
|
||||
Reference in New Issue
Block a user