mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 06:14:57 +01:00
42 lines
966 B
Nix
42 lines
966 B
Nix
|
import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||
|
|
||
|
let
|
||
|
testPort = 6052;
|
||
|
unixSocket = "/run/esphome/esphome.sock";
|
||
|
in
|
||
|
with lib;
|
||
|
{
|
||
|
name = "esphome";
|
||
|
meta.maintainers = with pkgs.lib.maintainers; [ oddlama ];
|
||
|
|
||
|
nodes = {
|
||
|
esphomeTcp = { ... }:
|
||
|
{
|
||
|
services.esphome = {
|
||
|
enable = true;
|
||
|
port = testPort;
|
||
|
address = "0.0.0.0";
|
||
|
openFirewall = true;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
esphomeUnix = { ... }:
|
||
|
{
|
||
|
services.esphome = {
|
||
|
enable = true;
|
||
|
enableUnixSocket = true;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
testScript = ''
|
||
|
esphomeTcp.wait_for_unit("esphome.service")
|
||
|
esphomeTcp.wait_for_open_port(${toString testPort})
|
||
|
esphomeTcp.succeed("curl --fail http://localhost:${toString testPort}/")
|
||
|
|
||
|
esphomeUnix.wait_for_unit("esphome.service")
|
||
|
esphomeUnix.wait_for_file("${unixSocket}")
|
||
|
esphomeUnix.succeed("curl --fail --unix-socket ${unixSocket} http://localhost/")
|
||
|
'';
|
||
|
})
|