diff options
author | Maros Ondrejicka <maros.ondrejicka@pantheon.tech> | 2022-12-01 09:56:37 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-12-02 21:35:10 +0000 |
commit | 11a03e972e6752513ab931540f713ce1520696a7 (patch) | |
tree | eca0fca1593103cf5bc9f7fbb63706313de1925a /extras/hs-test/echo_test.go | |
parent | b01efc557b411e02379c9647eebf7e762efd8473 (diff) |
hs-test: add test suite features
Test suite now supports assertions which on fail stop test case run,
also it allows to create docker containers which are going to be
stopped automatically after the test run is finished.
Type: improvement
Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
Change-Id: I2834709b1efd17b8182d36cc0404b986b4ed595d
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'extras/hs-test/echo_test.go')
-rwxr-xr-x | extras/hs-test/echo_test.go | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/extras/hs-test/echo_test.go b/extras/hs-test/echo_test.go index 74ff4cb0d6e..9f91e2afeb7 100755 --- a/extras/hs-test/echo_test.go +++ b/extras/hs-test/echo_test.go @@ -6,46 +6,26 @@ import ( "github.com/edwarnicke/exechelper" ) -func (s *Veths2Suite) TestEchoBuiltin() { - t := s.T() +func (s *VethsSuite) TestEchoBuiltin() { srvInstance := "echo-srv-internal" clnInstance := "echo-cln-internal" - err := dockerRun(srvInstance, "") - if err != nil { - t.Errorf("%v", err) - return - } + + s.assertNil(dockerRun(srvInstance, ""), "failed to start docker (srv)") defer func() { exechelper.Run("docker stop " + srvInstance) }() - err = dockerRun(clnInstance, "") - if err != nil { - t.Errorf("%v", err) - return - } + s.assertNil(dockerRun(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 = hstExec("RunEchoSrvInternal private-segment-size 1g fifo-size 4 no-echo", srvInstance) - if err != nil { - t.Errorf("%v", err) - return - } + s.assertNil(err) o, err := hstExec("RunEchoClnInternal nclients 10000 bytes 1 syn-timeout 100 test-timeout 100 no-return private-segment-size 1g fifo-size 4", clnInstance) - if err != nil { - t.Errorf("%v", err) - return - } + s.assertNil(err) fmt.Println(o) } |