aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/proxy_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/proxy_test.go')
-rw-r--r--extras/hs-test/proxy_test.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go
index cdb516a108b..748e48b0344 100644
--- a/extras/hs-test/proxy_test.go
+++ b/extras/hs-test/proxy_test.go
@@ -9,18 +9,21 @@ import (
func testProxyHttpTcp(s *NsSuite, proto string) error {
const outputFile = "test.data"
- const srcFile = "10M"
+ const srcFile = "httpTestFile"
+ const fileSize = "10M"
stopServer := make(chan struct{}, 1)
serverRunning := make(chan struct{}, 1)
+ serverNetns := "srv"
+ clientNetns := "cln"
// create test file
- err := exechelper.Run(fmt.Sprintf("ip netns exec server truncate -s %s %s", srcFile, srcFile))
+ err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFile))
s.assertNil(err, "failed to run truncate command: " + fmt.Sprint(err))
defer func() { os.Remove(srcFile) }()
s.log("test file created...")
- go s.startHttpServer(serverRunning, stopServer, ":666", "server")
+ go s.startHttpServer(serverRunning, stopServer, ":666", serverNetns)
// TODO better error handling and recovery
<-serverRunning
@@ -31,19 +34,20 @@ func testProxyHttpTcp(s *NsSuite, proto string) error {
s.log("http server started...")
clientVeth := s.netInterfaces[clientInterface]
- c := fmt.Sprintf("ip netns exec client wget --no-proxy --retry-connrefused"+
- " --retry-on-http-error=503 --tries=10 -O %s ", outputFile)
+ c := fmt.Sprintf("ip netns exec %s wget --no-proxy --retry-connrefused"+
+ " --retry-on-http-error=503 --tries=10 -O %s ", clientNetns, outputFile)
if proto == "tls" {
c += " --secure-protocol=TLSv1_3 --no-check-certificate https://"
}
c += fmt.Sprintf("%s:555/%s", clientVeth.ip4AddressString(), srcFile)
s.log(c)
_, err = exechelper.CombinedOutput(c)
- s.assertNil(err, "failed to run wget: '%s', cmd: %s", err, c)
- stopServer <- struct{}{}
defer func() { os.Remove(outputFile) }()
+ s.assertNil(err, "failed to run wget: '%s', cmd: %s", err, c)
+ stopServer <- struct{}{}
+
s.assertNil(assertFileSize(outputFile, srcFile))
return nil
}