mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 10:53:11 +00:00
43e79015bf
The defaults conflicts with the defaults of `services.httpd`: ``` error: The option `nodes.machine.services.logrotate.enable' has conflicting definition values: - In `/home/thomas/Workspace/Packaging/nixpkgs/nixos/modules/profiles/minimal.nix': false - In `/home/thomas/Workspace/Packaging/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix': true Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions. (use '--show-trace' to show detailed location information) ``` `nixos/profile/minimal` is not used in the majority of the tests and it does not seem to have a specific reason to use it for the HAProxy test.
54 lines
1.5 KiB
Nix
54 lines
1.5 KiB
Nix
import ./make-test-python.nix ({ pkgs, ...}: {
|
|
name = "haproxy";
|
|
nodes = {
|
|
machine = { ... }: {
|
|
services.haproxy = {
|
|
enable = true;
|
|
config = ''
|
|
defaults
|
|
timeout connect 10s
|
|
|
|
backend http_server
|
|
mode http
|
|
server httpd [::1]:8000
|
|
|
|
frontend http
|
|
bind *:80
|
|
mode http
|
|
http-request use-service prometheus-exporter if { path /metrics }
|
|
use_backend http_server
|
|
'';
|
|
};
|
|
services.httpd = {
|
|
enable = true;
|
|
virtualHosts.localhost = {
|
|
documentRoot = pkgs.writeTextDir "index.txt" "We are all good!";
|
|
adminAddr = "notme@yourhost.local";
|
|
listen = [{
|
|
ip = "::1";
|
|
port = 8000;
|
|
}];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
testScript = ''
|
|
start_all()
|
|
machine.wait_for_unit("multi-user.target")
|
|
machine.wait_for_unit("haproxy.service")
|
|
machine.wait_for_unit("httpd.service")
|
|
assert "We are all good!" in machine.succeed("curl -fk http://localhost:80/index.txt")
|
|
assert "haproxy_process_pool_allocated_bytes" in machine.succeed(
|
|
"curl -fk http://localhost:80/metrics"
|
|
)
|
|
|
|
with subtest("reload"):
|
|
machine.succeed("systemctl reload haproxy")
|
|
# wait some time to ensure the following request hits the reloaded haproxy
|
|
machine.sleep(5)
|
|
assert "We are all good!" in machine.succeed(
|
|
"curl -fk http://localhost:80/index.txt"
|
|
)
|
|
'';
|
|
})
|