mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +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; };
|
||||
nghttpx = handleTest ./nghttpx.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-compression = handleTest ./nginx-etag-compression.nix {};
|
||||
nginx-globalredirect = handleTest ./nginx-globalredirect.nix {};
|
||||
|
|
|
@ -1,54 +1,52 @@
|
|||
import ./make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
name = "nginx-auth";
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
name = "nginx-auth";
|
||||
|
||||
nodes = {
|
||||
webserver =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
services.nginx =
|
||||
let
|
||||
root = pkgs.runCommand "testdir" { } ''
|
||||
mkdir "$out"
|
||||
echo hello world > "$out/index.html"
|
||||
'';
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
nodes = {
|
||||
webserver =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
services.nginx =
|
||||
let
|
||||
root = pkgs.runCommand "testdir" { } ''
|
||||
mkdir "$out"
|
||||
echo hello world > "$out/index.html"
|
||||
'';
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
virtualHosts.lockedroot = {
|
||||
inherit root;
|
||||
basicAuth.alice = "pwofa";
|
||||
};
|
||||
virtualHosts.lockedroot = {
|
||||
inherit root;
|
||||
basicAuth.alice = "pwofa";
|
||||
};
|
||||
|
||||
virtualHosts.lockedsubdir = {
|
||||
inherit root;
|
||||
locations."/sublocation/" = {
|
||||
alias = "${root}/";
|
||||
basicAuth.bob = "pwofb";
|
||||
};
|
||||
virtualHosts.lockedsubdir = {
|
||||
inherit root;
|
||||
locations."/sublocation/" = {
|
||||
alias = "${root}/";
|
||||
basicAuth.bob = "pwofb";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
webserver.wait_for_unit("nginx")
|
||||
webserver.wait_for_open_port(80)
|
||||
testScript = ''
|
||||
webserver.wait_for_unit("nginx")
|
||||
webserver.wait_for_open_port(80)
|
||||
|
||||
webserver.fail("curl --fail --resolve lockedroot:80:127.0.0.1 http://lockedroot")
|
||||
webserver.succeed(
|
||||
"curl --fail --resolve lockedroot:80:127.0.0.1 http://alice:pwofa@lockedroot"
|
||||
)
|
||||
webserver.fail("curl --fail --resolve lockedroot:80:127.0.0.1 http://lockedroot")
|
||||
webserver.succeed(
|
||||
"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.fail(
|
||||
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir/sublocation/index.html"
|
||||
)
|
||||
webserver.succeed(
|
||||
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://bob:pwofb@lockedsubdir/sublocation/index.html"
|
||||
)
|
||||
'';
|
||||
}
|
||||
)
|
||||
webserver.succeed("curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir")
|
||||
webserver.fail(
|
||||
"curl --fail --resolve lockedsubdir:80:127.0.0.1 http://lockedsubdir/sublocation/index.html"
|
||||
)
|
||||
webserver.succeed(
|
||||
"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