summaryrefslogtreecommitdiffstats
path: root/nixos/tests/haste-server.nix
blob: 758e5f9dcae824a84896c028771a0e1ed952fef4 (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
{ pkgs, lib, ... }:
{
  name = "haste-server";
  meta.maintainers = with lib.maintainers; [ mkg20001 ];

  nodes.machine =
    { pkgs, ... }:
    {
      environment.systemPackages = with pkgs; [
        curl
        jq
      ];

      services.haste-server = {
        enable = true;
      };
    };

  testScript = ''
    machine.wait_for_unit("haste-server")
    machine.wait_until_succeeds("curl -s localhost:7777")
    machine.succeed('curl -s -X POST http://localhost:7777/documents -d "Hello World!" > bla')
    machine.succeed('curl http://localhost:7777/raw/$(cat bla | jq -r .key) | grep "Hello World"')
  '';
}