nixpkgs/nixos/tests/realm.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
832 B
Nix
Raw Permalink Normal View History

{ lib, pkgs, ... }:
{
name = "realm";
2024-01-28 12:56:32 +08:00
meta = {
maintainers = with lib.maintainers; [ ocfox ];
};
2024-01-28 12:56:32 +08:00
nodes.machine =
{ pkgs, ... }:
{
services.nginx = {
enable = true;
statusPage = true;
};
# realm need DNS resolv server to run or use config.dns.nameserver
services.resolved.enable = true;
services.realm = {
enable = true;
config = {
endpoints = [
{
listen = "0.0.0.0:1000";
remote = "127.0.0.1:80";
}
];
};
2024-01-28 12:56:32 +08:00
};
};
2024-01-28 12:56:32 +08:00
testScript = ''
machine.wait_for_unit("nginx.service")
machine.wait_for_unit("realm.service")
2024-01-28 12:56:32 +08:00
machine.wait_for_open_port(80)
machine.wait_for_open_port(1000)
2024-01-28 12:56:32 +08:00
machine.succeed("curl --fail http://localhost:1000/")
'';
2024-01-28 12:56:32 +08:00
}