From 6e8e1faabeb492f70404c95e33b7d314ae3017e2 Mon Sep 17 00:00:00 2001 From: Izorkin Date: Mon, 18 Apr 2022 13:22:39 +0300 Subject: [PATCH] nixos/tests: add nginx-http3 test --- nixos/tests/all-tests.nix | 1 + nixos/tests/nginx-http3.nix | 90 ++++++++++++++++++++++++++ pkgs/servers/http/nginx/generic.nix | 2 +- pkgs/tools/networking/curl/default.nix | 4 +- 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 nixos/tests/nginx-http3.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 84433806b48..0de71030c4f 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; diff --git a/nixos/tests/nginx-http3.nix b/nixos/tests/nginx-http3.nix new file mode 100644 index 00000000000..edd0759464c --- /dev/null +++ b/nixos/tests/nginx-http3.nix @@ -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" <Hello World! + EOF + cat > "$out/example.txt" <