Timeouts returns the map of timeouts, where each event gets the timeout specified in the `TEST_TIMEOUTS` environment variable, or if not specified, takes the default value
()
| 83 | // in the `TEST_TIMEOUTS` environment variable, or if not specified, takes the default |
| 84 | // value |
| 85 | func Timeouts() (map[Timeout]int, error) { |
| 86 | if timeoutsEnv, exists := os.LookupEnv(TestTimeoutsEnvVar); exists { |
| 87 | var timeouts map[Timeout]int |
| 88 | err := json.Unmarshal([]byte(timeoutsEnv), &timeouts) |
| 89 | if err != nil { |
| 90 | return map[Timeout]int{}, |
| 91 | fmt.Errorf("TEST_TIMEOUTS env variable is not valid: %v", err) |
| 92 | } |
| 93 | for k, def := range DefaultTestTimeouts { |
| 94 | val, found := timeouts[k] |
| 95 | if found { |
| 96 | timeouts[k] = val |
| 97 | } else { |
| 98 | timeouts[k] = def |
| 99 | } |
| 100 | } |
| 101 | return timeouts, nil |
| 102 | } |
| 103 | |
| 104 | return DefaultTestTimeouts, nil |
| 105 | } |