summaryrefslogtreecommitdiffstats
path: root/nixos/tests/flood.nix
blob: c474f5efeefb4c486e18b2c183eb666bd6082b10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ pkgs, ... }:
let
  port = 3001;
in
{
  name = "flood";
  meta = {
    maintainers = with pkgs.lib.maintainers; [ thiagokokada ];
  };

  nodes.machine =
    { pkgs, ... }:
    {
      services.flood = {
        inherit port;
        enable = true;
        openFirewall = true;
        extraArgs = [ "--baseuri=/" ];
      };
    };

  testScript = # python
    ''
      machine.start()
      machine.wait_for_unit("flood.service")
      machine.wait_for_open_port(${toString port})

      machine.succeed("curl --fail http://localhost:${toString port}")
    '';
}