From eaa7d91ad77f9c6691b42b0e9f631166b4bcf44f Mon Sep 17 00:00:00 2001 From: Adrian Villin Date: Thu, 6 Jun 2024 04:26:30 -0400 Subject: hs-test: improved suite teardown and replaced PIDs with PPIDs - Fixed an issue where containers wouldn't stop and get removed when a test run is interrupted - Replaced PIDs with Ginkgo process indexes + PPIDs - Fixed CPU allocation for envoy and nginx-ldp containers - All container logs should now get saved properly Type: test Change-Id: I4c737c1d326390494c0dda1ec6d3fc1f04f51663 Signed-off-by: Adrian Villin --- extras/hs-test/proxy_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'extras/hs-test/proxy_test.go') diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index ac5f94c8535..c57b927846e 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -13,9 +13,9 @@ func init() { } func testProxyHttpTcp(s *NsSuite, proto string) error { - var outputFile string = "test" + s.pid + ".data" - var srcFilePid string = "httpTestFile" + s.pid - const srcFileNoPid = "httpTestFile" + var outputFile string = s.processIndex + "test" + s.ppid + ".data" + var srcFilePpid string = s.processIndex + "httpTestFile" + s.ppid + const srcFileNoPpid = "httpTestFile" const fileSize string = "10M" stopServer := make(chan struct{}, 1) serverRunning := make(chan struct{}, 1) @@ -23,9 +23,9 @@ func testProxyHttpTcp(s *NsSuite, proto string) error { clientNetns := s.getNetNamespaceByName("cln") // create test file - err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFilePid)) + err := exechelper.Run(fmt.Sprintf("ip netns exec %s truncate -s %s %s", serverNetns, fileSize, srcFilePpid)) s.assertNil(err, "failed to run truncate command: "+fmt.Sprint(err)) - defer func() { os.Remove(srcFilePid) }() + defer func() { os.Remove(srcFilePpid) }() s.log("test file created...") @@ -48,7 +48,7 @@ func testProxyHttpTcp(s *NsSuite, proto string) error { if proto == "tls" { c += " --secure-protocol=TLSv1_3 --no-check-certificate https://" } - c += fmt.Sprintf("%s:555/%s", clientVeth.ip4AddressString(), srcFileNoPid) + c += fmt.Sprintf("%s:555/%s", clientVeth.ip4AddressString(), srcFileNoPpid) s.log(c) _, err = exechelper.CombinedOutput(c) @@ -57,7 +57,7 @@ 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, srcFilePid)) + s.assertNil(assertFileSize(outputFile, srcFilePpid)) return nil } -- cgit