mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
nixosTests.nginx-http3: move to new structure
This commit is contained in:
@@ -1246,7 +1246,6 @@ in
|
||||
nfs4 = handleTest ./nfs { version = 4; };
|
||||
nghttpx = runTest ./nghttpx.nix;
|
||||
nginx = import ./nginx { inherit lib runTest; };
|
||||
nginx-http3 = import ./nginx-http3.nix { inherit pkgs runTest; };
|
||||
nifi = runTestOn [ "x86_64-linux" ] ./web-apps/nifi.nix;
|
||||
nimdow = runTest ./nimdow.nix;
|
||||
nipap = runTest ./web-apps/nipap.nix;
|
||||
|
||||
@@ -5,6 +5,6 @@ let
|
||||
in
|
||||
recurseIntoAttrs (
|
||||
mapAttrs (const (callTest (builtins.getAttr "angie") "angie")) {
|
||||
inherit (tests) basic;
|
||||
inherit (tests) basic http3;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
{ pkgs, runTest }:
|
||||
let
|
||||
hosts = ''
|
||||
192.168.2.101 acme.test
|
||||
'';
|
||||
|
||||
in
|
||||
builtins.listToAttrs (
|
||||
map
|
||||
(nginxPackage: {
|
||||
name = pkgs.lib.getName nginxPackage;
|
||||
value = runTest {
|
||||
name = "nginx-http3-${pkgs.lib.getName nginxPackage}";
|
||||
meta.maintainers = with pkgs.lib.maintainers; [ izorkin ];
|
||||
|
||||
nodes = {
|
||||
server =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
networking = {
|
||||
interfaces.eth1 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.2.101";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
extraHosts = hosts;
|
||||
firewall.allowedTCPPorts = [ 443 ];
|
||||
firewall.allowedUDPPorts = [ 443 ];
|
||||
};
|
||||
|
||||
security.pki.certificates = [
|
||||
(builtins.readFile ./common/acme/server/ca.cert.pem)
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
package = nginxPackage;
|
||||
|
||||
virtualHosts."acme.test" = {
|
||||
onlySSL = true;
|
||||
sslCertificate = ./common/acme/server/acme.test.cert.pem;
|
||||
sslCertificateKey = ./common/acme/server/acme.test.key.pem;
|
||||
http2 = true;
|
||||
http3 = true;
|
||||
http3_hq = false;
|
||||
quic = true;
|
||||
reuseport = true;
|
||||
root = lib.mkForce (
|
||||
pkgs.runCommandLocal "testdir" { } ''
|
||||
mkdir "$out"
|
||||
cat > "$out/index.html" <<EOF
|
||||
<html><body>Hello World!</body></html>
|
||||
EOF
|
||||
cat > "$out/example.txt" <<EOF
|
||||
Check http3 protocol.
|
||||
EOF
|
||||
''
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
client =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.curl ];
|
||||
networking = {
|
||||
interfaces.eth1 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.2.201";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
extraHosts = hosts;
|
||||
};
|
||||
|
||||
security.pki.certificates = [
|
||||
(builtins.readFile ./common/acme/server/ca.cert.pem)
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("nginx")
|
||||
server.wait_for_open_port(443)
|
||||
|
||||
# Check http connections
|
||||
client.succeed("curl --verbose --http3-only https://acme.test | grep 'Hello World!'")
|
||||
|
||||
# Check downloadings
|
||||
client.succeed("curl --verbose --http3-only https://acme.test/example.txt --output /tmp/example.txt")
|
||||
client.succeed("cat /tmp/example.txt | grep 'Check http3 protocol.'")
|
||||
|
||||
# Check header reading
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test | grep 'content-type'")
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test | grep 'HTTP/3 200'")
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test/error | grep 'HTTP/3 404'")
|
||||
|
||||
# Check change User-Agent
|
||||
client.succeed("curl --verbose --http3-only --user-agent 'Curl test 3.0' https://acme.test")
|
||||
server.succeed("cat /var/log/nginx/access.log | grep 'Curl test 3.0'")
|
||||
|
||||
server.shutdown()
|
||||
client.shutdown()
|
||||
'';
|
||||
};
|
||||
})
|
||||
[
|
||||
pkgs.angie
|
||||
pkgs.nginx
|
||||
]
|
||||
)
|
||||
@@ -18,6 +18,7 @@ let
|
||||
etag = ./etag.nix;
|
||||
etag-compression = ./etag-compression.nix;
|
||||
globalredirect = ./globalredirect.nix;
|
||||
http3 = ./http3.nix;
|
||||
dynamic-modules = ./dynamic-modules.nix;
|
||||
grpc-error-pages = ./grpc-error-pages.nix;
|
||||
lua = ./lua.nix;
|
||||
|
||||
114
nixos/tests/nginx/http3.nix
Normal file
114
nixos/tests/nginx/http3.nix
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
name ? "default",
|
||||
mkPackage ? builtins.getAttr "nginx",
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hosts = ''
|
||||
192.168.2.101 acme.test
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
name = "nginx-http3-${name}";
|
||||
meta.maintainers = with lib.maintainers; [ izorkin ];
|
||||
|
||||
nodes = {
|
||||
server =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
networking = {
|
||||
interfaces.eth1 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.2.101";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
extraHosts = hosts;
|
||||
firewall.allowedTCPPorts = [ 443 ];
|
||||
firewall.allowedUDPPorts = [ 443 ];
|
||||
};
|
||||
|
||||
security.pki.certificates = [
|
||||
(builtins.readFile ../common/acme/server/ca.cert.pem)
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
package = mkPackage pkgs;
|
||||
|
||||
virtualHosts."acme.test" = {
|
||||
onlySSL = true;
|
||||
sslCertificate = ../common/acme/server/acme.test.cert.pem;
|
||||
sslCertificateKey = ../common/acme/server/acme.test.key.pem;
|
||||
http2 = true;
|
||||
http3 = true;
|
||||
http3_hq = false;
|
||||
quic = true;
|
||||
reuseport = true;
|
||||
root = lib.mkForce (
|
||||
pkgs.runCommandLocal "testdir" { } ''
|
||||
mkdir "$out"
|
||||
cat > "$out/index.html" <<EOF
|
||||
<html><body>Hello World!</body></html>
|
||||
EOF
|
||||
cat > "$out/example.txt" <<EOF
|
||||
Check http3 protocol.
|
||||
EOF
|
||||
''
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
client =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.curl ];
|
||||
networking = {
|
||||
interfaces.eth1 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "192.168.2.201";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
extraHosts = hosts;
|
||||
};
|
||||
|
||||
security.pki.certificates = [
|
||||
(builtins.readFile ../common/acme/server/ca.cert.pem)
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("nginx")
|
||||
server.wait_for_open_port(443)
|
||||
|
||||
# Check http connections
|
||||
client.succeed("curl --verbose --http3-only https://acme.test | grep 'Hello World!'")
|
||||
|
||||
# Check downloadings
|
||||
client.succeed("curl --verbose --http3-only https://acme.test/example.txt --output /tmp/example.txt")
|
||||
client.succeed("cat /tmp/example.txt | grep 'Check http3 protocol.'")
|
||||
|
||||
# Check header reading
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test | grep 'content-type'")
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test | grep 'HTTP/3 200'")
|
||||
client.succeed("curl --verbose --http3-only --head https://acme.test/error | grep 'HTTP/3 404'")
|
||||
|
||||
# Check change User-Agent
|
||||
client.succeed("curl --verbose --http3-only --user-agent 'Curl test 3.0' https://acme.test")
|
||||
server.succeed("cat /var/log/nginx/access.log | grep 'Curl test 3.0'")
|
||||
|
||||
server.shutdown()
|
||||
client.shutdown()
|
||||
'';
|
||||
}
|
||||
@@ -5,6 +5,6 @@ let
|
||||
in
|
||||
recurseIntoAttrs (
|
||||
mapAttrs (const (callTest (builtins.getAttr "openresty") "openresty")) {
|
||||
inherit (tests) basic;
|
||||
inherit (tests) basic http3;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -33,7 +33,6 @@ callPackage ../nginx/generic.nix args rec {
|
||||
|
||||
passthru.tests = nixosTests.angie // {
|
||||
angie-api = nixosTests.angie-api;
|
||||
angie-http3 = nixosTests.nginx-http3.angie;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -323,6 +323,7 @@ mkDerivation {
|
||||
etag
|
||||
etag-compression
|
||||
dynamic-modules
|
||||
http3
|
||||
globalredirect
|
||||
grpc-error-pages
|
||||
lua
|
||||
@@ -338,9 +339,6 @@ mkDerivation {
|
||||
tmpdir
|
||||
unix-socket
|
||||
;
|
||||
inherit (nixosTests)
|
||||
nginx-http3
|
||||
;
|
||||
acme-integration = nixosTests.acme.nginx;
|
||||
acme-integration-without-reload = nixosTests.acme.nginx-without-reload;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user