Skip to content

Commit ac7050d

Browse files
author
Pierre SOUCHAY
committed
ensure that UTest do not take too much time
Signed-off-by: Pierre SOUCHAY <pierre.souchay@pelico.io>
1 parent 5955d19 commit ac7050d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

collector/collector_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ func TestWithConnectionTimeout(t *testing.T) {
124124
t.Errorf("elapsed time was %v, should be bigger than timeout=%v", elapsed, timeoutForQuery)
125125
}
126126

127+
// Ensure we took more than timeout, but not too much
128+
if elapsed >= timeoutForQuery+500*time.Millisecond {
129+
t.Errorf("elapsed time was %v, should not be much bigger than timeout=%v", elapsed, timeoutForQuery)
130+
}
131+
127132
if err := mock.ExpectationsWereMet(); err != nil {
128133
t.Errorf("there were unfulfilled exceptions: %s", err)
129134
}

0 commit comments

Comments
 (0)