about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/gemstash.nix
blob: bc152e42e92eb8bad15460de5b79bab5772bb5e4 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ system ? builtins.currentSystem, config ? { }
, pkgs ? import ../.. { inherit system config; } }:

with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;

let common_meta = { maintainers = [ maintainers.viraptor ]; };
in
{
  gemstash_works = makeTest {
    name = "gemstash-works";
    meta = common_meta;

    nodes.machine = { config, pkgs, ... }: {
      services.gemstash = {
        enable = true;
      };
    };

    # gemstash responds to http requests
    testScript = ''
      machine.wait_for_unit("gemstash.service")
      machine.wait_for_file("/var/lib/gemstash")
      machine.wait_for_open_port(9292)
      machine.succeed("curl http://localhost:9292")
    '';
  };

  gemstash_custom_port = makeTest {
    name = "gemstash-custom-port";
    meta = common_meta;

    nodes.machine = { config, pkgs, ... }: {
      services.gemstash = {
        enable = true;
        openFirewall = true;
        settings = {
          bind = "tcp://0.0.0.0:12345";
        };
      };
    };

    # gemstash responds to http requests
    testScript = ''
      machine.wait_for_unit("gemstash.service")
      machine.wait_for_file("/var/lib/gemstash")
      machine.wait_for_open_port(12345)
      machine.succeed("curl http://localhost:12345")
    '';
  };
}