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
This commit is contained in:

committed by
Florin Coras

parent
32881935bb
commit
af004ddad1
@@ -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)
|
||||
|
Reference in New Issue
Block a user