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
This commit is contained in:
2025-11-05 21:03:27 +01:00
parent 278a727b8c
commit 5fdbb729bd
11 changed files with 1537 additions and 22 deletions

View File

@@ -4,7 +4,7 @@
A modular, extensible platform built with Go that provides a solid foundation for building scalable, secure, and observable applications. The platform supports plugin-based architecture, enabling teams to build feature modules independently while sharing core services.
## 🏗️ Architecture Overview
## Architecture Overview
Go Platform follows **Clean/Hexagonal Architecture** principles with clear separation between:
@@ -23,7 +23,7 @@ Go Platform follows **Clean/Hexagonal Architecture** principles with clear separ
- **Security-by-Design**: JWT authentication, RBAC/ABAC, and audit logging
- **Observability**: OpenTelemetry, structured logging, and Prometheus metrics
## 📁 Directory Structure
## Directory Structure
```
goplt/
@@ -59,7 +59,7 @@ goplt/
└── ci.yml
```
## 🚀 Quick Start
## Quick Start
### Prerequisites
@@ -107,7 +107,7 @@ export DATABASE_DSN="postgres://user:pass@localhost/dbname"
export LOGGING_LEVEL=debug
```
## 🛠️ Development
## Development
### Make Commands
@@ -150,7 +150,7 @@ Run all checks:
make verify
```
## 📚 Documentation
## Documentation
Comprehensive documentation is available in the `docs/` directory:
@@ -172,7 +172,7 @@ make docs-docker
Documentation will be available at `http://127.0.0.1:8000`
## 🏛️ Architecture
## Architecture
### Core Kernel
@@ -223,7 +223,7 @@ Key configuration sections:
- **Logging**: Log level, format, and output destination
- **Authentication**: JWT settings and token configuration
## 🧪 Testing
## Testing
The project follows table-driven testing patterns and includes:
@@ -232,7 +232,7 @@ The project follows table-driven testing patterns and includes:
- Mock generation for interfaces
- Test coverage reporting
## 🤝 Contributing
## Contributing
1. Create a feature branch: `git checkout -b feature/my-feature`
2. Make your changes following the project's architecture principles
@@ -240,11 +240,11 @@ The project follows table-driven testing patterns and includes:
4. Commit your changes with clear messages
5. Push to your branch and create a pull request
## 📄 License
## License
[Add license information here]
## 🔗 Links
## Links
- [Architecture Documentation](docs/content/architecture/)
- [ADRs](docs/content/adr/)
@@ -254,7 +254,3 @@ The project follows table-driven testing patterns and includes:
## 📞 Support
For questions and support, please refer to the documentation or create an issue in the repository.
---
**Built with ❤️ using Go**