kube-test: remove dryrun option, fix persist 68/43768/2
authorAdrian Villin <[email protected]>
Wed, 22 Oct 2025 10:27:43 +0000 (12:27 +0200)
committerFlorin Coras <[email protected]>
Mon, 27 Oct 2025 15:44:12 +0000 (15:44 +0000)
- dryrun is unused
- fixed namespaces being deleted even with persist=true

Type: test

Change-Id: I3c4194d821f6bd1ff9fd85947ec9bc04e724f8e5
Signed-off-by: Adrian Villin <[email protected]>
test-c/kube-test/Makefile
test-c/kube-test/framework_test.go
test-c/kube-test/infra/suite_base.go
test-c/kube-test/kube_test.sh

index 0e1ffa9..bb42062 100644 (file)
@@ -70,7 +70,6 @@ help:
        @echo " TEST=[name1,name2...]    - specific test(s) to run"
        @echo " SKIP=[name1,name2...]    - specific test(s) to skip"
        @echo " REPEAT=[n]               - repeat tests up to N times or until a failure occurs"
-       @echo " DRYRUN=[true|false]      - set up containers but don't run tests"
        @echo " NO_COLOR=[true|false]    - disables colorful Docker and Ginkgo output"
        @echo " TIMEOUT=[minutes]        - test timeout override (30 minutes by default)"
        @echo " GINKGO_TIMEOUT=[Ns/m/h]  - Ginkgo timeout override (3h by default)"
index 23b39a8..f3eebbf 100644 (file)
@@ -57,12 +57,12 @@ func TestKube(t *testing.T) {
 
        RegisterFailHandler(Fail)
        RunSpecs(t, "kube-test")
-       if *DryRun || *IsPersistent {
+       if *IsPersistent {
                fmt.Println("\033[36m" + "Use 'make cleanup-kube' to remove pods " +
                        "and namespaces. \nPPID: " + Ppid + "\033[0m")
        }
        // deleting the namespace here since we use the same namespace for every suite
-       if !*DryRun || !*IsPersistent {
+       if !*IsPersistent {
                fmt.Println("Deleting kube-test namespace")
                cmd := exec.Command("kubectl", "delete", "ns", "kube-test"+Ppid)
                fmt.Println(cmd.String())
index b9221e7..fafc716 100644 (file)
@@ -24,7 +24,6 @@ var IsCoverage = flag.Bool("coverage", false, "use coverage run config")
 var IsPersistent = flag.Bool("persist", false, "persists topology config")
 var IsVerbose = flag.Bool("verbose", false, "verbose test output")
 var IsVppDebug = flag.Bool("debug", false, "attach gdb to vpp")
-var DryRun = flag.Bool("dryrun", false, "set up containers but don't run tests")
 var Timeout = flag.Int("timeout", 30, "test timeout override (in minutes)")
 var TestTimeout time.Duration
 var Kubeconfig string
@@ -88,14 +87,14 @@ func (s *BaseSuite) SetupSuite() {
 }
 
 func (s *BaseSuite) TeardownTest() {
-       if *IsPersistent || *DryRun {
+       if *IsPersistent {
                s.Skip("Skipping test teardown")
        }
        s.Log("[* TEST TEARDOWN]")
 }
 
 func (s *BaseSuite) TeardownSuite() {
-       if *IsPersistent || *DryRun {
+       if *IsPersistent {
                s.Skip("Skipping suite teardown")
        }
        s.Log("[* SUITE TEARDOWN]")
index abfbd7d..77f9e1d 100755 (executable)
@@ -3,13 +3,11 @@
 args=
 focused_test=0
 persist_set=0
-dryrun_set=0
 debug_set=0
 debug_build=
 ginkgo_args=
 tc_names=()
 skip_names=()
-dryrun=
 no_color=
 
 for i in "$@"
@@ -47,13 +45,6 @@ case "${i}" in
     --repeat=*)
         ginkgo_args="$ginkgo_args --repeat=${i#*=}"
         ;;
-    --dryrun=*)
-        dryrun="${i#*=}"
-        if [ "$dryrun" = "true" ]; then
-            args="$args -dryrun"
-            dryrun_set=1
-        fi
-        ;;
     --no_color=*)
         no_color="${i#*=}"
         if [ "$no_color" = "true" ]; then
@@ -79,8 +70,8 @@ for skip in "${skip_names[@]}"; do
     ginkgo_args="$ginkgo_args --skip $skip"
 done
 
-if [ $focused_test -eq 0 ] && { [ $persist_set -eq 1 ] || [ $dryrun_set -eq 1 ]; }; then
-    echo -e "\e[1;31mpersist/dryrun flag is not supported while running all tests!\e[1;0m"
+if [ $focused_test -eq 0 ] && { [ $persist_set -eq 1 ]; }; then
+    echo -e "\e[1;31mpersist flag is not supported while running all tests!\e[1;0m"
     exit 2
 fi