3 Commits

Author SHA1 Message Date
3bc37dd48c fix: resolve all linting errors
Some checks failed
CI / Test (pull_request) Failing after 18s
CI / Lint (pull_request) Successful in 17s
CI / Build (pull_request) Successful in 13s
CI / Format Check (pull_request) Successful in 2s
- Use typed context key instead of string in errorbus test to avoid collisions
- Remove unused imports (health.HealthChecker, trace.TracerProvider) from test files
- Simplify interface verification checks (removed unnecessary type assertions)

All linting errors resolved. make lint now passes.
2025-11-05 21:14:00 +01:00
7ffacb6620 fix: add mutex to mockLogger in errorbus tests to prevent race conditions
Some checks failed
CI / Test (pull_request) Successful in 22s
CI / Lint (pull_request) Failing after 17s
CI / Build (pull_request) Successful in 12s
CI / Format Check (pull_request) Successful in 2s
The mockLogger's errors slice was being accessed concurrently from
multiple goroutines (the error bus consumer and the test goroutine),
causing race conditions when running tests with the race detector.

Added sync.Mutex to protect the errors slice and proper locking when
accessing it in test assertions.
2025-11-05 21:11:46 +01:00
5fdbb729bd test: add comprehensive tests for all Epic 1 stories
Some checks failed
CI / Test (pull_request) Failing after 17s
CI / Lint (pull_request) Failing after 18s
CI / Build (pull_request) Successful in 12s
CI / Format Check (pull_request) Successful in 2s
Story 1.2: Database Layer
- Test database client creation, connection, ping, and close
- Test connection pooling configuration
- Tests skip if database is not available (short mode)

Story 1.3: Health Monitoring and Metrics
- Test health registry registration and checking
- Test database health checker
- Test liveness and readiness checks
- Test metrics creation, middleware, and handler
- Test Prometheus metrics endpoint

Story 1.4: Error Handling and Error Bus
- Test channel-based error bus creation
- Test error publishing with context
- Test nil error handling
- Test channel full scenario
- Test graceful shutdown
- Fix Close() method to handle multiple calls safely

Story 1.5: HTTP Server and Middleware
- Test server creation with all middleware
- Test request ID middleware
- Test logging middleware
- Test panic recovery middleware
- Test CORS middleware
- Test timeout middleware
- Test health and metrics endpoints
- Test server shutdown

Story 1.6: OpenTelemetry Tracing
- Test tracer initialization (enabled/disabled)
- Test development and production modes
- Test OTLP exporter configuration
- Test graceful shutdown
- Test no-op tracer provider

All tests follow Go testing best practices:
- Table-driven tests where appropriate
- Parallel execution
- Proper mocking of interfaces
- Skip tests requiring external dependencies in short mode
2025-11-05 21:05:36 +01:00