- 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>
})
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)
}
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())
}