hs-test: adjust timeouts when testing COV build 80/43080/2
authorAdrian Villin <avillin@cisco.com>
Wed, 4 Jun 2025 06:08:44 +0000 (08:08 +0200)
committerDave Wallace <dwallacelf@gmail.com>
Wed, 4 Jun 2025 15:17:12 +0000 (15:17 +0000)
- TestTimeout is set to 30 minutes unless overridden with TIMEOUT arg
- AssertChannelClosed() timeout is set to TestTimeout-30s

Type: test

Change-Id: Ic321ad5baf3bf2c52ed872c58abc8ad577d82397
Signed-off-by: Adrian Villin <avillin@cisco.com>
extras/hs-test/framework_test.go
extras/hs-test/infra/common/suite_common.go

index 962d6d5..f75f949 100644 (file)
@@ -26,9 +26,11 @@ var _ = ReportAfterSuite("VPP version under test", func(report Report) {
 })
 
 func TestHst(t *testing.T) {
-       if *IsVppDebug {
-               // 30 minute timeout so that the framework won't timeout while debugging
+       // if we're debugging/running a coverage build and timeout isn't overridden,
+       // set test timeout to 30 minutes. Also impacts AssertChannelClosed()
+       if (*IsVppDebug || *IsCoverage) && *Timeout == 5 {
                TestTimeout = time.Minute * 30
+               fmt.Printf("[Debugging or coverage build, TestTimeout is set to %s]\n", TestTimeout.String())
        } else {
                TestTimeout = time.Minute * time.Duration(*Timeout)
        }
index 163faa9..32fa02b 100644 (file)
@@ -172,7 +172,12 @@ func (s *HstCommon) AssertHttpBody(resp *http.Response, expectedBody string, msg
        ExpectWithOffset(2, resp).To(HaveHTTPBody(expectedBody), msgAndArgs...)
 }
 
+// Coverage builds take longer to finish -> assert timeout is set to 'TestTimeout - 30 seconds' to let the test finish properly
 func (s *HstCommon) AssertChannelClosed(timeout time.Duration, channel chan error) {
+       if *IsCoverage && timeout > time.Second*30 {
+               s.Log("Coverage build, assert timeout is set to %s", timeout.String())
+               timeout = TestTimeout - time.Second*30
+       }
        EventuallyWithOffset(2, channel).WithTimeout(timeout).Should(BeClosed())
 }