Initialize checks the environment and alters the timeout scale accordingly. It returns a function to undo the scaling.
(factor string)
| 42 | // Initialize checks the environment and alters the timeout scale accordingly. |
| 43 | // It returns a function to undo the scaling. |
| 44 | func Initialize(factor string) func() { |
| 45 | fv, err := strconv.ParseFloat(factor, 64) |
| 46 | if err != nil { |
| 47 | panic(err) |
| 48 | } |
| 49 | original := _timeoutScale |
| 50 | _timeoutScale = fv |
| 51 | return func() { _timeoutScale = original } |
| 52 | } |
| 53 | |
| 54 | func init() { |
| 55 | if v := os.Getenv("TEST_TIMEOUT_SCALE"); v != "" { |
no outgoing calls