Files
osirose-new/tests/README.md
raven a8755bd3de 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
2025-04-09 13:29:53 -04:00

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:

  1. Create a new test file in the appropriate service directory
  2. Add the test to the [[test]] section in Cargo.toml
  3. Run the test to ensure it works correctly