diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2018-06-08 22:30:24 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2018-06-08 22:31:47 +0200 |
commit | e1790030262d1ce4a28144363469af96a588b21d (patch) | |
tree | f6b3011bea292358bed7a6ec0f0f0cd986bcecd2 /nixos/tests/haproxy.nix | |
parent | ea8b37c1c849b9c953f4beadb84cb061d75de40d (diff) | |
download | nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar.gz nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar.bz2 nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar.lz nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar.xz nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.tar.zst nixpkgs-e1790030262d1ce4a28144363469af96a588b21d.zip |
nixos/tests; add haproxy
Diffstat (limited to 'nixos/tests/haproxy.nix')
-rw-r--r-- | nixos/tests/haproxy.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/nixos/tests/haproxy.nix b/nixos/tests/haproxy.nix new file mode 100644 index 00000000000..ce4094237db --- /dev/null +++ b/nixos/tests/haproxy.nix @@ -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!"'); + + ''; +}) |