diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-09-06 15:30:59 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-09-10 16:35:23 +0000 |
commit | 5b175eca2d6389bfb0c09839436df83cf8df334c (patch) | |
tree | deccee366af3239f0d132f6a58aa8c88004b8ce9 /extras/hs-test/infra/suite_vpp_proxy.go | |
parent | 6e129e3a4522f429fc6cee7f5bde2fde8082af83 (diff) |
hs-test: upload via proxy tests
Type: test
Change-Id: Id6b4e2348735081c827f814a814c976b601432ec
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/suite_vpp_proxy.go')
-rw-r--r-- | extras/hs-test/infra/suite_vpp_proxy.go | 22 |
1 files changed, 20 insertions, 2 deletions
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() { |