Adds a test to detect data race in .New and .Test funcs

pull/1316/head
Diego Sandrim 2021-05-05 16:43:07 -03:00
parent 056c6808af
commit 24f55ef580
1 changed files with 14 additions and 0 deletions

View File

@ -1249,3 +1249,17 @@ func Test_App_Error_In_Fasthttp_Server(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 500, resp.StatusCode)
}
// go test -race -run Test_App_New_Test_Parallel
func Test_App_New_Test_Parallel(t *testing.T) {
t.Run("Test_App_New_Test_Parallel_1", func(t *testing.T) {
t.Parallel()
app := New(Config{Immutable: true})
app.Test(httptest.NewRequest("GET", "/", nil))
})
t.Run("Test_App_New_Test_Parallel_2", func(t *testing.T) {
t.Parallel()
app := New(Config{Immutable: true})
app.Test(httptest.NewRequest("GET", "/", nil))
})
}