diff options
author | Adrian Villin <avillin@cisco.com> | 2024-06-14 09:32:39 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2024-06-14 18:10:26 +0000 |
commit | 4677d920c0b0ff1f1aae81fb2f0052d939a2e89c (patch) | |
tree | 9c1adf90f6c1a977b622c1d0211e0e86d1bef985 /extras/hs-test/echo_test.go | |
parent | 2aa0f0da5dedcf6301c74a39b5e3749359e07e6d (diff) |
hs-test: separate infra from tests
- most functions and vars now start with a capital letter:
needed to access them outside the package that declares
them
- updated README.md
- very minor changes in MAKEFILE
Type: test
Change-Id: I4b5a194f08f09d59e372e57da6451fbb5a1de4da
Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/echo_test.go')
-rw-r--r-- | extras/hs-test/echo_test.go | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/extras/hs-test/echo_test.go b/extras/hs-test/echo_test.go index ce852bea3e0..6b4739a5457 100644 --- a/extras/hs-test/echo_test.go +++ b/extras/hs-test/echo_test.go @@ -1,51 +1,56 @@ package main +import ( + . "fd.io/hs-test/infra" +) + func init() { - registerVethTests(EchoBuiltinTest) - registerSoloVethTests(TcpWithLossTest) + RegisterVethTests(EchoBuiltinTest) + RegisterSoloVethTests(TcpWithLossTest) } func EchoBuiltinTest(s *VethsSuite) { - serverVpp := s.getContainerByName("server-vpp").vppInstance - serverVeth := s.getInterfaceByName(serverInterfaceName) + serverVpp := s.GetContainerByName("server-vpp").VppInstance + serverVeth := s.GetInterfaceByName(ServerInterfaceName) - serverVpp.vppctl("test echo server " + - " uri tcp://" + serverVeth.ip4AddressString() + "/1234") + serverVpp.Vppctl("test echo server " + + " uri tcp://" + serverVeth.Ip4AddressString() + "/1234") - clientVpp := s.getContainerByName("client-vpp").vppInstance + clientVpp := s.GetContainerByName("client-vpp").VppInstance - o := clientVpp.vppctl("test echo client nclients 100 bytes 1 verbose" + + o := clientVpp.Vppctl("test echo client nclients 100 bytes 1 verbose" + " syn-timeout 100 test-timeout 100" + - " uri tcp://" + serverVeth.ip4AddressString() + "/1234") - s.log(o) - s.assertNotContains(o, "failed:") + " uri tcp://" + serverVeth.Ip4AddressString() + "/1234") + s.Log(o) + s.AssertNotContains(o, "failed:") } // unstable with multiple workers func TcpWithLossTest(s *VethsSuite) { s.SkipIfMultiWorker() - serverVpp := s.getContainerByName("server-vpp").vppInstance + serverVpp := s.GetContainerByName("server-vpp").VppInstance - serverVeth := s.getInterfaceByName(serverInterfaceName) - serverVpp.vppctl("test echo server uri tcp://%s/20022", - serverVeth.ip4AddressString()) + serverVeth := s.GetInterfaceByName(ServerInterfaceName) + serverVpp.Vppctl("test echo server uri tcp://%s/20022", + serverVeth.Ip4AddressString()) - clientVpp := s.getContainerByName("client-vpp").vppInstance + clientVpp := s.GetContainerByName("client-vpp").VppInstance // Ensure that VPP doesn't abort itself with NSIM enabled // Warning: Removing this ping will make VPP crash! - clientVpp.vppctl("ping %s", serverVeth.ip4AddressString()) + clientVpp.Vppctl("ping %s", serverVeth.Ip4AddressString()) // Add loss of packets with Network Delay Simulator - clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" + + clientVpp.Vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" + " packet-size 1400 packets-per-drop 1000") - clientVpp.vppctl("nsim output-feature enable-disable host-" + s.getInterfaceByName(clientInterfaceName).name) + name := s.GetInterfaceByName(ClientInterfaceName).Name() + clientVpp.Vppctl("nsim output-feature enable-disable host-" + name) // Do echo test from client-vpp container - output := clientVpp.vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50", - serverVeth.ip4AddressString()) - s.log(output) - s.assertNotEqual(len(output), 0) - s.assertNotContains(output, "failed", output) + output := clientVpp.Vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50", + serverVeth.Ip4AddressString()) + s.Log(output) + s.AssertNotEqual(len(output), 0) + s.AssertNotContains(output, "failed", output) } |