From e7e3cb42b47e924f85d9837a04375e9af52a529e Mon Sep 17 00:00:00 2001 From: MoofMonkey <11695747+MoofMonkey@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:32:53 +0300 Subject: [PATCH] Reduce flakiness of TestClosePreviousProxies --- orchestration/orchestrator_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/orchestration/orchestrator_test.go b/orchestration/orchestrator_test.go index d3e1ee62..ae2aa3fe 100644 --- a/orchestration/orchestrator_test.go +++ b/orchestration/orchestrator_test.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net" "net/http" "net/http/httptest" @@ -282,7 +281,7 @@ func TestConcurrentUpdateAndRead(t *testing.T) { switch resp.StatusCode { // v1 proxy, warp enabled case 200: - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) require.NoError(t, err) require.Equal(t, t.Name(), string(body)) warpRoutingDisabled = false @@ -504,7 +503,7 @@ func TestClosePreviousProxies(t *testing.T) { require.Equal(t, http.StatusTeapot, resp.StatusCode) // The hello-world server in config v1 should have been stopped. We wait a bit since it's closed asynchronously. - time.Sleep(time.Millisecond * 10) + time.Sleep(time.Millisecond * 300) resp, err = proxyHTTP(originProxyV1, hostname) require.Error(t, err) require.Nil(t, resp) @@ -522,8 +521,8 @@ func TestClosePreviousProxies(t *testing.T) { // cancel the context should terminate the last proxy cancel() - // Wait for proxies to shutdown - time.Sleep(time.Millisecond * 10) + // Wait for proxies to shut down + time.Sleep(time.Millisecond * 300) resp, err = proxyHTTP(originProxyV3, hostname) require.Error(t, err)