diff -Naur -x '*.orig' exporter-toolkit-0.7.1/web/handler_test.go exporter-toolkit-0.7.1-fix-race-condition/web/handler_test.go --- exporter-toolkit-0.7.1/web/handler_test.go 2021-12-02 00:21:56.000000000 +0100 +++ exporter-toolkit-0.7.1-fix-race-condition/web/handler_test.go 2022-11-22 11:53:05.608183773 +0100 @@ -18,6 +18,7 @@ "net/http" "sync" "testing" + "time" ) // TestBasicAuthCache validates that the cache is working by calling a password @@ -42,6 +43,7 @@ ListenAndServe(server, "testdata/web_config_users_noTLS.good.yml", testlogger) close(done) }() + time.Sleep(250 * time.Millisecond) login := func(username, password string, code int) { client := &http.Client{} @@ -106,6 +108,7 @@ ListenAndServe(server, "testdata/web_config_users_noTLS.good.yml", testlogger) close(done) }() + time.Sleep(250 * time.Millisecond) login := func() { client := &http.Client{} @@ -150,6 +153,7 @@ ListenAndServe(server, "testdata/web_config_headers.good.yml", testlogger) close(done) }() + time.Sleep(250 * time.Millisecond) client := &http.Client{} req, err := http.NewRequest("GET", "http://localhost"+port, nil)