anchor.diff:      assert match
       package = match.group('path')
   
  +
  +    def get_journal_cursor(host) -> str:
  +        exit, out = host.execute("journalctl -u home-assistant.service -n1 -o json-pretty --output-fields=__CURSOR")
  +        assert exit == 0
  +        return json.loads(out)["__CURSOR"]
  +
  +
  +    def wait_for_homeassistant(host, cursor):
  +        host.wait_until_succeeds(f"journalctl --after-cursor='{cursor}' -u home-assistant.service | grep -q 'Home Assistant initialized in'")
  +
  +
       hass.wait_for_unit("home-assistant.service")
  +    cursor = get_journal_cursor(hass)
   
       with subtest("Check that YAML configuration file is in place"):
           hass.succeed("test -L ${configDir}/configuration.yaml")
  
positive.code:   meta.maintainers = lib.teams.home-assistant.members;
  
    nodes.hass = { pkgs, ... }: {
      environment.systemPackages = with pkgs; [ mosquitto ];
  
      services.postgresql = {
        enable = true;
        ensureDatabases = [ "hass" ];
  
negative.code:     with subtest("Check service reloads when configuration changes"):
        # store the old pid of the process
        pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
        cursor = get_journal_cursor(hass)
        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(hass, cursor)
  
      with subtest("check service restarts when package changes"):
        pid = new_pid
        cursor = get_journal_cursor(hass)
        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 shoudl change when the HA binary changes"
        wait_for_homeassistant(hass, cursor)
  
      with subtest("Check that no errors were logged"):
          output_log = hass.succeed("cat ${configDir}/home-assistant.log")
  