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
1.6 KiB
1.6 KiB
MMORPG Server Tests
This directory contains tests for all components of the MMORPG server architecture.
Running Tests
Running All Tests
To run all tests:
cd tests
cargo test
Running Tests for a Specific Service
To run tests for a specific service:
cd tests
cargo test --test auth_users_tests
cargo test --test character_service_tests
cargo test --test packet_tests
cargo test --test redis_cache_tests
cargo test --test get_user_tests
cargo test --test grpc_get_user_tests
cargo test --test mock_tests
# etc.
Running Tests with Environment Variables
Some tests require environment variables to be set:
# Redis tests
export REDIS_TEST_ENABLED=true
export TEST_REDIS_URL=redis://127.0.0.1:6379
# Kubernetes tests
export KUBE_TEST_ENABLED=true
export TEST_K8S_SERVICE_NAME=database-service
export TEST_K8S_PORT_NAME=database-service
# Consul tests
export CONSUL_TEST_ENABLED=true
export TEST_CONSUL_URL=127.0.0.1:8600
export TEST_CONSUL_SERVICE_NAME=database-service
# Run tests
cd tests
cargo test
Test Organization
Tests are organized by service:
- auth-service/: Tests for the authentication service
- character-service/: Tests for the character service
- database-service/: Tests for the database service
- packet-service/: Tests for the packet service
- utils/: Tests for shared utilities
Adding New Tests
To add a new test:
- Create a new test file in the appropriate service directory
- Add the test to the
[[test]]section inCargo.toml - Run the test to ensure it works correctly