mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
parent
389f2fb908
commit
fa5141395f
2 changed files with 45 additions and 47 deletions
|
@ -798,7 +798,7 @@ in {
|
||||||
nfs4 = handleTest ./nfs { version = 4; };
|
nfs4 = handleTest ./nfs { version = 4; };
|
||||||
nghttpx = handleTest ./nghttpx.nix {};
|
nghttpx = handleTest ./nghttpx.nix {};
|
||||||
nginx = runTest ./nginx.nix;
|
nginx = runTest ./nginx.nix;
|
||||||
nginx-auth = handleTest ./nginx-auth.nix {};
|
nginx-auth = runTest ./nginx-auth.nix;
|
||||||
nginx-etag = handleTest ./nginx-etag.nix {};
|
nginx-etag = handleTest ./nginx-etag.nix {};
|
||||||
nginx-etag-compression = handleTest ./nginx-etag-compression.nix {};
|
nginx-etag-compression = handleTest ./nginx-etag-compression.nix {};
|
||||||
nginx-globalredirect = handleTest ./nginx-globalredirect.nix {};
|
nginx-globalredirect = handleTest ./nginx-globalredirect.nix {};
|
||||||
|
|
|
@ -1,54 +1,52 @@
|
||||||
import ./make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
name = "nginx-auth";
|
||||||
name = "nginx-auth";
|
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
webserver =
|
webserver =
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
services.nginx =
|
services.nginx =
|
||||||
let
|
let
|
||||||
root = pkgs.runCommand "testdir" { } ''
|
root = pkgs.runCommand "testdir" { } ''
|
||||||
mkdir "$out"
|
mkdir "$out"
|
||||||
echo hello world > "$out/index.html"
|
echo hello world > "$out/index.html"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
virtualHosts.lockedroot = {
|
virtualHosts.lockedroot = {
|
||||||
inherit root;
|
inherit root;
|
||||||
basicAuth.alice = "pwofa";
|
basicAuth.alice = "pwofa";
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualHosts.lockedsubdir = {
|
virtualHosts.lockedsubdir = {
|
||||||
inherit root;
|
inherit root;
|
||||||
locations."/sublocation/" = {
|
locations."/sublocation/" = {
|
||||||
alias = "${root}/";
|
alias = "${root}/";
|
||||||
basicAuth.bob = "pwofb";
|
basicAuth.bob = "pwofb";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
webserver.wait_for_unit("nginx")
|
webserver.wait_for_unit("nginx")
|
||||||
webserver.wait_for_open_port(80)
|
webserver.wait_for_open_port(80)
|
||||||
|
|
||||||
webserver.fail("curl --fail --resolve lockedroot:80:127.0.0.1 http://lockedroot")
|
webserver.fail("curl --fail --resolve lockedroot:80:127.0.0.1 http://lockedroot")
|
||||||
webserver.succeed(
|
webserver.succeed(
|
||||||
"curl --fail --resolve lockedroot:80:127.0.0.1 http://alice:pwofa@lockedroot"
|
"curl --fail --resolve lockedroot:80:127.0.0.1 http://alice:pwofa@lockedroot"
|
||||||
)
|
)
|
||||||
|
|
||||||
webserver.succeed("curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir")
|
webserver.succeed("curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir")
|
||||||
webserver.fail(
|
webserver.fail(
|
||||||
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir/sublocation/index.html"
|
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir/sublocation/index.html"
|
||||||
)
|
)
|
||||||
webserver.succeed(
|
webserver.succeed(
|
||||||
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://bob:pwofb@lockedsubdir/sublocation/index.html"
|
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://bob:pwofb@lockedsubdir/sublocation/index.html"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue