mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
nixos/nginx: add unix-socket default-listen test case
Includes timeout=1 while checking existence of unix socket file paths
This commit is contained in:
parent
2309ec35a2
commit
871a9b2890
1 changed files with 11 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
let
|
let
|
||||||
|
defaultNginxSocketPath = "/var/run/nginx/default-test.sock";
|
||||||
nginxSocketPath = "/var/run/nginx/test.sock";
|
nginxSocketPath = "/var/run/nginx/test.sock";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -11,6 +12,13 @@ in
|
||||||
{
|
{
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
defaultListen = [ { addr = "unix:${defaultNginxSocketPath}"; } ];
|
||||||
|
virtualHosts.defaultLocalhost = {
|
||||||
|
serverName = "defaultLocalhost";
|
||||||
|
locations."/default".return = "200 'bar'";
|
||||||
|
};
|
||||||
|
|
||||||
virtualHosts.localhost = {
|
virtualHosts.localhost = {
|
||||||
serverName = "localhost";
|
serverName = "localhost";
|
||||||
listen = [ { addr = "unix:${nginxSocketPath}"; } ];
|
listen = [ { addr = "unix:${nginxSocketPath}"; } ];
|
||||||
|
@ -22,8 +30,10 @@ in
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
webserver.wait_for_unit("nginx")
|
webserver.wait_for_unit("nginx")
|
||||||
webserver.wait_for_open_unix_socket("${nginxSocketPath}")
|
webserver.wait_for_open_unix_socket("${defaultNginxSocketPath}", timeout=1)
|
||||||
|
webserver.wait_for_open_unix_socket("${nginxSocketPath}", timeout=1)
|
||||||
|
|
||||||
|
webserver.succeed("curl --fail --silent --unix-socket '${defaultNginxSocketPath}' http://defaultLocalhost/default | grep '^bar$'")
|
||||||
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$'")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue