nixos/tests/home-assistant: test custom things cleanup

Make sure we properly remove custom components and custom lovelace
modules, when they're not configured anymore.
This commit is contained in:
Martin Weinelt 2023-04-17 23:49:13 +02:00
parent 8108ce0a4f
commit c85cecedf1
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -124,6 +124,14 @@ in {
inheritParentConfig = true;
configuration.services.home-assistant.config.backup = {};
};
specialisation.removeCustomThings = {
inheritParentConfig = true;
configuration.services.home-assistant = {
customComponents = lib.mkForce [];
customLovelaceModules = lib.mkForce [];
};
};
};
testScript = { nodes, ... }: let
@ -218,6 +226,13 @@ in {
for domain in ["backup"]:
assert f"Setup of domain {domain} took" in journal, f"{domain} setup missing"
with subtest("Check custom components and custom lovelace modules get removed"):
cursor = get_journal_cursor()
hass.succeed("${system}/specialisation/removeCustomThings/bin/switch-to-configuration test")
hass.fail("grep -q 'mini-graph-card-bundle.js' '${configDir}/ui-lovelace.yaml'")
hass.fail("test -f ${configDir}/custom_components/prometheus_sensor/manifest.json")
wait_for_homeassistant(cursor)
with subtest("Check that no errors were logged"):
hass.fail("journalctl -u home-assistant -o cat | grep -q ERROR")