about summary refs log tree commit diff
path: root/nixos/tests/flood.nix
blob: 075d37e62835f447ebf4fbe65d9640c3bd7b2ace (plain) (blame)
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
import ./make-test-python.nix ({ 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}")
  '';
})