summaryrefslogtreecommitdiffstats
path: root/nixos/tests/plikd.nix
blob: 6ed7fd5130e8cc0d4de667321e47e9fa4c8aaa58 (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
{ lib, ... }:
{
  name = "plikd";
  meta = {
    maintainers = [ ];
  };

  nodes.machine =
    { pkgs, ... }:
    {
      services.plikd.enable = true;
      environment.systemPackages = [ pkgs.plik ];
    };

  testScript = ''
    # Service basic test
    machine.wait_for_unit("plikd")

    # Network test
    machine.wait_for_open_port(8080)
    machine.succeed("curl --fail -v http://localhost:8080")

    # Application test
    machine.execute("echo test > /tmp/data.txt")
    machine.succeed("plik --server http://localhost:8080 /tmp/data.txt | grep curl")

    machine.succeed("diff data.txt /tmp/data.txt")
  '';
}