summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/hst_suite.go
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-01-31 10:34:18 +0100
committerFilip Tehlar <ftehlar@cisco.com>2023-02-24 14:38:15 +0100
commit671cf51d6d0b08c216a99696aa30f17faff5e653 (patch)
tree569ca122ed05396a4174c91c775d289b75769cf4 /extras/hs-test/hst_suite.go
parent182d2b466d158de4b2320fd280c1e7beb5bb37e4 (diff)
hs-test: improve test infra
- add support for building/running debug/release images - have one point of control (Makefile) - list all test cases Type: test Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I97949abc2fff85d7a2b3784122be159aeec72b52
Diffstat (limited to 'extras/hs-test/hst_suite.go')
-rw-r--r--extras/hs-test/hst_suite.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/extras/hs-test/hst_suite.go b/extras/hs-test/hst_suite.go
index 409ab1688c6..1180f07036b 100644
--- a/extras/hs-test/hst_suite.go
+++ b/extras/hs-test/hst_suite.go
@@ -1,6 +1,7 @@
package main
import (
+ "flag"
"fmt"
"io/ioutil"
"os"
@@ -15,13 +16,8 @@ const (
defaultNetworkNumber int = 1
)
-func IsPersistent() bool {
- return os.Getenv("HST_PERSIST") == "1"
-}
-
-func IsVerbose() bool {
- return os.Getenv("HST_VERBOSE") == "1"
-}
+var IsPersistent = flag.Bool("persist", false, "persists topology config")
+var IsVerbose = flag.Bool("verbose", false, "verbose test output")
type HstSuite struct {
suite.Suite
@@ -37,7 +33,7 @@ func (s *HstSuite) TearDownSuite() {
}
func (s *HstSuite) TearDownTest() {
- if IsPersistent() {
+ if *IsPersistent {
return
}
s.ResetContainers()
@@ -112,7 +108,7 @@ func (s *HstSuite) assertNotEmpty(object interface{}, msgAndArgs ...interface{})
}
func (s *HstSuite) log(args ...any) {
- if IsVerbose() {
+ if *IsVerbose {
s.T().Log(args...)
}
}
@@ -241,7 +237,7 @@ func (s *HstSuite) configureNetworkTopology(topologyName string) {
}
func (s *HstSuite) unconfigureNetworkTopology() {
- if IsPersistent() {
+ if *IsPersistent {
return
}
for _, nc := range s.netConfigs {