From: Adrian Villin Date: Wed, 4 Jun 2025 06:08:44 +0000 (+0200) Subject: hs-test: adjust timeouts when testing COV build X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F43080%2F2;p=vpp.git hs-test: adjust timeouts when testing COV build - 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 --- diff --git a/extras/hs-test/framework_test.go b/extras/hs-test/framework_test.go index 962d6d5fcd6..f75f949e5e3 100644 --- a/extras/hs-test/framework_test.go +++ b/extras/hs-test/framework_test.go @@ -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) } diff --git a/extras/hs-test/infra/common/suite_common.go b/extras/hs-test/infra/common/suite_common.go index 163faa96115..32fa02b41cf 100644 --- a/extras/hs-test/infra/common/suite_common.go +++ b/extras/hs-test/infra/common/suite_common.go @@ -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()) }