summaryrefslogtreecommitdiffstats
path: root/nixos/tests/homer/nginx.nix
blob: 39dd0c2c52ac0c8cda6a5450a0fe608fd8293128 (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
26
27
28
29
30
import ../make-test-python.nix (
  { lib, ... }:

  {
    name = "homer-nginx";
    meta.maintainers = with lib.maintainers; [ stunkymonkey ];

    nodes.machine =
      { pkgs, ... }:
      {
        services.homer = {
          enable = true;
          virtualHost = {
            nginx.enable = true;
            domain = "localhost";
          };
          settings = {
            title = "testing";
          };
        };
      };

    testScript = ''
      machine.wait_for_unit("nginx.service")
      machine.wait_for_open_port(80)
      machine.succeed("curl --fail --show-error --silent http://localhost:80/ | grep '<title>Homer</title>'")
      machine.succeed("curl --fail --show-error --silent http://localhost:80/assets/config.yml | grep 'title: testing'")
    '';
  }
)