diff options
Diffstat (limited to 'extras/hs-test')
-rw-r--r-- | extras/hs-test/Makefile | 1 | ||||
-rw-r--r-- | extras/hs-test/docker/Dockerfile.nginx-http3 | 20 | ||||
-rw-r--r-- | extras/hs-test/infra/hst_suite.go | 14 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_no_topo.go | 21 | ||||
-rw-r--r-- | extras/hs-test/nginx_test.go | 19 | ||||
-rw-r--r-- | extras/hs-test/resources/nginx/nginx_http3.conf | 5 | ||||
-rwxr-xr-x | extras/hs-test/script/build_boringssl.sh | 4 | ||||
-rwxr-xr-x | extras/hs-test/script/build_hst.sh | 4 | ||||
-rwxr-xr-x | extras/hs-test/script/build_nginx.sh | 5 |
9 files changed, 46 insertions, 47 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile index b72aca1d7dd..c55ac5c62a1 100644 --- a/extras/hs-test/Makefile +++ b/extras/hs-test/Makefile @@ -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" diff --git a/extras/hs-test/docker/Dockerfile.nginx-http3 b/extras/hs-test/docker/Dockerfile.nginx-http3 index 8b2f8406d38..fc905376986 100644 --- a/extras/hs-test/docker/Dockerfile.nginx-http3 +++ b/extras/hs-test/docker/Dockerfile.nginx-http3 @@ -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"] diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go index 234a8409ea0..07c0d935e04 100644 --- a/extras/hs-test/infra/hst_suite.go +++ b/extras/hs-test/infra/hst_suite.go @@ -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") diff --git a/extras/hs-test/infra/suite_no_topo.go b/extras/hs-test/infra/suite_no_topo.go index 9b4998a77a1..a4abf40d07a 100644 --- a/extras/hs-test/infra/suite_no_topo.go +++ b/extras/hs-test/infra/suite_no_topo.go @@ -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() { diff --git a/extras/hs-test/nginx_test.go b/extras/hs-test/nginx_test.go index 8bf681d18c6..07faf2a3262 100644 --- a/extras/hs-test/nginx_test.go +++ b/extras/hs-test/nginx_test.go @@ -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) diff --git a/extras/hs-test/resources/nginx/nginx_http3.conf b/extras/hs-test/resources/nginx/nginx_http3.conf index 2a01f714111..e048b17044b 100644 --- a/extras/hs-test/resources/nginx/nginx_http3.conf +++ b/extras/hs-test/resources/nginx/nginx_http3.conf @@ -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 index cca4e4a31d1..00000000000 --- a/extras/hs-test/script/build_boringssl.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -cd boringssl || exit 1 -cmake -GNinja -B build -ninja -C build diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh index 9b11f5f0272..861eca5eb5f 100755 --- a/extras/hs-test/script/build_hst.sh +++ b/extras/hs-test/script/build_hst.sh @@ -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 index f21201c4297..00000000000 --- a/extras/hs-test/script/build_nginx.sh +++ /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 |