python312Packages.dissect-extfs: 3.11 -> 3.12
[NixPkgs.git] / nixos / tests / esphome.nix
blob5a318b65a723173e23a2ffc942450621ce4301d7
1 import ./make-test-python.nix ({ pkgs, lib, ... }:
3 let
4   testPort = 6052;
5   unixSocket = "/run/esphome/esphome.sock";
6 in
8   name = "esphome";
9   meta.maintainers = with lib.maintainers; [ oddlama ];
11   nodes = {
12     esphomeTcp = { ... }:
13       {
14         services.esphome = {
15           enable = true;
16           port = testPort;
17           address = "0.0.0.0";
18           openFirewall = true;
19         };
20       };
22     esphomeUnix = { ... }:
23       {
24         services.esphome = {
25           enable = true;
26           enableUnixSocket = true;
27         };
28       };
29   };
31   testScript = ''
32     esphomeTcp.wait_for_unit("esphome.service")
33     esphomeTcp.wait_for_open_port(${toString testPort})
34     esphomeTcp.succeed("curl --fail http://localhost:${toString testPort}/")
36     esphomeUnix.wait_for_unit("esphome.service")
37     esphomeUnix.wait_for_file("${unixSocket}")
38     esphomeUnix.succeed("curl --fail --unix-socket ${unixSocket} http://localhost/")
39   '';