mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 05:00:16 +00:00
home-assistant: add NixOS test
This commit is contained in:
parent
bacbc48cfe
commit
0604c078a8
|
@ -267,6 +267,7 @@ in rec {
|
|||
tests.graphite = callTest tests/graphite.nix {};
|
||||
tests.hardened = callTest tests/hardened.nix { };
|
||||
tests.hibernate = callTest tests/hibernate.nix {};
|
||||
tests.home-assistant = callTest tests/home-assistant.nix { };
|
||||
tests.hound = callTest tests/hound.nix {};
|
||||
tests.i3wm = callTest tests/i3wm.nix {};
|
||||
tests.initrd-network-ssh = callTest tests/initrd-network-ssh {};
|
||||
|
|
41
nixos/tests/home-assistant.nix
Normal file
41
nixos/tests/home-assistant.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
import ./make-test.nix ({ pkgs, ... }:
|
||||
|
||||
let
|
||||
configDir = "/var/lib/foobar";
|
||||
|
||||
in {
|
||||
name = "home-assistant";
|
||||
|
||||
nodes = {
|
||||
hass =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.home-assistant = {
|
||||
inherit configDir;
|
||||
enable = true;
|
||||
config = {
|
||||
homeassistant = {
|
||||
name = "Home";
|
||||
time_zone = "UTC";
|
||||
};
|
||||
frontend = { };
|
||||
http = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
$hass->waitForUnit("home-assistant.service");
|
||||
|
||||
# Since config is specified using a Nix attribute set,
|
||||
# configuration.yaml is a link to the Nix store
|
||||
$hass->succeed("test -L ${configDir}/configuration.yaml");
|
||||
|
||||
# Check that Home Assistant's web interface and API can be reached
|
||||
$hass->waitForOpenPort(8123);
|
||||
$hass->succeed("curl --fail http://localhost:8123/states");
|
||||
$hass->succeed("curl --fail http://localhost:8123/api/ | grep 'API running'");
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue