Merge pull request #169105 from Izorkin/init-tests-curl

nixos/tests: nginx-http3 test

authored by Rick van Schijndel and committed by GitHub cfa64355 10510dcf

+95 -2
+1
nixos/tests/all-tests.nix
··· 365 nginx = handleTest ./nginx.nix {}; 366 nginx-auth = handleTest ./nginx-auth.nix {}; 367 nginx-etag = handleTest ./nginx-etag.nix {}; 368 nginx-modsecurity = handleTest ./nginx-modsecurity.nix {}; 369 nginx-pubhtml = handleTest ./nginx-pubhtml.nix {}; 370 nginx-sandbox = handleTestOn ["x86_64-linux"] ./nginx-sandbox.nix {};
··· 365 nginx = handleTest ./nginx.nix {}; 366 nginx-auth = handleTest ./nginx-auth.nix {}; 367 nginx-etag = handleTest ./nginx-etag.nix {}; 368 + nginx-http3 = handleTest ./nginx-http3.nix {}; 369 nginx-modsecurity = handleTest ./nginx-modsecurity.nix {}; 370 nginx-pubhtml = handleTest ./nginx-pubhtml.nix {}; 371 nginx-sandbox = handleTestOn ["x86_64-linux"] ./nginx-sandbox.nix {};
+90
nixos/tests/nginx-http3.nix
···
··· 1 + import ./make-test-python.nix ({lib, pkgs, ...}: 2 + let 3 + hosts = '' 4 + 192.168.2.101 acme.test 5 + ''; 6 + 7 + in 8 + { 9 + name = "nginx-http3"; 10 + meta.maintainers = with pkgs.lib.maintainers; [ izorkin ]; 11 + 12 + nodes = { 13 + server = { pkgs, ... }: { 14 + networking = { 15 + interfaces.eth1 = { 16 + ipv4.addresses = [ 17 + { address = "192.168.2.101"; prefixLength = 24; } 18 + ]; 19 + }; 20 + extraHosts = hosts; 21 + firewall.allowedTCPPorts = [ 443 ]; 22 + firewall.allowedUDPPorts = [ 443 ]; 23 + }; 24 + 25 + security.pki.certificates = [ 26 + (builtins.readFile ./common/acme/server/ca.cert.pem) 27 + ]; 28 + 29 + services.nginx = { 30 + enable = true; 31 + package = pkgs.nginxQuic; 32 + 33 + virtualHosts."acme.test" = { 34 + onlySSL = true; 35 + sslCertificate = ./common/acme/server/acme.test.cert.pem; 36 + sslCertificateKey = ./common/acme/server/acme.test.key.pem; 37 + http2 = true; 38 + http3 = true; 39 + reuseport = true; 40 + root = lib.mkForce (pkgs.runCommandLocal "testdir2" {} '' 41 + mkdir "$out" 42 + cat > "$out/index.html" <<EOF 43 + <html><body>Hello World!</body></html> 44 + EOF 45 + cat > "$out/example.txt" <<EOF 46 + Check http3 protocol. 47 + EOF 48 + ''); 49 + }; 50 + }; 51 + }; 52 + 53 + client = { pkgs, ... }: { 54 + environment.systemPackages = [ pkgs.curlHTTP3 ]; 55 + networking = { 56 + interfaces.eth1 = { 57 + ipv4.addresses = [ 58 + { address = "192.168.2.201"; prefixLength = 24; } 59 + ]; 60 + }; 61 + extraHosts = hosts; 62 + }; 63 + 64 + security.pki.certificates = [ 65 + (builtins.readFile ./common/acme/server/ca.cert.pem) 66 + ]; 67 + }; 68 + }; 69 + 70 + testScript = '' 71 + start_all() 72 + 73 + # Check http connections 74 + client.succeed("curl --verbose --http3 https://acme.test | grep 'Hello World!'") 75 + 76 + # Check downloadings 77 + client.succeed("curl --verbose --http3 https://acme.test/example.txt --output /tmp/example.txt") 78 + client.succeed("cat /tmp/example.txt | grep 'Check http3 protocol.'") 79 + 80 + # Check header reading 81 + client.succeed("curl --verbose --http3 --head https://acme.test | grep 'content-type'") 82 + 83 + # Check change User-Agent 84 + client.succeed("curl --verbose --http3 --user-agent 'Curl test 3.0' https://acme.test") 85 + server.succeed("cat /var/log/nginx/access.log | grep 'Curl test 3.0'") 86 + 87 + server.shutdown() 88 + client.shutdown() 89 + ''; 90 + })
+1 -1
pkgs/servers/http/nginx/generic.nix
··· 165 passthru = { 166 modules = modules; 167 tests = { 168 - inherit (nixosTests) nginx nginx-auth nginx-etag nginx-pubhtml nginx-sandbox nginx-sso; 169 variants = lib.recurseIntoAttrs nixosTests.nginx-variants; 170 acme-integration = nixosTests.acme; 171 } // passthru.tests;
··· 165 passthru = { 166 modules = modules; 167 tests = { 168 + inherit (nixosTests) nginx nginx-auth nginx-etag nginx-http3 nginx-pubhtml nginx-sandbox nginx-sso; 169 variants = lib.recurseIntoAttrs nixosTests.nginx-variants; 170 acme-integration = nixosTests.acme; 171 } // passthru.tests;
+3 -1
pkgs/tools/networking/curl/default.nix
··· 1 - { lib, stdenv, fetchurl, pkg-config, perl 2 , brotliSupport ? false, brotli ? null 3 , c-aresSupport ? false, c-ares ? null 4 , gnutlsSupport ? false, gnutls ? null ··· 177 ''; 178 179 passthru = { 180 inherit opensslSupport openssl; 181 tests = { 182 inherit curlpp coeurl;
··· 1 + { lib, stdenv, fetchurl, pkg-config, perl, nixosTests 2 , brotliSupport ? false, brotli ? null 3 , c-aresSupport ? false, c-ares ? null 4 , gnutlsSupport ? false, gnutls ? null ··· 177 ''; 178 179 passthru = { 180 + # Additional checking with support http3 protocol. 181 + tests.nginx-http3 = nixosTests.nginx-http3; 182 inherit opensslSupport openssl; 183 tests = { 184 inherit curlpp coeurl;