diff options
author | adrianvillin <avillin@cisco.com> | 2024-02-13 06:00:02 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-03-12 16:48:46 +0000 |
commit | 28bd8f07d33bdd70c2cac03b70911a9069e4bd50 (patch) | |
tree | 102bab11aa225339995a4dd07ea8332d1fce2212 /extras/hs-test/proxy_test.go | |
parent | 7a2961523ef6d58d718a9efb7809a212bb0b58b1 (diff) |
hs-test: experimental support for multiple test instances
- appending PID to interface and container names
- added a check for used IP addresses
- TestEnvoyProxyHttpTcp and TestTcpWithLoss are broken when running multiple instances
Type: test
Change-Id: Ib917079ec7cf851dee59ff9c67e74f48c7c5e3c6
Signed-off-by: adrianvillin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/proxy_test.go')
-rw-r--r-- | extras/hs-test/proxy_test.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index 748e48b0344..c2f9b6f2825 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -8,18 +8,19 @@ import ( ) func testProxyHttpTcp(s *NsSuite, proto string) error { - const outputFile = "test.data" - const srcFile = "httpTestFile" - const fileSize = "10M" + var outputFile string = "test" + s.pid + ".data" + var srcFilePid string = "httpTestFile" + s.pid + const srcFileNoPid = "httpTestFile" + const fileSize string = "10M" stopServer := make(chan struct{}, 1) serverRunning := make(chan struct{}, 1) - serverNetns := "srv" - clientNetns := "cln" + serverNetns := s.getNetNamespaceByName("srv") + clientNetns := s.getNetNamespaceByName("cln") // create test file - err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFile)) + err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFilePid)) s.assertNil(err, "failed to run truncate command: " + fmt.Sprint(err)) - defer func() { os.Remove(srcFile) }() + defer func() { os.Remove(srcFilePid) }() s.log("test file created...") @@ -33,13 +34,13 @@ func testProxyHttpTcp(s *NsSuite, proto string) error { s.log("http server started...") - clientVeth := s.netInterfaces[clientInterface] + clientVeth := s.getInterfaceByName(clientInterface) 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) + c += fmt.Sprintf("%s:555/%s", clientVeth.ip4AddressString(), srcFileNoPid) s.log(c) _, err = exechelper.CombinedOutput(c) @@ -48,13 +49,13 @@ func testProxyHttpTcp(s *NsSuite, proto string) error { s.assertNil(err, "failed to run wget: '%s', cmd: %s", err, c) stopServer <- struct{}{} - s.assertNil(assertFileSize(outputFile, srcFile)) + s.assertNil(assertFileSize(outputFile, srcFilePid)) return nil } func configureVppProxy(s *NsSuite, proto string) { - serverVeth := s.netInterfaces[serverInterface] - clientVeth := s.netInterfaces[clientInterface] + serverVeth := s.getInterfaceByName(serverInterface) + clientVeth := s.getInterfaceByName(clientInterface) testVppProxy := s.getContainerByName("vpp").vppInstance output := testVppProxy.vppctl( @@ -85,7 +86,7 @@ func configureEnvoyProxy(s *NsSuite) { err := envoyContainer.create() s.assertNil(err, "Error creating envoy container: %s", err) - serverVeth := s.netInterfaces[serverInterface] + serverVeth := s.getInterfaceByName(serverInterface) address := struct { Server string }{ |