nixos/tests; add haproxy

(cherry picked from commit e1790030262d1ce4a28144363469af96a588b21d)
release-18.03-flake
Andreas Rammhold 2018-06-08 22:30:24 +02:00
parent cf1c5918c7
commit 5a927299aa
No known key found for this signature in database
GPG Key ID: E432E410B5E48C86
2 changed files with 42 additions and 0 deletions

View File

@ -290,6 +290,7 @@ in rec {
tests.grafana = callTest tests/grafana.nix {};
tests.graphite = callTest tests/graphite.nix {};
tests.hardened = callTest tests/hardened.nix { };
tests.haproxy = callTest tests/haproxy.nix {};
tests.hibernate = callTest tests/hibernate.nix {};
tests.home-assistant = callTest tests/home-assistant.nix { };
tests.hound = callTest tests/hound.nix {};

View File

@ -0,0 +1,41 @@
import ./make-test.nix ({ pkgs, ...}: {
name = "haproxy";
nodes = {
machine = { config, ...}: {
imports = [ ../modules/profiles/minimal.nix ];
services.haproxy = {
enable = true;
config = ''
defaults
timeout connect 10s
backend http_server
mode http
server httpd [::1]:8000
frontend http
bind *:80
mode http
use_backend http_server
'';
};
services.httpd = {
enable = true;
documentRoot = pkgs.writeTextDir "index.txt" "We are all good!";
adminAddr = "notme@yourhost.local";
listen = [{
ip = "::1";
port = 8000;
}];
};
};
};
testScript = ''
startAll;
$machine->waitForUnit('multi-user.target');
$machine->waitForUnit('haproxy.service');
$machine->waitForUnit('httpd.service');
$machine->succeed('curl -k http://localhost:80/index.txt | grep "We are all good!"');
'';
})