about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/haste-server.nix
blob: 9097c992c5483d628e2b44840890fd1e4caf9a7b (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
import ./make-test-python.nix ({ 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"')
    '';
  })