fix: remove t.Parallel() from metrics 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 metrics 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,12 +14,12 @@ Go Platform is a modular, extensible platform designed to support multiple busin
|
||||
|
||||
## Documentation Structure
|
||||
|
||||
### 📋 Overview
|
||||
### Overview
|
||||
- **[Requirements](requirements.md)**: High-level architectural principles and requirements
|
||||
- **[Implementation Plan](plan.md)**: Epic-based implementation plan with timelines
|
||||
- **[Playbook](playbook.md)**: Detailed implementation guide and best practices
|
||||
|
||||
### 🏛️ Architecture
|
||||
### Architecture
|
||||
- **[Architecture Overview](architecture/architecture.md)**: System architecture with diagrams
|
||||
- **[Module Architecture](architecture/architecture-modules.md)**: Module system design and integration
|
||||
- **[Module Requirements](architecture/module-requirements.md)**: Detailed requirements for each module
|
||||
@@ -31,7 +31,7 @@ Go Platform is a modular, extensible platform designed to support multiple busin
|
||||
- **[Operational Scenarios](architecture/operational-scenarios.md)**: Common operational flows and use cases
|
||||
- **[Data Flow Patterns](architecture/data-flow-patterns.md)**: How data flows through the system
|
||||
|
||||
### 🏗️ Architecture Decision Records (ADRs)
|
||||
### Architecture Decision Records (ADRs)
|
||||
All architectural decisions are documented in [ADR records](adr/README.md), organized by implementation epic:
|
||||
- **Epic 0**: Project Setup & Foundation
|
||||
- **Epic 1**: Core Kernel & Infrastructure
|
||||
@@ -41,7 +41,7 @@ All architectural decisions are documented in [ADR records](adr/README.md), orga
|
||||
- **Epic 6**: Observability & Production Readiness
|
||||
- **Epic 7**: Testing, Documentation & CI/CD
|
||||
|
||||
### 📝 Implementation Tasks
|
||||
### Implementation Tasks
|
||||
Detailed task definitions for each epic are available in the [Stories section](stories/README.md):
|
||||
- **[Epic 0: Project Setup & Foundation](stories/epic0/README.md)** - [Implementation Summary](stories/epic0/SUMMARY.md)
|
||||
- **[Epic 1: Core Kernel & Infrastructure](stories/epic1/README.md)** - [Implementation Summary](stories/epic1/SUMMARY.md)
|
||||
|
||||
@@ -34,13 +34,10 @@ func TestNewMetrics(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMetrics_HTTPMiddleware(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
metrics := NewMetrics()
|
||||
|
||||
// Set Gin to test mode
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
router := gin.New()
|
||||
router.Use(metrics.HTTPMiddleware())
|
||||
|
||||
@@ -63,12 +60,10 @@ func TestMetrics_HTTPMiddleware(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMetrics_HTTPMiddleware_Error(t *testing.T) {
|
||||
t.Parallel()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
metrics := NewMetrics()
|
||||
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
router := gin.New()
|
||||
router.Use(metrics.HTTPMiddleware())
|
||||
|
||||
@@ -87,8 +82,6 @@ func TestMetrics_HTTPMiddleware_Error(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMetrics_Handler(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
metrics := NewMetrics()
|
||||
|
||||
handler := metrics.Handler()
|
||||
|
||||
Reference in New Issue
Block a user