about summary refs log tree commit diff
path: root/nixos/tests/keter.nix
blob: 1cc2ffbde0a08fca379a6bca309689d62237cb5d (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
import ./make-test-python.nix ({ pkgs, ... }:
  let
    port = 81;
  in
  {
    name = "keter";
    meta = with pkgs.lib.maintainers; {
      maintainers = [ jappie ];
    };


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

        globalKeterConfig = {
          cli-port = 123; # just adding this to test the freeform
          listeners = [{
            host = "*4";
            inherit port;
          }];
        };
        bundle = {
          appName = "test-bundle";
          domain = "localhost";
          executable = pkgs.writeShellScript "run" ''
            ${pkgs.python3}/bin/python -m http.server $PORT
          '';
        };
      };
    };

    testScript =
      ''
        machine.wait_for_unit("keter.service")

        machine.wait_for_open_port(${toString port})
        machine.wait_for_console_text("Activating app test-bundle with hosts: localhost")


        machine.succeed("curl --fail http://localhost:${toString port}/")
      '';
  })