From 56e17cf7a23831b353bc1836def47dad7f869dad Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Thu, 11 Jan 2024 17:17:33 +0100 Subject: hs-test: add more asserts Type: test Change-Id: Ia285ff39d9b19464ea086ec847ceaf52c6c0195c Signed-off-by: Filip Tehlar --- extras/hs-test/suite_nginx_test.go | 8 ++++---- extras/hs-test/suite_no_topo_test.go | 4 ++-- extras/hs-test/suite_ns_test.go | 2 +- extras/hs-test/suite_veth_test.go | 8 ++------ extras/hs-test/vppinstance.go | 4 ++++ 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'extras') diff --git a/extras/hs-test/suite_nginx_test.go b/extras/hs-test/suite_nginx_test.go index c250ed7843e..4fc06265a29 100644 --- a/extras/hs-test/suite_nginx_test.go +++ b/extras/hs-test/suite_nginx_test.go @@ -33,13 +33,13 @@ func (s *NginxSuite) SetupTest() { // ... for proxy vppProxyContainer := s.getContainerByName(vppProxyContainerName) proxyVpp, _ := vppProxyContainer.newVppInstance(cpus, sessionConfig) - proxyVpp.start() + s.assertNil(proxyVpp.start()) clientInterface := s.netInterfaces[mirroringClientInterfaceName] - proxyVpp.createTap(clientInterface, 1) + s.assertNil(proxyVpp.createTap(clientInterface, 1)) serverInterface := s.netInterfaces[mirroringServerInterfaceName] - proxyVpp.createTap(serverInterface, 2) + s.assertNil(proxyVpp.createTap(serverInterface, 2)) nginxContainer := s.getTransientContainerByName(nginxProxyContainerName) nginxContainer.create() @@ -56,7 +56,7 @@ func (s *NginxSuite) SetupTest() { "./resources/nginx/nginx_proxy_mirroring.conf", values, ) - nginxContainer.start() + s.assertNil(nginxContainer.start()) proxyVpp.waitForApp("nginx-", 5) } diff --git a/extras/hs-test/suite_no_topo_test.go b/extras/hs-test/suite_no_topo_test.go index 8f7c87620ce..c6b3170dd5e 100644 --- a/extras/hs-test/suite_no_topo_test.go +++ b/extras/hs-test/suite_no_topo_test.go @@ -30,9 +30,9 @@ func (s *NoTopoSuite) SetupTest() { cpus := s.AllocateCpus() container := s.getContainerByName(singleTopoContainerVpp) vpp, _ := container.newVppInstance(cpus, sessionConfig) - vpp.start() + s.assertNil(vpp.start()) tapInterface := s.netInterfaces[tapInterfaceName] - vpp.createTap(tapInterface) + s.assertNil(vpp.createTap(tapInterface), "failed to create tap interface") } diff --git a/extras/hs-test/suite_ns_test.go b/extras/hs-test/suite_ns_test.go index 3bf3cc7e3ed..2c1ac34b414 100644 --- a/extras/hs-test/suite_ns_test.go +++ b/extras/hs-test/suite_ns_test.go @@ -31,7 +31,7 @@ func (s *NsSuite) SetupTest() { cpus := s.AllocateCpus() container := s.getContainerByName("vpp") vpp, _ := container.newVppInstance(cpus, sessionConfig) - vpp.start() + s.assertNil(vpp.start()) idx, err := vpp.createAfPacket(s.netInterfaces[serverInterface]) s.assertNil(err) diff --git a/extras/hs-test/suite_veth_test.go b/extras/hs-test/suite_veth_test.go index d0991271b36..de4812d7f97 100644 --- a/extras/hs-test/suite_veth_test.go +++ b/extras/hs-test/suite_veth_test.go @@ -53,9 +53,7 @@ func (s *VethsSuite) SetupTest() { func (s *VethsSuite) setupServerVpp() { serverVpp := s.getContainerByName("server-vpp").vppInstance - - err := serverVpp.start() - s.assertNil(err) + s.assertNil(serverVpp.start()) serverVeth := s.netInterfaces[serverInterfaceName] idx, err := serverVpp.createAfPacket(serverVeth) @@ -65,9 +63,7 @@ func (s *VethsSuite) setupServerVpp() { func (s *VethsSuite) setupClientVpp() { clientVpp := s.getContainerByName("client-vpp").vppInstance - - err := clientVpp.start() - s.assertNil(err) + s.assertNil(clientVpp.start()) clientVeth := s.netInterfaces[clientInterfaceName] idx, err := clientVpp.createAfPacket(clientVeth) diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go index e909b85abba..1a058c8e0e3 100644 --- a/extras/hs-test/vppinstance.go +++ b/extras/hs-test/vppinstance.go @@ -159,6 +159,7 @@ func (vpp *VppInstance) start() error { core.DefaultReconnectInterval) if err != nil { fmt.Println("async connect error: ", err) + return err } vpp.connection = conn @@ -172,12 +173,15 @@ func (vpp *VppInstance) start() error { ch, err := conn.NewAPIChannel() if err != nil { fmt.Println("creating channel failed: ", err) + return err } if err := ch.CheckCompatiblity(vpe.AllMessages()...); err != nil { fmt.Println("compatibility error: ", err) + return err } if err := ch.CheckCompatiblity(interfaces.AllMessages()...); err != nil { fmt.Println("compatibility error: ", err) + return err } vpp.apiChannel = ch -- cgit 1.2.3-korg