aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test')
-rw-r--r--extras/hs-test/echo_test.go2
-rw-r--r--extras/hs-test/http_test.go9
-rw-r--r--extras/hs-test/infra/container.go5
-rw-r--r--extras/hs-test/infra/suite_ldp.go5
-rw-r--r--extras/hs-test/infra/suite_vpp_proxy.go1
-rw-r--r--extras/hs-test/infra/utils.go32
-rw-r--r--extras/hs-test/infra/vppinstance.go6
-rw-r--r--extras/hs-test/ldp_test.go8
-rw-r--r--extras/hs-test/proxy_test.go2
-rw-r--r--extras/hs-test/raw_session_test.go3
-rw-r--r--extras/hs-test/vcl_test.go14
11 files changed, 69 insertions, 18 deletions
diff --git a/extras/hs-test/echo_test.go b/extras/hs-test/echo_test.go
index b21c69a1e99..8d69c007113 100644
--- a/extras/hs-test/echo_test.go
+++ b/extras/hs-test/echo_test.go
@@ -39,7 +39,7 @@ func TcpWithLossTest(s *VethsSuite) {
clientVpp.Vppctl("nsim output-feature enable-disable host-" + s.Interfaces.Server.Name())
// Do echo test from client-vpp container
- output := clientVpp.Vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",
+ output := clientVpp.Vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes bytes 50m",
s.Interfaces.Server.Ip4AddressString())
s.Log(output)
s.AssertNotEqual(len(output), 0)
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index 760ca3ca936..93317bbf8d8 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -412,7 +412,8 @@ func httpClientGet(s *NoTopoSuite, response string, size int) {
s.AssertContains(o, response)
s.AssertContains(o, "Content-Length: "+strconv.Itoa(size))
- file_contents := vpp.Container.Exec(false, "cat /tmp/response.txt")
+ file_contents, err := vpp.Container.Exec(false, "cat /tmp/response.txt")
+ s.AssertNil(err)
s.AssertContains(file_contents, response)
}
@@ -463,7 +464,8 @@ func httpClientRepeat(s *NoTopoSuite, requestMethod string, clientArgs string) {
o := vpp.Vppctl(cmd)
s.Log(o)
- replyCount := s.Containers.NginxServer.Exec(false, "awk 'END { print NR }' "+logPath)
+ replyCount, err := s.Containers.NginxServer.Exec(false, "awk 'END { print NR }' "+logPath)
+ s.AssertNil(err)
if replyCount != "" {
replyCountInt, err = strconv.Atoi(replyCount[:len(replyCount)-1])
s.AssertNil(err)
@@ -485,7 +487,8 @@ func httpClientRepeat(s *NoTopoSuite, requestMethod string, clientArgs string) {
o = vpp.Vppctl(cmd)
s.Log(o)
- replyCount = s.Containers.NginxServer.Exec(false, "awk 'END { print NR }' "+logPath)
+ replyCount, err = s.Containers.NginxServer.Exec(false, "awk 'END { print NR }' "+logPath)
+ s.AssertNil(err)
if replyCount != "" {
replyCountInt, err = strconv.Atoi(replyCount[:len(replyCount)-1])
s.AssertNil(err)
diff --git a/extras/hs-test/infra/container.go b/extras/hs-test/infra/container.go
index 918c19e669e..efc317fa96d 100644
--- a/extras/hs-test/infra/container.go
+++ b/extras/hs-test/infra/container.go
@@ -460,7 +460,7 @@ func (c *Container) ExecServer(useEnvVars bool, command string, arguments ...any
c.Suite.AssertNil(exechelper.Run(containerExecCommand))
}
-func (c *Container) Exec(useEnvVars bool, command string, arguments ...any) string {
+func (c *Container) Exec(useEnvVars bool, command string, arguments ...any) (string, error) {
var envVars string
serverCommand := fmt.Sprintf(command, arguments...)
if useEnvVars {
@@ -472,8 +472,7 @@ func (c *Container) Exec(useEnvVars bool, command string, arguments ...any) stri
GinkgoHelper()
c.Suite.Log(containerExecCommand)
byteOutput, err := exechelper.CombinedOutput(containerExecCommand)
- c.Suite.AssertNil(err, fmt.Sprint(err))
- return string(byteOutput)
+ return string(byteOutput), err
}
func (c *Container) saveLogs() {
diff --git a/extras/hs-test/infra/suite_ldp.go b/extras/hs-test/infra/suite_ldp.go
index 408fea31325..53fe10086d0 100644
--- a/extras/hs-test/infra/suite_ldp.go
+++ b/extras/hs-test/infra/suite_ldp.go
@@ -97,6 +97,11 @@ func (s *LdpSuite) SetupTest() {
}
func (s *LdpSuite) TearDownTest() {
+ if CurrentSpecReport().Failed() {
+ s.CollectIperfLogs(s.Containers.ServerVpp)
+ s.CollectRedisServerLogs(s.Containers.ServerVpp)
+ }
+
for _, container := range s.StartedContainers {
delete(container.EnvVars, "LD_PRELOAD")
delete(container.EnvVars, "VCL_CONFIG")
diff --git a/extras/hs-test/infra/suite_vpp_proxy.go b/extras/hs-test/infra/suite_vpp_proxy.go
index 252d01eac9a..137bbb679d8 100644
--- a/extras/hs-test/infra/suite_vpp_proxy.go
+++ b/extras/hs-test/infra/suite_vpp_proxy.go
@@ -93,6 +93,7 @@ func (s *VppProxySuite) TearDownTest() {
s.Log(vpp.Vppctl("show session verbose 2"))
s.Log(vpp.Vppctl("show error"))
s.CollectNginxLogs(s.Containers.NginxServerTransient)
+ s.CollectIperfLogs(s.Containers.IperfS)
}
s.HstSuite.TearDownTest()
}
diff --git a/extras/hs-test/infra/utils.go b/extras/hs-test/infra/utils.go
index bd603f863fc..2f4328b4a74 100644
--- a/extras/hs-test/infra/utils.go
+++ b/extras/hs-test/infra/utils.go
@@ -18,6 +18,8 @@ import (
const networkTopologyDir string = "topo-network/"
const containerTopologyDir string = "topo-containers/"
const HttpCapsuleTypeDatagram = uint64(0)
+const iperfLogFileName = "iperf.log"
+const redisLogFileName = "redis-server.log"
type Stanza struct {
content string
@@ -223,6 +225,36 @@ func (s *HstSuite) CollectEnvoyLogs(envoyContainer *Container) {
}
}
+func (s *HstSuite) IperfLogFileName(serverContainer *Container) string {
+ return serverContainer.GetContainerWorkDir() + "/" + serverContainer.Name + "-" + iperfLogFileName
+}
+
+func (s *HstSuite) CollectIperfLogs(serverContainer *Container) {
+ targetDir := serverContainer.Suite.getLogDirPath()
+ source := serverContainer.GetHostWorkDir() + "/" + serverContainer.Name + "-" + iperfLogFileName
+ cmd := exec.Command("cp", "-t", targetDir, source)
+ s.Log(cmd.String())
+ err := cmd.Run()
+ if err != nil {
+ s.Log(fmt.Sprint(err))
+ }
+}
+
+func (s *HstSuite) RedisServerLogFileName(serverContainer *Container) string {
+ return serverContainer.GetContainerWorkDir() + "/" + serverContainer.Name + "-" + redisLogFileName
+}
+
+func (s *HstSuite) CollectRedisServerLogs(serverContainer *Container) {
+ targetDir := serverContainer.Suite.getLogDirPath()
+ source := serverContainer.GetHostWorkDir() + "/" + serverContainer.Name + "-" + redisLogFileName
+ cmd := exec.Command("cp", "-t", targetDir, source)
+ s.Log(cmd.String())
+ err := cmd.Run()
+ if err != nil {
+ s.Log(fmt.Sprint(err))
+ }
+}
+
func (s *HstSuite) StartIperfServerApp(running chan error, done chan struct{}, env []string) {
cmd := exec.Command("iperf3", "-4", "-s", "-p", s.GetPortFromPpid())
if env != nil {
diff --git a/extras/hs-test/infra/vppinstance.go b/extras/hs-test/infra/vppinstance.go
index 370d2be38d1..59d17de4d20 100644
--- a/extras/hs-test/infra/vppinstance.go
+++ b/extras/hs-test/infra/vppinstance.go
@@ -243,9 +243,11 @@ func (vpp *VppInstance) Start() error {
}
func (vpp *VppInstance) Stop() {
- pid := strings.TrimSpace(vpp.Container.Exec(false, "pidof vpp"))
+ pid, err := vpp.Container.Exec(false, "pidof vpp")
+ pid = strings.TrimSpace(pid)
// Stop VPP only if it's still running
- if len(pid) > 0 {
+ if err == nil {
+ vpp.getSuite().Log("Stopping VPP")
vpp.Container.Exec(false, "bash -c \"kill -15 "+pid+"\"")
}
}
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index 3120f1c5813..6ce0943d6c6 100644
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -54,7 +54,7 @@ func ldPreloadIperfVpp(s *LdpSuite, useUdp bool) {
go func() {
defer GinkgoRecover()
- cmd := "iperf3 -4 -s -p " + s.GetPortFromPpid()
+ cmd := "iperf3 -4 -s -p " + s.GetPortFromPpid() + " --logfile " + s.IperfLogFileName(s.Containers.ServerVpp)
s.StartServerApp(s.Containers.ServerVpp, "iperf3", cmd, srvCh, stopServerCh)
}()
@@ -90,7 +90,11 @@ func RedisBenchmarkTest(s *LdpSuite) {
go func() {
defer GinkgoRecover()
- cmd := "redis-server --daemonize yes --protected-mode no --bind " + serverVethAddress
+ // Avoid redis warning during startup
+ s.Containers.ServerVpp.Exec(false, "sysctl vm.overcommit_memory=1")
+ // Note: --save "" disables snapshotting which during upgrade to ubuntu 24.04 was
+ // observed to corrupt vcl memory / heap. Needs more debugging.
+ cmd := "redis-server --daemonize yes --protected-mode no --save \"\" --bind " + serverVethAddress + " --loglevel notice --logfile " + s.RedisServerLogFileName(s.Containers.ServerVpp)
s.StartServerApp(s.Containers.ServerVpp, "redis-server", cmd, runningSrv, doneSrv)
}()
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go
index 7a8d9d9b6fb..b6b4df5d0cd 100644
--- a/extras/hs-test/proxy_test.go
+++ b/extras/hs-test/proxy_test.go
@@ -93,7 +93,7 @@ func vppProxyIperfMTTest(s *VppProxySuite, proto string) {
go func() {
defer GinkgoRecover()
- cmd := fmt.Sprintf("iperf3 -4 -s -B %s -p %s", s.ServerAddr(), fmt.Sprint(s.ServerPort()))
+ cmd := fmt.Sprintf("iperf3 -4 -s -B %s -p %s --logfile %s", s.ServerAddr(), fmt.Sprint(s.ServerPort()), s.IperfLogFileName(s.Containers.IperfS))
s.StartServerApp(s.Containers.IperfS, "iperf3", cmd, srvCh, stopServerCh)
}()
diff --git a/extras/hs-test/raw_session_test.go b/extras/hs-test/raw_session_test.go
index c104031f78f..b93b27ab56b 100644
--- a/extras/hs-test/raw_session_test.go
+++ b/extras/hs-test/raw_session_test.go
@@ -35,6 +35,7 @@ func testVppEcho(s *VethsSuite, proto string) {
" socket-name " + s.Containers.ClientApp.GetContainerWorkDir() + "/var/run/app_ns_sockets/default" +
" use-app-socket-api uri " + uri
s.Log(clientCommand)
- o := s.Containers.ClientApp.Exec(true, clientCommand)
+ o, err := s.Containers.ClientApp.Exec(true, clientCommand)
+ s.AssertNil(err)
s.Log(o)
}
diff --git a/extras/hs-test/vcl_test.go b/extras/hs-test/vcl_test.go
index 11e2be1258e..bc557a90508 100644
--- a/extras/hs-test/vcl_test.go
+++ b/extras/hs-test/vcl_test.go
@@ -50,7 +50,8 @@ func testXEchoVclClient(s *VethsSuite, proto string) {
testClientCommand := "vcl_test_client -N 100 -p " + proto + " " + s.Interfaces.Server.Ip4AddressString() + " " + port
s.Log(testClientCommand)
echoClnContainer.AddEnvVar("VCL_CONFIG", "/vcl.conf")
- o := echoClnContainer.Exec(true, testClientCommand)
+ o, err := echoClnContainer.Exec(true, testClientCommand)
+ s.AssertNil(err)
s.Log(o)
s.AssertContains(o, "CLIENT RESULTS")
}
@@ -76,7 +77,7 @@ func testXEchoVclServer(s *VethsSuite, proto string) {
serverVethAddress := s.Interfaces.Server.Ip4AddressString()
clientVpp := s.Containers.ClientVpp.VppInstance
- o := clientVpp.Vppctl("test echo client uri %s://%s/%s fifo-size 64k verbose mbytes 2", proto, serverVethAddress, port)
+ o := clientVpp.Vppctl("test echo client uri %s://%s/%s fifo-size 64k verbose bytes 2m", proto, serverVethAddress, port)
s.Log(o)
s.AssertContains(o, "Test finished at")
}
@@ -97,7 +98,8 @@ func testVclEcho(s *VethsSuite, proto string) {
testClientCommand := "vcl_test_client -p " + proto + " " + serverVethAddress + " " + port
echoClnContainer.AddEnvVar("VCL_CONFIG", "/vcl.conf")
- o := echoClnContainer.Exec(true, testClientCommand)
+ o, err := echoClnContainer.Exec(true, testClientCommand)
+ s.AssertNil(err)
s.Log(o)
}
@@ -137,7 +139,8 @@ func testRetryAttach(s *VethsSuite, proto string) {
testClientCommand := "vcl_test_client -U -p " + proto + " " + serverVethAddress + " 12346"
echoClnContainer.AddEnvVar("VCL_CONFIG", "/vcl.conf")
- o := echoClnContainer.Exec(true, testClientCommand)
+ o, err := echoClnContainer.Exec(true, testClientCommand)
+ s.AssertNil(err)
s.Log(o)
s.Log("... First test ended. Stopping VPP server now.")
@@ -152,7 +155,8 @@ func testRetryAttach(s *VethsSuite, proto string) {
time.Sleep(30 * time.Second) // Wait a moment for the re-attachment to happen
s.Log("... Running second echo client test, after disconnect and re-attachment.")
- o = echoClnContainer.Exec(true, testClientCommand)
+ o, err = echoClnContainer.Exec(true, testClientCommand)
+ s.AssertNil(err)
s.Log(o)
s.Log("Done.")
}