mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
nixos/tests/home-assistant: test package and components passing
There are now multiple combinations of how one can pass either extraPackages or extraComponents. We now test those passed directly to the package via an override, and those passed indirectly via the module, that ultimately results in a second override to the package.
This commit is contained in:
parent
3f8ddef902
commit
32bd0aafab
@ -40,6 +40,9 @@ in {
|
|||||||
|
|
||||||
# tests loading components by overriding the package
|
# tests loading components by overriding the package
|
||||||
package = (pkgs.home-assistant.override {
|
package = (pkgs.home-assistant.override {
|
||||||
|
extraPackages = ps: with ps; [
|
||||||
|
colorama
|
||||||
|
];
|
||||||
extraComponents = [ "zha" ];
|
extraComponents = [ "zha" ];
|
||||||
}).overrideAttrs (oldAttrs: {
|
}).overrideAttrs (oldAttrs: {
|
||||||
doInstallCheck = false;
|
doInstallCheck = false;
|
||||||
@ -131,8 +134,18 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
import re
|
||||||
|
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
|
# Parse the package path out of the systemd unit, as we cannot
|
||||||
|
# access the final package, that is overriden inside the module,
|
||||||
|
# by any other means.
|
||||||
|
pattern = re.compile(r"path=(?P<path>[\/a-z0-9-.]+)\/bin\/hass")
|
||||||
|
response = hass.execute("systemctl show -p ExecStart home-assistant.service")[1]
|
||||||
|
match = pattern.search(response)
|
||||||
|
package = match.group('path')
|
||||||
|
|
||||||
hass.wait_for_unit("home-assistant.service")
|
hass.wait_for_unit("home-assistant.service")
|
||||||
|
|
||||||
with subtest("Check that YAML configuration file is in place"):
|
with subtest("Check that YAML configuration file is in place"):
|
||||||
@ -141,6 +154,14 @@ in {
|
|||||||
with subtest("Check the lovelace config is copied because lovelaceConfigWritable = true"):
|
with subtest("Check the lovelace config is copied because lovelaceConfigWritable = true"):
|
||||||
hass.succeed("test -f ${configDir}/ui-lovelace.yaml")
|
hass.succeed("test -f ${configDir}/ui-lovelace.yaml")
|
||||||
|
|
||||||
|
with subtest("Check extraComponents and extraPackages are considered from the package"):
|
||||||
|
hass.succeed(f"grep -q 'colorama' {package}/extra_packages")
|
||||||
|
hass.succeed(f"grep -q 'zha' {package}/extra_components")
|
||||||
|
|
||||||
|
with subtest("Check extraComponents and extraPackages are considered from the module"):
|
||||||
|
hass.succeed(f"grep -q 'psycopg2' {package}/extra_packages")
|
||||||
|
hass.succeed(f"grep -q 'wake_on_lan' {package}/extra_components")
|
||||||
|
|
||||||
with subtest("Check that Home Assistant's web interface and API can be reached"):
|
with subtest("Check that Home Assistant's web interface and API can be reached"):
|
||||||
hass.wait_until_succeeds("journalctl -u home-assistant.service | grep -q 'Home Assistant initialized in'")
|
hass.wait_until_succeeds("journalctl -u home-assistant.service | grep -q 'Home Assistant initialized in'")
|
||||||
hass.wait_for_open_port(8123)
|
hass.wait_for_open_port(8123)
|
||||||
|
Loading…
Reference in New Issue
Block a user