Add comprehensive documentation and unit tests

Documentation:
- Add detailed README files for all services (auth, character, database, launcher, packet, utils, world)
- Create API documentation for the database service with detailed endpoint specifications
- Document database schema and relationships
- Add service architecture overviews and configuration instructions

Unit Tests:
- Implement comprehensive test suite for database repositories (user, character, session)
- Add gRPC service tests for database interactions
- Create tests for packet service components (bufferpool, connection, packets)
- Add utility service tests (health check, logging, load balancer, redis cache, service discovery)
- Implement auth service user tests
- Add character service tests

Code Structure:
- Reorganize test files into a more consistent structure
- Create a dedicated tests crate for integration testing
- Add test helpers and mock implementations for easier testing
This commit is contained in:
2025-04-09 13:29:38 -04:00
parent d47d5f44b1
commit a8755bd3de
85 changed files with 4218 additions and 764 deletions

View File

@@ -0,0 +1,42 @@
use std::env;
use utils::logging::setup_logging;
#[test]
fn test_logging_setup() {
// Test with default log level
env::remove_var("LOG_LEVEL");
setup_logging("test_app", &["test_crate"]);
// Test with custom log level
env::set_var("LOG_LEVEL", "debug");
setup_logging("test_app", &["test_crate"]);
// Test with invalid log level (should default to info)
env::set_var("LOG_LEVEL", "invalid_level");
setup_logging("test_app", &["test_crate"]);
// Test with multiple additional crates
setup_logging("test_app", &["test_crate1", "test_crate2", "test_crate3"]);
// Clean up
env::remove_var("LOG_LEVEL");
}
#[test]
fn test_logging_output() {
// This test is more of a smoke test to ensure logging doesn't panic
// Actual log output verification would require capturing stdout/stderr
env::set_var("LOG_LEVEL", "trace");
setup_logging("test_logging", &[]);
// Log at different levels
tracing::error!("This is an error message");
tracing::warn!("This is a warning message");
tracing::info!("This is an info message");
tracing::debug!("This is a debug message");
tracing::trace!("This is a trace message");
// Clean up
env::remove_var("LOG_LEVEL");
}