mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-12 20:55:22 +01:00
attempt to fix flaky TestClientProxyReadOk (#6899)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
(cherry picked from commit f586082520
)
This commit is contained in:
parent
1aa9f7be4e
commit
71e592e677
@ -3,6 +3,7 @@ package promscrape
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
@ -135,7 +136,10 @@ func TestClientProxyReadOk(t *testing.T) {
|
||||
c, err := newClient(ctx, &ScrapeWork{
|
||||
ScrapeURL: backend.URL,
|
||||
ProxyURL: proxy.MustNewURL(ps.URL),
|
||||
ScrapeTimeout: 2 * time.Second,
|
||||
// bump timeout for slow CIs
|
||||
ScrapeTimeout: 5 * time.Second,
|
||||
// force connection re-creating to avoid broken conns in slow CIs
|
||||
DisableKeepAlive: true,
|
||||
AuthConfig: newTestAuthConfig(t, isBackendTLS, backendAuth),
|
||||
ProxyAuthConfig: newTestAuthConfig(t, isProxyTLS, proxyAuth),
|
||||
MaxScrapeSize: 16000,
|
||||
@ -143,8 +147,16 @@ func TestClientProxyReadOk(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create client: %s", err)
|
||||
}
|
||||
|
||||
var bb bytesutil.ByteBuffer
|
||||
if err := c.ReadData(&bb); err != nil {
|
||||
err = c.ReadData(&bb)
|
||||
if errors.Is(err, io.EOF) {
|
||||
bb.Reset()
|
||||
// EOF could occur in slow envs, like CI
|
||||
err = c.ReadData(&bb)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error at ReadData: %s", err)
|
||||
}
|
||||
got, err := io.ReadAll(bb.NewReader())
|
||||
|
Loading…
Reference in New Issue
Block a user