aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/proxy_test.go
diff options
context:
space:
mode:
authoradrianvillin <avillin@cisco.com>2024-02-13 03:26:25 -0500
committerFlorin Coras <florin.coras@gmail.com>2024-02-15 18:35:34 +0000
commitfbf5f2b0300c654be5d1962bc207c87f49930faf (patch)
treee7c08314ecfe7af4ff15b0bf9794396bec3f96bc /extras/hs-test/proxy_test.go
parent0ded4890beaa3aa1f36c61ff6125d19582b25391 (diff)
hs-test: shortened interface names to avoid character limit
Type: test Change-Id: I09df597ccb8a3c4af47b8a36010afb81df533236 Signed-off-by: adrianvillin <avillin@cisco.com>
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
}