nixosTests.haproxy: migrate to runTest

Part of #386873
This commit is contained in:
Piotr Kwiecinski 2025-04-19 23:44:16 +02:00
parent 9258185510
commit 1c40626d78
No known key found for this signature in database
GPG key ID: EC0DE1CB9D5258B4
2 changed files with 116 additions and 118 deletions

View file

@ -597,7 +597,7 @@ in
}; };
haka = handleTest ./haka.nix { }; haka = handleTest ./haka.nix { };
haste-server = handleTest ./haste-server.nix { }; haste-server = handleTest ./haste-server.nix { };
haproxy = handleTest ./haproxy.nix { }; haproxy = runTest ./haproxy.nix;
hardened = handleTest ./hardened.nix { }; hardened = handleTest ./hardened.nix { };
harmonia = runTest ./harmonia.nix; harmonia = runTest ./harmonia.nix;
headscale = handleTest ./headscale.nix { }; headscale = handleTest ./headscale.nix { };

View file

@ -1,10 +1,9 @@
import ./make-test-python.nix ( { lib, hostPkgs, ... }:
{ lib, pkgs, ... }: {
{
name = "haproxy"; name = "haproxy";
nodes = { nodes = {
server = server =
{ ... }: { pkgs, ... }:
{ {
services.haproxy = { services.haproxy = {
enable = true; enable = true;
@ -67,7 +66,7 @@ import ./make-test-python.nix (
]; ];
}; };
client = client =
{ ... }: { pkgs, ... }:
{ {
environment.systemPackages = [ pkgs.curlHTTP3 ]; environment.systemPackages = [ pkgs.curlHTTP3 ];
}; };
@ -81,7 +80,7 @@ import ./make-test-python.nix (
raise Exception(f"Command {command} failed with exit code {r}") raise Exception(f"Command {command} failed with exit code {r}")
def openssl(command): def openssl(command):
cmd(f"${pkgs.openssl}/bin/openssl {command}") cmd(f"${lib.getExe hostPkgs.openssl} {command}")
# Generate CA. # Generate CA.
openssl("req -new -newkey rsa:4096 -nodes -x509 -days 7 -subj '/C=ZZ/ST=Cloud/L=Unspecified/O=NixOS/OU=Tests/CN=CA Certificate' -keyout cacert.key -out cacert.crt") openssl("req -new -newkey rsa:4096 -nodes -x509 -days 7 -subj '/C=ZZ/ST=Cloud/L=Unspecified/O=NixOS/OU=Tests/CN=CA Certificate' -keyout cacert.key -out cacert.crt")
@ -136,5 +135,4 @@ import ./make-test-python.nix (
server.sleep(5) server.sleep(5)
assert "We are all good!" in client.succeed("curl -f http://server/index.txt") assert "We are all good!" in client.succeed("curl -f http://server/index.txt")
''; '';
} }
)