Skip to content

Commit aa9e9a4

Browse files
committed
[test] Add timeout to metrics query
Prevents client.Do from blocking indefinitely.
1 parent e1e4078 commit aa9e9a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/e2e/metrics_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"strconv"
1313
"strings"
1414
"testing"
15+
"time"
1516

1617
"github.com/stretchr/testify/assert"
1718
"github.com/stretchr/testify/require"
@@ -267,7 +268,7 @@ func makePrometheusQuery(address, query, token string) ([]Result, error) {
267268
// InsecureSkipVerify is required to avoid errors due to bad certificate
268269
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
269270
}
270-
client := &http.Client{Transport: tr}
271+
client := &http.Client{Transport: tr, Timeout: 15 * time.Second}
271272
resp, err := client.Do(req)
272273
if err != nil {
273274
return nil, fmt.Errorf("error making GET request: %w", err)

0 commit comments

Comments
 (0)