about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/keter.nix
blob: 0bfb96e1c3245a7c54a32858b1919314dd595fdf (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
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 = {
        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}/")
    '';
})