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.
This commit is contained in:
Nuno Diegues 2022-09-01 19:29:11 +01:00
parent 7ca5f7569a
commit 902e5beb4f
1 changed files with 2 additions and 1 deletions

View File

@ -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)