From 1a81473e30f1a59fa250eec85e3b4fa592dca9c1 Mon Sep 17 00:00:00 2001 From: Andre Soares Date: Fri, 18 Sep 2020 09:41:30 -0300 Subject: [PATCH] Add defaultPollInterval() --- wait/http.go | 2 +- wait/log.go | 4 ++-- wait/sql.go | 2 +- wait/wait.go | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wait/http.go b/wait/http.go index ba89dca62d..77528f44b3 100644 --- a/wait/http.go +++ b/wait/http.go @@ -46,7 +46,7 @@ func NewHTTPStrategy(path string) *HTTPStrategy { TLSConfig: nil, Method: http.MethodGet, Body: nil, - PollInterval: time.Second / 10, + PollInterval: defaultPollInterval(), } } diff --git a/wait/log.go b/wait/log.go index 1173624423..8aa3050309 100644 --- a/wait/log.go +++ b/wait/log.go @@ -17,8 +17,8 @@ type LogStrategy struct { // additional properties Log string - PollInterval time.Duration Occurrence int + PollInterval time.Duration } // NewLogStrategy constructs a HTTP strategy waiting on port 80 and status code 200 @@ -26,8 +26,8 @@ func NewLogStrategy(log string) *LogStrategy { return &LogStrategy{ startupTimeout: defaultStartupTimeout(), Log: log, - PollInterval: 100 * time.Millisecond, Occurrence: 1, + PollInterval: defaultPollInterval(), } } diff --git a/wait/sql.go b/wait/sql.go index e632ea10d1..aabd754e58 100644 --- a/wait/sql.go +++ b/wait/sql.go @@ -16,7 +16,7 @@ func ForSQL(port nat.Port, driver string, url func(nat.Port) string) *waitForSql URL: url, Driver: driver, startupTimeout: defaultStartupTimeout(), - PollInterval: 100 * time.Millisecond, + PollInterval: defaultPollInterval(), } } diff --git a/wait/wait.go b/wait/wait.go index f71b9e999e..9439edeae6 100644 --- a/wait/wait.go +++ b/wait/wait.go @@ -22,3 +22,7 @@ type StrategyTarget interface { func defaultStartupTimeout() time.Duration { return 60 * time.Second } + +func defaultPollInterval() time.Duration { + return 100 * time.Millisecond +}