diff options
Diffstat (limited to 'extras')
-rw-r--r-- | extras/hs-test/docker/Dockerfile.curl | 1 | ||||
-rw-r--r-- | extras/hs-test/docker/Dockerfile.nginx-server | 1 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_envoy_proxy.go | 6 | ||||
-rw-r--r-- | extras/hs-test/infra/suite_vpp_proxy.go | 22 | ||||
-rw-r--r-- | extras/hs-test/proxy_test.go | 29 | ||||
-rw-r--r-- | extras/hs-test/resources/nginx/nginx_server.conf | 8 | ||||
-rw-r--r-- | extras/hs-test/topo-containers/envoyProxy.yaml | 10 | ||||
-rw-r--r-- | extras/hs-test/topo-containers/vppProxy.yaml | 9 |
8 files changed, 69 insertions, 17 deletions
diff --git a/extras/hs-test/docker/Dockerfile.curl b/extras/hs-test/docker/Dockerfile.curl index 90f415f2990..fe9b4d917c7 100644 --- a/extras/hs-test/docker/Dockerfile.curl +++ b/extras/hs-test/docker/Dockerfile.curl @@ -7,6 +7,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY script/build_curl.sh /build_curl.sh +RUN fallocate -l 10MB /tmp/testFile RUN apt-get update && apt-get install wget RUN /build_curl.sh diff --git a/extras/hs-test/docker/Dockerfile.nginx-server b/extras/hs-test/docker/Dockerfile.nginx-server index 08f428d6a4b..ecb8f590f89 100644 --- a/extras/hs-test/docker/Dockerfile.nginx-server +++ b/extras/hs-test/docker/Dockerfile.nginx-server @@ -11,5 +11,6 @@ COPY script/nginx_server_entrypoint.sh /usr/bin/nginx_server_entrypoint.sh COPY resources/nginx/html/index.html /usr/share/nginx/index.html RUN fallocate -l 10MB /usr/share/nginx/httpTestFile +RUN mkdir /usr/share/nginx/upload && chmod 777 /usr/share/nginx/upload ENTRYPOINT ["nginx_server_entrypoint.sh"] diff --git a/extras/hs-test/infra/suite_envoy_proxy.go b/extras/hs-test/infra/suite_envoy_proxy.go index e1bfae293a2..52f94bc76aa 100644 --- a/extras/hs-test/infra/suite_envoy_proxy.go +++ b/extras/hs-test/infra/suite_envoy_proxy.go @@ -136,6 +136,12 @@ func (s *EnvoyProxySuite) CurlDownloadResource(uri string) { s.AssertContains(log, "HTTP/1.1 200") } +func (s *EnvoyProxySuite) CurlUploadResource(uri, file string) { + args := fmt.Sprintf("--insecure --noproxy '*' -T %s %s", file, uri) + _, log := s.RunCurlContainer(args) + s.AssertContains(log, "HTTP/1.1 201") +} + var _ = Describe("EnvoyProxySuite", Ordered, ContinueOnFailure, func() { var s EnvoyProxySuite BeforeAll(func() { diff --git a/extras/hs-test/infra/suite_vpp_proxy.go b/extras/hs-test/infra/suite_vpp_proxy.go index 94bd0f9aa4e..a13897eb8d0 100644 --- a/extras/hs-test/infra/suite_vpp_proxy.go +++ b/extras/hs-test/infra/suite_vpp_proxy.go @@ -18,6 +18,7 @@ const ( VppProxyContainerName = "vpp-proxy" ClientTapInterfaceName = "hstcln" ServerTapInterfaceName = "hstsrv" + CurlContainerTestFile = "/tmp/testFile" ) type VppProxySuite struct { @@ -102,7 +103,7 @@ func (s *VppProxySuite) CurlRequest(targetUri string) (string, string) { } func (s *VppProxySuite) CurlRequestViaTunnel(targetUri string, proxyUri string) (string, string) { - args := fmt.Sprintf("--insecure -p -x %s %s", proxyUri, targetUri) + args := fmt.Sprintf("--max-time 60 --insecure -p -x %s %s", proxyUri, targetUri) body, log := s.RunCurlContainer(args) return body, log } @@ -114,11 +115,28 @@ func (s *VppProxySuite) CurlDownloadResource(uri string) { s.AssertContains(log, "HTTP/1.1 200") } +func (s *VppProxySuite) CurlUploadResource(uri, file string) { + args := fmt.Sprintf("--insecure --noproxy '*' -T %s %s", file, uri) + _, log := s.RunCurlContainer(args) + s.AssertContains(log, "HTTP/1.1 201") +} + func (s *VppProxySuite) CurlDownloadResourceViaTunnel(uri string, proxyUri string) { - args := fmt.Sprintf("--insecure -p -x %s --remote-name --output-dir /tmp %s", proxyUri, uri) + args := fmt.Sprintf("--max-time 180 --insecure -p -x %s --remote-name --output-dir /tmp %s", proxyUri, uri) _, log := s.RunCurlContainer(args) s.AssertNotContains(log, "Recv failure") + s.AssertNotContains(log, "Operation timed out") + s.AssertContains(log, "CONNECT tunnel established") s.AssertContains(log, "HTTP/1.1 200") + s.AssertNotContains(log, "bytes remaining to read") +} + +func (s *VppProxySuite) CurlUploadResourceViaTunnel(uri, proxyUri, file string) { + args := fmt.Sprintf("--max-time 180 --insecure -p -x %s -T %s %s", proxyUri, file, uri) + _, log := s.RunCurlContainer(args) + s.AssertNotContains(log, "Operation timed out") + s.AssertContains(log, "CONNECT tunnel established") + s.AssertContains(log, "HTTP/1.1 201") } var _ = Describe("VppProxySuite", Ordered, ContinueOnFailure, func() { diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index 167cf25fa52..7ec97c76c02 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -6,8 +6,8 @@ import ( ) func init() { - RegisterVppProxyTests(VppProxyHttpTcpTest, VppProxyHttpTlsTest) - RegisterEnvoyProxyTests(EnvoyProxyHttpTcpTest) + RegisterVppProxyTests(VppProxyHttpGetTcpTest, VppProxyHttpGetTlsTest, VppProxyHttpPutTcpTest, VppProxyHttpPutTlsTest) + RegisterEnvoyProxyTests(EnvoyProxyHttpGetTcpTest, EnvoyProxyHttpPutTcpTest) RegisterNginxProxyTests(NginxMirroringTest) } @@ -24,25 +24,44 @@ func configureVppProxy(s *VppProxySuite, proto string, proxyPort uint16) { s.Log("proxy configured: " + output) } -func VppProxyHttpTcpTest(s *VppProxySuite) { +func VppProxyHttpGetTcpTest(s *VppProxySuite) { var proxyPort uint16 = 8080 configureVppProxy(s, "tcp", proxyPort) uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.VppProxyAddr(), proxyPort) s.CurlDownloadResource(uri) } -func VppProxyHttpTlsTest(s *VppProxySuite) { +func VppProxyHttpGetTlsTest(s *VppProxySuite) { var proxyPort uint16 = 8080 configureVppProxy(s, "tls", proxyPort) uri := fmt.Sprintf("https://%s:%d/httpTestFile", s.VppProxyAddr(), proxyPort) s.CurlDownloadResource(uri) } -func EnvoyProxyHttpTcpTest(s *EnvoyProxySuite) { +func VppProxyHttpPutTcpTest(s *VppProxySuite) { + var proxyPort uint16 = 8080 + configureVppProxy(s, "tcp", proxyPort) + uri := fmt.Sprintf("http://%s:%d/upload/testFile", s.VppProxyAddr(), proxyPort) + s.CurlUploadResource(uri, CurlContainerTestFile) +} + +func VppProxyHttpPutTlsTest(s *VppProxySuite) { + var proxyPort uint16 = 8080 + configureVppProxy(s, "tls", proxyPort) + uri := fmt.Sprintf("https://%s:%d/upload/testFile", s.VppProxyAddr(), proxyPort) + s.CurlUploadResource(uri, CurlContainerTestFile) +} + +func EnvoyProxyHttpGetTcpTest(s *EnvoyProxySuite) { uri := fmt.Sprintf("http://%s:%d/httpTestFile", s.ProxyAddr(), s.ProxyPort()) s.CurlDownloadResource(uri) } +func EnvoyProxyHttpPutTcpTest(s *EnvoyProxySuite) { + uri := fmt.Sprintf("http://%s:%d/upload/testFile", s.ProxyAddr(), s.ProxyPort()) + s.CurlUploadResource(uri, CurlContainerTestFile) +} + // broken when CPUS > 1 func NginxMirroringTest(s *NginxProxySuite) { s.SkipIfMultiWorker() diff --git a/extras/hs-test/resources/nginx/nginx_server.conf b/extras/hs-test/resources/nginx/nginx_server.conf index 80ea602e3a1..62d27cbbc65 100644 --- a/extras/hs-test/resources/nginx/nginx_server.conf +++ b/extras/hs-test/resources/nginx/nginx_server.conf @@ -22,6 +22,14 @@ http { server_name {{.Address}}; root /usr/share/nginx; index index.html index.htm; + location ~ "/upload/([0-9a-zA-Z-.]*)$" { + alias /usr/share/nginx/upload/$1; + client_body_temp_path /tmp; + client_max_body_size 200M; + dav_methods PUT; + create_full_put_path off; + dav_access all:rw; + } location /64B { return 200 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; } diff --git a/extras/hs-test/topo-containers/envoyProxy.yaml b/extras/hs-test/topo-containers/envoyProxy.yaml index 49808076f88..92dd9b93c47 100644 --- a/extras/hs-test/topo-containers/envoyProxy.yaml +++ b/extras/hs-test/topo-containers/envoyProxy.yaml @@ -1,17 +1,17 @@ --- volumes: - - volume: &shared-vol-envoy-proxy - host-dir: "$HST_VOLUME_DIR/shared-vol-envoy-proxy" + - volume: &shared-vol + host-dir: "$HST_VOLUME_DIR/shared-vol" containers: - name: "vpp" volumes: - - <<: *shared-vol-envoy-proxy + - <<: *shared-vol container-dir: "/tmp/vpp" is-default-work-dir: true - name: "envoy-vcl" volumes: - - <<: *shared-vol-envoy-proxy + - <<: *shared-vol container-dir: "/tmp/vpp-envoy" is-default-work-dir: true - host-dir: "$HST_DIR/resources/envoy" @@ -26,7 +26,7 @@ containers: is-optional: true - name: "nginx-server" volumes: - - <<: *shared-vol-envoy-proxy + - <<: *shared-vol container-dir: "/tmp/nginx" is-default-work-dir: true image: "hs-test/nginx-server" diff --git a/extras/hs-test/topo-containers/vppProxy.yaml b/extras/hs-test/topo-containers/vppProxy.yaml index c4bbbe9d528..a1f24bbc187 100644 --- a/extras/hs-test/topo-containers/vppProxy.yaml +++ b/extras/hs-test/topo-containers/vppProxy.yaml @@ -1,17 +1,17 @@ --- volumes: - - volume: &shared-vol-vpp-proxy - host-dir: "$HST_VOLUME_DIR/shared-vol-vpp-proxy" + - volume: &shared-vol + host-dir: "$HST_VOLUME_DIR/shared-vol" containers: - name: "vpp-proxy" volumes: - - <<: *shared-vol-vpp-proxy + - <<: *shared-vol container-dir: "/tmp/vpp" is-default-work-dir: true - name: "nginx-server" volumes: - - <<: *shared-vol-vpp-proxy + - <<: *shared-vol container-dir: "/tmp/nginx" is-default-work-dir: true image: "hs-test/nginx-server" @@ -23,4 +23,3 @@ containers: image: "hs-test/curl" is-optional: true run-detached: false - |