PERSIST=false
endif
+ifeq ($(UNCONFIGURE),)
+UNCONFIGURE=false
+endif
+
ifeq ($(TEST),)
TEST=all
endif
.PHONY: test
test: .deps.ok .build.vpp
- @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) --test=$(TEST)
+ @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
+ --unconfigure=$(UNCONFIGURE) --test=$(TEST)
build-go:
go build ./tools/http_server
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
s.RemoveVolumes()
}
+func (s *HstSuite) skipIfUnconfiguring() {
+ if *IsUnconfiguring {
+ s.skip("skipping to unconfigure")
+ }
+}
+
func (s *HstSuite) SetupTest() {
+ s.skipIfUnconfiguring()
s.SetupVolumes()
s.SetupContainers()
}
func (s *HstSuite) log(args ...any) {
if *IsVerbose {
- s.T().Helper()
+ s.T().Helper()
s.T().Log(args...)
}
}
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)
}
func (s *NoTopoSuite) SetupTest() {
+ s.skipIfUnconfiguring()
s.SetupVolumes()
s.SetupContainers()
}
func (s *NsSuite) SetupTest() {
+ s.skipIfUnconfiguring()
s.SetupVolumes()
s.SetupContainers()
}
func (s *VethsSuite) SetupTest() {
+ s.skipIfUnconfiguring()
+
s.SetupVolumes()
s.SetupContainers()
args=
single_test=0
persist_set=0
+unconfigure_set=0
for i in "$@"
do
args="$args -verbose"
fi
;;
+ --unconfigure=*)
+ unconfigure="${i#*=}"
+ if [ $unconfigure = "true" ]; then
+ args="$args -unconfigure"
+ unconfigure_set=1
+ fi
+ ;;
--test=*)
tc_name="${i#*=}"
if [ $tc_name != "all" ]; then
done
if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
- echo "persist flag is not supperted while running all tests!"
+ echo "persist flag is not supported while running all tests!"
+ exit 1
+fi
+
+if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
+ echo "a single test has to be specified when unconfigure is set"
+ exit 1
+fi
+
+if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
+ echo "setting persist flag and unconfigure flag is not allowed"
exit 1
fi