From 902e5beb4ffed2c90f2e9743fb9b967920327aee Mon Sep 17 00:00:00 2001 From: Nuno Diegues Date: Thu, 1 Sep 2022 19:29:11 +0100 Subject: [PATCH] TUN-6729: Fix flaky TestClosePreviousProxies I can only reproduce the flakiness, which is the hello world still responding when it should be shut down already, in Windows (both in TeamCity as well as my local VM). Locally, it only happens when the machine is under high load. Anyway, it's valid that the proxies take some time to shut down since they handle that via channels asynchronously with regards to the event that updates the configuration. Hence, nothing is wrong, as long as they eventually shut down, which the test still verifies. --- orchestration/orchestrator_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orchestration/orchestrator_test.go b/orchestration/orchestrator_test.go index dc94d29c..5c18b3a7 100644 --- a/orchestration/orchestrator_test.go +++ b/orchestration/orchestrator_test.go @@ -500,7 +500,8 @@ func TestClosePreviousProxies(t *testing.T) { require.NoError(t, err) require.Equal(t, http.StatusTeapot, resp.StatusCode) - // The hello-world server in config v1 should have been stopped + // 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) resp, err = proxyHTTP(originProxyV1, hostname) require.Error(t, err) require.Nil(t, resp)