Fix some tests (#3100)

* Sleep for one millisecond in the handler because the `Latency` will return `0s` sometimes and the test will fail

* The `TCPListener.File` is not supported by windows, it is unimplemented now

* Remove the `LF` in the `testdata/template/raw.tmpl`, because if set the git config `core.autocrlf=true`, will append `CR` to the raw.tmpl automatically, then test is failed on Windows
This commit is contained in:
mstmdev
2022-04-21 18:21:46 +08:00
committed by GitHub
parent 696d37e030
commit 444e156fb1
4 changed files with 19 additions and 4 deletions

View File

@ -208,6 +208,7 @@ func TestLoggerWithConfigFormatting(t *testing.T) {
// set dummy ClientIP
c.Request.Header.Set("X-Forwarded-For", "20.20.20.20")
gotKeys = c.Keys
time.Sleep(time.Millisecond)
})
PerformRequest(router, "GET", "/example?a=100")