aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/hst_suite.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <mondreji@cisco.com>2023-02-27 16:52:57 +0100
committerFlorin Coras <florin.coras@gmail.com>2023-02-28 16:36:41 +0000
commitaf004ddad1231682d0a64ce9671e2619c2910c7a (patch)
treec0631b738b8f024f5ad12ceddbbce54651ceacca /extras/hs-test/hst_suite.go
parent32881935bb82b009528ba5a930b4399bad26abfd (diff)
hs-test: add option to unconfigure topology
Adding `UNCONFIGURE=true` argument when running `make test` will skip test run and unconfigure existing topology for that test. Type: test Signed-off-by: Maros Ondrejicka <mondreji@cisco.com> Change-Id: I197747a56ca68807f0b2c3f25b6f61c3dcc41ace
Diffstat (limited to 'extras/hs-test/hst_suite.go')
-rw-r--r--extras/hs-test/hst_suite.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/extras/hs-test/hst_suite.go b/extras/hs-test/hst_suite.go
index ff7024582dc..8e52cc4e851 100644
--- a/extras/hs-test/hst_suite.go
+++ b/extras/hs-test/hst_suite.go
@@ -19,6 +19,7 @@ const (
var IsPersistent = flag.Bool("persist", false, "persists topology config")
var IsVerbose = flag.Bool("verbose", false, "verbose test output")
+var IsUnconfiguring = flag.Bool("unconfigure", false, "remove topology")
type HstSuite struct {
suite.Suite
@@ -42,7 +43,14 @@ func (s *HstSuite) TearDownTest() {
s.RemoveVolumes()
}
+func (s *HstSuite) skipIfUnconfiguring() {
+ if *IsUnconfiguring {
+ s.skip("skipping to unconfigure")
+ }
+}
+
func (s *HstSuite) SetupTest() {
+ s.skipIfUnconfiguring()
s.SetupVolumes()
s.SetupContainers()
}
@@ -111,7 +119,7 @@ func (s *HstSuite) assertNotEmpty(object interface{}, msgAndArgs ...interface{})
func (s *HstSuite) log(args ...any) {
if *IsVerbose {
- s.T().Helper()
+ s.T().Helper()
s.T().Log(args...)
}
}
@@ -223,6 +231,10 @@ func (s *HstSuite) loadNetworkTopology(topologyName string) {
func (s *HstSuite) configureNetworkTopology(topologyName string) {
s.loadNetworkTopology(topologyName)
+ if *IsUnconfiguring {
+ return
+ }
+
for _, nc := range s.netConfigs {
if err := nc.Configure(); err != nil {
s.T().Fatalf("network config error: %v", err)