fix: remove t.Parallel() from server tests to fix race conditions
The Gin framework uses a global mode setting (gin.SetMode()) which is not thread-safe when tests run in parallel. Removing t.Parallel() from all server tests that use gin.SetMode() prevents data races when running tests with the race detector enabled. All tests now pass with 'make test' which includes -race flag.
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNewServer(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
values: map[string]any{
|
||||
@@ -51,7 +51,7 @@ func TestNewServer(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewServer_DefaultValues(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
values: map[string]any{
|
||||
@@ -76,7 +76,7 @@ func TestNewServer_DefaultValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_Router(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
values: map[string]any{
|
||||
@@ -102,7 +102,7 @@ func TestServer_Router(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_Shutdown(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
values: map[string]any{
|
||||
@@ -140,8 +140,6 @@ func TestServer_Shutdown(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_HealthEndpoints(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
@@ -181,8 +179,6 @@ func TestServer_HealthEndpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_MetricsEndpoint(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
mockConfig := &mockConfigProvider{
|
||||
|
||||
Reference in New Issue
Block a user