nixos/tests: add nginx-http3 test
This commit is contained in:
parent
88d05579ad
commit
6e8e1faabe
4 changed files with 95 additions and 2 deletions
|
@ -365,6 +365,7 @@ in
|
|||
nginx = handleTest ./nginx.nix {};
|
||||
nginx-auth = handleTest ./nginx-auth.nix {};
|
||||
nginx-etag = handleTest ./nginx-etag.nix {};
|
||||
nginx-http3 = handleTest ./nginx-http3.nix {};
|
||||
nginx-modsecurity = handleTest ./nginx-modsecurity.nix {};
|
||||
nginx-pubhtml = handleTest ./nginx-pubhtml.nix {};
|
||||
nginx-sandbox = handleTestOn ["x86_64-linux"] ./nginx-sandbox.nix {};
|
||||
|
|
90
nixos/tests/nginx-http3.nix
Normal file
90
nixos/tests/nginx-http3.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
import ./make-test-python.nix ({lib, pkgs, ...}:
|
||||
let
|
||||
hosts = ''
|
||||
192.168.2.101 acme.test
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
name = "nginx-http3";
|
||||
meta.maintainers = with pkgs.lib.maintainers; [ izorkin ];
|
||||
|
||||
nodes = {
|
||||
server = { 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 = pkgs.nginxQuic;
|
||||
|
||||
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;
|
||||
reuseport = true;
|
||||
root = lib.mkForce (pkgs.runCommandLocal "testdir2" {} ''
|
||||
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.curlHTTP3 ];
|
||||
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()
|
||||
|
||||
# Check http connections
|
||||
client.succeed("curl --verbose --http3 https://acme.test | grep 'Hello World!'")
|
||||
|
||||
# Check downloadings
|
||||
client.succeed("curl --verbose --http3 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 --head https://acme.test | grep 'content-type'")
|
||||
|
||||
# Check change User-Agent
|
||||
client.succeed("curl --verbose --http3 --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()
|
||||
'';
|
||||
})
|
|
@ -165,7 +165,7 @@ stdenv.mkDerivation {
|
|||
passthru = {
|
||||
modules = modules;
|
||||
tests = {
|
||||
inherit (nixosTests) nginx nginx-auth nginx-etag nginx-pubhtml nginx-sandbox nginx-sso;
|
||||
inherit (nixosTests) nginx nginx-auth nginx-etag nginx-http3 nginx-pubhtml nginx-sandbox nginx-sso;
|
||||
variants = lib.recurseIntoAttrs nixosTests.nginx-variants;
|
||||
acme-integration = nixosTests.acme;
|
||||
} // passthru.tests;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchurl, pkg-config, perl
|
||||
{ lib, stdenv, fetchurl, pkg-config, perl, nixosTests
|
||||
, brotliSupport ? false, brotli ? null
|
||||
, c-aresSupport ? false, c-ares ? null
|
||||
, gnutlsSupport ? false, gnutls ? null
|
||||
|
@ -177,6 +177,8 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
passthru = {
|
||||
# Additional checking with support http3 protocol.
|
||||
tests.nginx-http3 = nixosTests.nginx-http3;
|
||||
inherit opensslSupport openssl;
|
||||
tests = {
|
||||
inherit curlpp coeurl;
|
||||
|
|
Loading…
Reference in a new issue