mirror of https://github.com/status-im/consul.git
Fix a test flake where a retry timer was being reused causing tests after the first to exit early (#19864)
Fix a test flake where a retry timer was being reused causing tests after the first to exit too early.
This commit is contained in:
parent
8125a32a4e
commit
d4fda945bb
|
@ -22,7 +22,9 @@ import (
|
||||||
|
|
||||||
const externalServerName = libservice.StaticServerServiceName
|
const externalServerName = libservice.StaticServerServiceName
|
||||||
|
|
||||||
var requestRetryTimer = &retry.Timer{Timeout: 120 * time.Second, Wait: 500 * time.Millisecond}
|
func requestRetryTimer() *retry.Timer {
|
||||||
|
return &retry.Timer{Timeout: 120 * time.Second, Wait: 500 * time.Millisecond}
|
||||||
|
}
|
||||||
|
|
||||||
// TestTerminatingGateway Summary
|
// TestTerminatingGateway Summary
|
||||||
// This test makes sure an external service can be reached via and terminating gateway. External server
|
// This test makes sure an external service can be reached via and terminating gateway. External server
|
||||||
|
@ -171,7 +173,7 @@ func createTerminatingGatewayConfigEntry(t *testing.T, consulClient *api.Client,
|
||||||
// in the response.
|
// in the response.
|
||||||
func assertHTTPRequestToServiceAddress(t *testing.T, client *libservice.ConnectContainer, serviceName string, port int, expSuccess bool) {
|
func assertHTTPRequestToServiceAddress(t *testing.T, client *libservice.ConnectContainer, serviceName string, port int, expSuccess bool) {
|
||||||
upstreamURL := fmt.Sprintf("http://localhost:%d/debug?env=dump", port)
|
upstreamURL := fmt.Sprintf("http://localhost:%d/debug?env=dump", port)
|
||||||
retry.RunWith(requestRetryTimer, t, func(r *retry.R) {
|
retry.RunWith(requestRetryTimer(), t, func(r *retry.R) {
|
||||||
out, err := client.Exec(context.Background(), []string{"curl", "-s", upstreamURL})
|
out, err := client.Exec(context.Background(), []string{"curl", "-s", upstreamURL})
|
||||||
r.Logf("curl request to upstream service address: url=%s\nerr = %v\nout = %s", upstreamURL, err, out)
|
r.Logf("curl request to upstream service address: url=%s\nerr = %v\nout = %s", upstreamURL, err, out)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue