hs-test: use nginx 1.26.2 for NginxHttp3Test 37/41637/3
authorAdrian Villin <[email protected]>
Wed, 2 Oct 2024 13:07:40 +0000 (15:07 +0200)
committerFlorin Coras <[email protected]>
Thu, 3 Oct 2024 04:56:10 +0000 (04:56 +0000)
- test is no longer marked as extended
- no building required -> removed nginx build scripts

Type: test

Change-Id: I1814b1e4b7e514f81797efa3b5c1e818d2fe4cda
Signed-off-by: Adrian Villin <[email protected]>
extras/hs-test/Makefile
extras/hs-test/docker/Dockerfile.nginx-http3
extras/hs-test/infra/hst_suite.go
extras/hs-test/infra/suite_no_topo.go
extras/hs-test/nginx_test.go
extras/hs-test/resources/nginx/nginx_http3.conf
extras/hs-test/script/build_boringssl.sh [deleted file]
extras/hs-test/script/build_hst.sh
extras/hs-test/script/build_nginx.sh [deleted file]

index b72aca1..c55ac5c 100644 (file)
@@ -74,7 +74,6 @@ help:
        @echo
        @echo "'make build' arguments:"
        @echo " UBUNTU_VERSION           - ubuntu version for docker image"
-       @echo " HST_EXTENDED_TESTS       - build extended tests"
        @echo
        @echo "'make test' arguments:"
        @echo " PERSIST=[true|false]     - whether clean up topology and dockers after test"
index 8b2f840..fc90537 100644 (file)
@@ -3,16 +3,16 @@ ARG UBUNTU_VERSION
 FROM ubuntu:${UBUNTU_VERSION}
 
 RUN apt-get update \
- && apt-get install -y gcc git make autoconf libtool pkg-config cmake ninja-build golang \
- && rm -rf /var/lib/apt/lists/*
+ && apt-get install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring libunwind-dev
+RUN curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
+| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
+RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
+ http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
+ | tee /etc/apt/sources.list.d/nginx.list
+RUN bash -c 'echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
+| tee /etc/apt/preferences.d/99nginx'
 
-COPY script/build_boringssl.sh /build_boringssl.sh
-RUN git clone https://boringssl.googlesource.com/boringssl
-RUN ./build_boringssl.sh
-
-COPY script/build_nginx.sh /build_nginx.sh
-RUN git clone https://github.com/nginx/nginx
-RUN ./build_nginx.sh
+RUN apt update && apt install -y nginx=1.26.2-1~jammy
 
 COPY vpp-data/lib/* /usr/lib/
 COPY resources/nginx/vcl.conf /vcl.conf
@@ -27,4 +27,4 @@ ENV LDP_DEBUG=0
 ENV VCL_DEBUG=0
 ENV LDP_SID_BIT=8
 
-ENTRYPOINT ["nginx_ldp.sh", "/usr/local/nginx/sbin/nginx", "-c", "/nginx.conf"]
+ENTRYPOINT ["nginx_ldp.sh", "nginx", "-c", "/nginx.conf"]
index 234a840..07c0d93 100644 (file)
@@ -338,20 +338,6 @@ func (s *HstSuite) SkipIfNotEnoughAvailableCpus() bool {
        return true
 }
 
-func (s *HstSuite) SkipUnlessExtendedTestsBuilt() {
-       imageName := "hs-test/nginx-http3"
-
-       cmd := exec.Command("docker", "images", imageName)
-       byteOutput, err := cmd.CombinedOutput()
-       if err != nil {
-               s.Log("error while searching for docker image")
-               return
-       }
-       if !strings.Contains(string(byteOutput), imageName) {
-               s.Skip("extended tests not built")
-       }
-}
-
 func (s *HstSuite) SkipUnlessLeakCheck() {
        if !*IsLeakCheck {
                s.Skip("leak-check tests excluded")
index 9b4998a..a4abf40 100644 (file)
@@ -12,6 +12,7 @@ const (
        SingleTopoContainerVpp   = "vpp"
        SingleTopoContainerNginx = "nginx"
        TapInterfaceName         = "htaphost"
+       NginxHttp3ContainerName  = "nginx-http3"
 )
 
 var noTopoTests = map[string][]func(s *NoTopoSuite){}
@@ -60,6 +61,13 @@ func (s *NoTopoSuite) SetupTest() {
        s.AssertNil(vpp.createTap(tapInterface), "failed to create tap interface")
 }
 
+func (s *NoTopoSuite) TearDownTest() {
+       if CurrentSpecReport().Failed() {
+               s.CollectNginxLogs(NginxHttp3ContainerName)
+       }
+       s.HstSuite.TearDownTest()
+}
+
 func (s *NoTopoSuite) VppAddr() string {
        return s.GetInterfaceByName(TapInterfaceName).Peer.Ip4AddressString()
 }
@@ -72,6 +80,19 @@ func (s *NoTopoSuite) HostAddr() string {
        return s.GetInterfaceByName(TapInterfaceName).Ip4AddressString()
 }
 
+func (s *NoTopoSuite) CreateNginxConfig(container *Container) {
+       nginxSettings := struct {
+               LogPrefix string
+       }{
+               LogPrefix: container.Name,
+       }
+       container.CreateConfig(
+               "/nginx.conf",
+               "./resources/nginx/nginx_http3.conf",
+               nginxSettings,
+       )
+}
+
 var _ = Describe("NoTopoSuite", Ordered, ContinueOnFailure, func() {
        var s NoTopoSuite
        BeforeAll(func() {
index 8bf681d..07faf2a 100644 (file)
@@ -15,11 +15,11 @@ func init() {
 }
 
 func NginxHttp3Test(s *NoTopoSuite) {
-       s.SkipUnlessExtendedTestsBuilt()
-
        query := "index.html"
-       nginxCont := s.GetContainerByName("nginx-http3")
-       nginxCont.Run()
+       nginxCont := s.GetContainerByName(NginxHttp3ContainerName)
+       nginxCont.Create()
+       s.CreateNginxConfig(nginxCont)
+       nginxCont.Start()
 
        vpp := s.GetContainerByName("vpp").VppInstance
        vpp.WaitForApp("nginx-", 5)
@@ -30,11 +30,14 @@ func NginxHttp3Test(s *NoTopoSuite) {
        args := fmt.Sprintf("curl --noproxy '*' --local-port 55444 --http3-only -k https://%s:8443/%s", serverAddress, query)
        curlCont.ExtraRunningArgs = args
        curlCont.Run()
-       o, err := curlCont.GetOutput()
-       s.Log(o)
-       s.AssertEmpty(err)
-       s.AssertContains(o, "<http>", "<http> not found in the result!")
+       body, stats := curlCont.GetOutput()
+       s.Log(body)
+       s.Log(stats)
+       s.AssertNotContains(stats, "refused")
+       s.AssertContains(stats, "100")
+       s.AssertContains(body, "<http>", "<http> not found in the result!")
 }
+
 func NginxAsServerTest(s *NoTopoSuite) {
        query := "return_ok"
        finished := make(chan error, 1)
index 2a01f71..e048b17 100644 (file)
@@ -2,6 +2,8 @@ master_process on;
 worker_processes 2;
 daemon off;
 
+error_log /tmp/nginx/{{.LogPrefix}}-error.log info;
+
 events {
    use epoll;
    accept_mutex       off;
@@ -12,12 +14,11 @@ http {
   quic_gso on;
   quic_retry on;
 
-  access_log logs/access.log;
+  access_log /tmp/nginx/{{.LogPrefix}}-access.log;
   keepalive_timeout 300s;
   sendfile on;
   server {
     listen 0.0.0.0:8443 quic;
-    #listen 0.0.0.0:8443 ssl;
     root /usr/share/nginx;
     ssl_certificate     /etc/nginx/ssl/localhost.crt;
     ssl_certificate_key /etc/nginx/ssl/localhost.key;
diff --git a/extras/hs-test/script/build_boringssl.sh b/extras/hs-test/script/build_boringssl.sh
deleted file mode 100755 (executable)
index cca4e4a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-cd boringssl || exit 1
-cmake -GNinja -B build
-ninja -C build
index 9b11f5f..861eca5 100755 (executable)
@@ -85,9 +85,7 @@ docker_build hs-test/vpp vpp
 docker_build hs-test/nginx-ldp nginx
 docker_build hs-test/nginx-server nginx-server
 docker_build hs-test/curl curl
-if [ "$HST_EXTENDED_TESTS" = true ] ; then
-    docker_build hs-test/nginx-http3 nginx-http3
-fi
+docker_build hs-test/nginx-http3 nginx-http3
 
 # cleanup detached images
 images=$(docker images --filter "dangling=true" -q --no-trunc)
diff --git a/extras/hs-test/script/build_nginx.sh b/extras/hs-test/script/build_nginx.sh
deleted file mode 100755 (executable)
index f21201c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-cd nginx || exit 1
-./auto/configure --with-debug --with-http_v3_module --with-cc-opt="-I../boringssl/include" --with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto" --without-http_rewrite_module --without-http_gzip_module
-make
-make install