hs-test: upload via proxy tests
Type: test Change-Id: Id6b4e2348735081c827f814a814c976b601432ec Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
6e129e3a45
commit
5b175eca2d
@ -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
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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()
|
||||
|
@ -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';
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user