@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"
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
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"]
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")
SingleTopoContainerVpp = "vpp"
SingleTopoContainerNginx = "nginx"
TapInterfaceName = "htaphost"
+ NginxHttp3ContainerName = "nginx-http3"
)
var noTopoTests = map[string][]func(s *NoTopoSuite){}
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()
}
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() {
}
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)
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)
worker_processes 2;
daemon off;
+error_log /tmp/nginx/{{.LogPrefix}}-error.log info;
+
events {
use epoll;
accept_mutex off;
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;
+++ /dev/null
-#!/bin/bash
-cd boringssl || exit 1
-cmake -GNinja -B build
-ninja -C build
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)
+++ /dev/null
-#!/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