/
const.go
44 lines (38 loc) · 1.29 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package test
import (
"os"
"time"
)
const (
// DefaultSuccessTimeout for operations that are expected to succeed.
DefaultSuccessTimeout = 5 * time.Minute
// DefaultFailureTimeout for operations that are *expected* to time out.
//
// The timeout is short because timeouts are *never* a reliable way to
// determine that something does not happen. At best such a test *might* catch
// the problem. It is better than nothing, but not by much. Definitely not
// worth delaying the entire test suite for.
//
// Ideally tests for non-happening should have a positive wait with
// DefaultSuccessTimeout for something that we know *does* happen, and that we
// know never happens *before* the thing we don't expect to happen. Then look
// for positive proof that the thing didn't happen. A negative timeout result
// never proves that the thing won't happen in 1 more millisecond.
//
DefaultFailureTimeout = 1 * time.Second
OpenshiftOperatorsRedhatNS = "openshift-operators-redhat"
)
func SuccessTimeout() time.Duration {
d, err := time.ParseDuration(os.Getenv("SUCCESS_TIMEOUT"))
if err != nil {
return DefaultSuccessTimeout
}
return d
}
func FailureTimeout() time.Duration {
d, err := time.ParseDuration(os.Getenv("FAILURE_TIMEOUT"))
if err != nil {
return DefaultFailureTimeout
}
return d
}