From 24f55ef580e62881bfda592f465a387296011e27 Mon Sep 17 00:00:00 2001 From: Diego Sandrim Date: Wed, 5 May 2021 16:43:07 -0300 Subject: [PATCH] Adds a test to detect data race in .New and .Test funcs --- app_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app_test.go b/app_test.go index a1257bb5..e114d5a2 100644 --- a/app_test.go +++ b/app_test.go @@ -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)) + }) +}