summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/ldp_test.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <maros.ondrejicka@pantheon.tech>2022-12-06 15:38:05 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-12-07 16:05:20 +0000
commit98a91e82608e6e30d4516b52556cdaaa9837ee24 (patch)
tree2030a669ba4a70a2767cd8ca8fcce3f0e5c647d9 /extras/hs-test/ldp_test.go
parentfe1fb3c31aa5f42c213eaa0c51f9d5a2cef07711 (diff)
hs-test: use assert-like approach in test cases
Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I1653001461d4dfc52f1fb3a9e0cf458a506b8324
Diffstat (limited to 'extras/hs-test/ldp_test.go')
-rwxr-xr-xextras/hs-test/ldp_test.go46
1 files changed, 11 insertions, 35 deletions
diff --git a/extras/hs-test/ldp_test.go b/extras/hs-test/ldp_test.go
index c219c82ea50..683c6a37525 100755
--- a/extras/hs-test/ldp_test.go
+++ b/extras/hs-test/ldp_test.go
@@ -9,7 +9,6 @@ import (
)
func (s *VethsSuite) TestLDPreloadIperfVpp() {
- t := s.T()
var clnVclConf, srvVclConf Stanza
srvInstance := "vpp-ldp-srv"
@@ -23,7 +22,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
exechelper.Run("mkdir " + clnPath)
ldpreload := os.Getenv("HST_LDPRELOAD")
- s.Assert().NotEqual("", ldpreload)
+ s.assertNotEqual("", ldpreload)
ldpreload = "LD_PRELOAD=" + ldpreload
@@ -33,31 +32,17 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
fmt.Println("starting VPPs")
- err := dockerRun(srvInstance, fmt.Sprintf("-v /tmp/%s:/tmp", srvInstance))
- if err != nil {
- t.Errorf("%v", err)
- return
- }
+ s.assertNil(dockerRun(srvInstance, fmt.Sprintf("-v /tmp/%s:/tmp", srvInstance)), "failed to start docker (srv)")
defer func() { exechelper.Run("docker stop " + srvInstance) }()
- err = dockerRun(clnInstance, fmt.Sprintf("-v /tmp/%s:/tmp", clnInstance))
- if err != nil {
- t.Errorf("%v", err)
- return
- }
+ s.assertNil(dockerRun(clnInstance, fmt.Sprintf("-v /tmp/%s:/tmp", clnInstance)), "failed to start docker (cln)")
defer func() { exechelper.Run("docker stop " + clnInstance) }()
- _, err = hstExec("Configure2Veths srv", srvInstance)
- if err != nil {
- t.Errorf("%v", err)
- return
- }
+ _, err := hstExec("Configure2Veths srv", srvInstance)
+ s.assertNil(err)
_, err = hstExec("Configure2Veths cln", clnInstance)
- if err != nil {
- t.Errorf("%v", err)
- return
- }
+ s.assertNil(err)
err = clnVclConf.
NewStanza("vcl").
@@ -68,10 +53,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
Append("use-mq-eventfd").
Append(fmt.Sprintf("app-socket-api /tmp/%s/Configure2Veths/var/run/app_ns_sockets/2", clnInstance)).Close().
SaveToFile(clnVcl)
- if err != nil {
- t.Errorf("%v", err)
- t.FailNow()
- }
+ s.assertNil(err)
err = srvVclConf.
NewStanza("vcl").
@@ -82,10 +64,8 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
Append("use-mq-eventfd").
Append(fmt.Sprintf("app-socket-api /tmp/%s/Configure2Veths/var/run/app_ns_sockets/1", srvInstance)).Close().
SaveToFile(srvVcl)
- if err != nil {
- t.Errorf("%v", err)
- t.FailNow()
- }
+ s.assertNil(err)
+
fmt.Printf("attaching server to vpp")
// FIXME
@@ -95,9 +75,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
go StartServerApp(srvCh, stopServerCh, srvEnv)
err = <-srvCh
- if err != nil {
- s.FailNow("vcl server", "%v", err)
- }
+ s.assertNil(err)
fmt.Println("attaching client to vpp")
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
@@ -105,9 +83,7 @@ func (s *VethsSuite) TestLDPreloadIperfVpp() {
// wait for client's result
err = <-clnCh
- if err != nil {
- s.Failf("client", "%v", err)
- }
+ s.assertNil(err)
// stop server
stopServerCh <- struct{}{}