hs-test: set longer timeouts while debugging

Type: test

Change-Id: I87baba7efa36dd40f086523b35bc6d3b0a26a1b5
Signed-off-by: Adrian Villin <avillin@cisco.com>
diff --git a/extras/hs-test/framework_test.go b/extras/hs-test/framework_test.go
index 8773fa2..8cbf936 100644
--- a/extras/hs-test/framework_test.go
+++ b/extras/hs-test/framework_test.go
@@ -2,12 +2,21 @@
 
 import (
 	"testing"
+	"time"
 
 	. "github.com/onsi/ginkgo/v2"
 	. "github.com/onsi/gomega"
 )
 
+var suiteTimeout time.Duration
+
 func TestHst(t *testing.T) {
+	if *isVppDebug {
+		// 30 minute timeout so that the framework won't timeout while debugging
+		suiteTimeout = time.Minute * 30
+	} else {
+		suiteTimeout = time.Minute * 5
+	}
 	RegisterFailHandler(Fail)
 	RunSpecs(t, "HST")
 }
diff --git a/extras/hs-test/suite_nginx_test.go b/extras/hs-test/suite_nginx_test.go
index ef4ca5c..4c6e9db 100644
--- a/extras/hs-test/suite_nginx_test.go
+++ b/extras/hs-test/suite_nginx_test.go
@@ -4,7 +4,6 @@
 	"reflect"
 	"runtime"
 	"strings"
-	"time"
 
 	. "github.com/onsi/ginkgo/v2"
 )
@@ -101,7 +100,7 @@
 		It(testName, func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
 
@@ -128,6 +127,6 @@
 		It(testName, Label("SOLO"), func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
diff --git a/extras/hs-test/suite_no_topo_test.go b/extras/hs-test/suite_no_topo_test.go
index 19a3e1f..260fc1d 100644
--- a/extras/hs-test/suite_no_topo_test.go
+++ b/extras/hs-test/suite_no_topo_test.go
@@ -4,7 +4,6 @@
 	"reflect"
 	"runtime"
 	"strings"
-	"time"
 
 	. "github.com/onsi/ginkgo/v2"
 )
@@ -77,7 +76,7 @@
 		It(testName, func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
 
@@ -104,6 +103,6 @@
 		It(testName, Label("SOLO"), func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
diff --git a/extras/hs-test/suite_ns_test.go b/extras/hs-test/suite_ns_test.go
index 377046c..7bdb90b 100644
--- a/extras/hs-test/suite_ns_test.go
+++ b/extras/hs-test/suite_ns_test.go
@@ -5,7 +5,6 @@
 	"reflect"
 	"runtime"
 	"strings"
-	"time"
 
 	. "github.com/onsi/ginkgo/v2"
 )
@@ -86,7 +85,7 @@
 		It(testName, func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
 
@@ -113,6 +112,6 @@
 		It(testName, Label("SOLO"), func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
diff --git a/extras/hs-test/suite_tap_test.go b/extras/hs-test/suite_tap_test.go
index ebf0f9b..cb06533 100644
--- a/extras/hs-test/suite_tap_test.go
+++ b/extras/hs-test/suite_tap_test.go
@@ -52,7 +52,7 @@
 		It(testName, func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
 
@@ -79,6 +79,6 @@
 		It(testName, Label("SOLO"), func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
diff --git a/extras/hs-test/suite_veth_test.go b/extras/hs-test/suite_veth_test.go
index c3038ca..13ef5ef 100644
--- a/extras/hs-test/suite_veth_test.go
+++ b/extras/hs-test/suite_veth_test.go
@@ -109,7 +109,7 @@
 		It(testName, func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
 
@@ -137,6 +137,6 @@
 		It(testName, Label("SOLO"), func(ctx SpecContext) {
 			s.log(testName + ": BEGIN")
 			test(&s)
-		}, SpecTimeout(time.Minute*5))
+		}, SpecTimeout(suiteTimeout))
 	}
 })
diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go
index 3276c2d..8a92776 100644
--- a/extras/hs-test/vppinstance.go
+++ b/extras/hs-test/vppinstance.go
@@ -108,6 +108,7 @@
 }
 
 func (vpp *VppInstance) start() error {
+	maxReconnectAttempts := 3
 	// Replace default logger in govpp with our own
 	govppLogger := logrus.New()
 	govppLogger.SetOutput(io.MultiWriter(vpp.getSuite().logger.Writer(), GinkgoWriter))
@@ -142,6 +143,8 @@
 
 	vpp.getSuite().log("starting vpp")
 	if *isVppDebug {
+		// default = 3; VPP will timeout while debugging if there are not enough attempts
+		maxReconnectAttempts = 5000
 		sig := make(chan os.Signal, 1)
 		signal.Notify(sig, syscall.SIGQUIT)
 		cont := make(chan bool, 1)
@@ -166,7 +169,7 @@
 	sockAddress := vpp.container.getHostWorkDir() + defaultApiSocketFilePath
 	conn, connEv, err := govpp.AsyncConnect(
 		sockAddress,
-		core.DefaultMaxReconnectAttempts,
+		maxReconnectAttempts,
 		core.DefaultReconnectInterval)
 	if err != nil {
 		vpp.getSuite().log("async connect error: " + fmt.Sprint(err))
@@ -184,7 +187,7 @@
 		context.Background(),
 		core.WithRequestSize(50),
 		core.WithReplySize(50),
-		core.WithReplyTimeout(time.Second*10))
+		core.WithReplyTimeout(time.Second*5))
 	if err != nil {
 		vpp.getSuite().log("creating stream failed: " + fmt.Sprint(err))
 		return err