nixosTests.nginx-unix-socket: migrate to runTest

Part of #386873
This commit is contained in:
Piotr Kwiecinski
2025-03-30 17:54:41 +02:00
parent 63785f0edb
commit 89e464c751
2 changed files with 25 additions and 27 deletions

View File

@@ -1,31 +1,29 @@
import ./make-test-python.nix (
{ pkgs, ... }:
let
nginxSocketPath = "/var/run/nginx/test.sock";
in
{
name = "nginx-unix-socket";
{ ... }:
let
nginxSocketPath = "/var/run/nginx/test.sock";
in
{
name = "nginx-unix-socket";
nodes = {
webserver =
{ pkgs, lib, ... }:
{
services.nginx = {
enable = true;
virtualHosts.localhost = {
serverName = "localhost";
listen = [ { addr = "unix:${nginxSocketPath}"; } ];
locations."/test".return = "200 'foo'";
};
nodes = {
webserver =
{ pkgs, lib, ... }:
{
services.nginx = {
enable = true;
virtualHosts.localhost = {
serverName = "localhost";
listen = [ { addr = "unix:${nginxSocketPath}"; } ];
locations."/test".return = "200 'foo'";
};
};
};
};
};
testScript = ''
webserver.wait_for_unit("nginx")
webserver.wait_for_open_unix_socket("${nginxSocketPath}")
testScript = ''
webserver.wait_for_unit("nginx")
webserver.wait_for_open_unix_socket("${nginxSocketPath}")
webserver.succeed("curl --fail --silent --unix-socket '${nginxSocketPath}' http://localhost/test | grep '^foo$'")
'';
}
)
webserver.succeed("curl --fail --silent --unix-socket '${nginxSocketPath}' http://localhost/test | grep '^foo$'")
'';
}