Implement integration test suite for Miroir with docker-compose: - Updated docker-compose-dev.yml to use Meilisearch v1.37.0 - Created tests/integration.rs with comprehensive test coverage: * Document round-trip (1000 docs) * Search coverage across all shards (unique-keyword test) * Facet aggregation (3 colors, sum = 100) * Offset/limit paging * Settings broadcast * Task polling * Health check * Node failure test with RF=2 - Created docker-compose-dev-rf2.yml for RF=2/HA testing (6 nodes) - Created dev-config-rf2.yaml for RF=2 configuration - Created tests/README.md with documentation Tests run against real Docker Compose stack: cargo test --test integration -- --test-threads=1 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| benches/score-comparability | ||
| fixtures | ||
| integration.rs | ||
| README.md | ||
| verify_p6_2_peer_discovery.sh | ||
| verify_p7_1_core_metrics.sh | ||
Integration Tests
This directory contains integration tests for Miroir that run against a real Docker Compose stack.
Prerequisites
Start the Docker Compose development stack:
docker compose -f examples/docker-compose-dev.yml up -d
Wait for all containers to be healthy (may take 30-60 seconds):
docker compose -f examples/docker-compose-dev.yml ps
Running Tests
Run all integration tests:
cargo test --test integration -- --test-threads=1
Run a specific test:
cargo test --test integration test_document_round_trip -- --exact
Run tests with output:
cargo test --test integration -- --test-threads=1 --nocapture
Test Coverage
| Test | Description | AC Reference |
|---|---|---|
test_document_round_trip |
Index and retrieve 1000 documents | §8.1 |
test_search_shard_coverage |
Verify search hits all 16 shards | §8.2 |
test_facet_aggregation |
Verify facet counts sum correctly | §8.3 |
test_offset_limit_paging |
Test pagination with offset/limit | §8.4 |
test_settings_broadcast |
Verify settings propagate to all nodes | §8.5 |
test_task_polling |
Test task status polling | §8.6 |
test_health_check |
Verify health endpoint responds | §8.7 |
test_direct_meilisearch_access |
Verify direct node access for debugging | §8.7 |
test_node_failure_rf2 |
Test graceful degradation with node failure | §8.8 |
RF=2 / High Availability Tests
The test_node_failure_rf2 test requires the RF=2 docker-compose stack:
# Start the RF=2 stack (6 Meilisearch nodes, RF=2, RG=2)
docker compose -f examples/docker-compose-dev-rf2.yml up -d
# Run the node failure test
cargo test --test integration test_node_failure_rf2 -- --ignored
# Clean up
docker compose -f examples/docker-compose-dev-rf2.yml down -v
The node failure test:
- Indexes documents with RF=2 (each document replicated to both replica groups)
- Stops a Meilisearch node mid-test (
docker stop miroir-meili-1) - Verifies that searches still work using remaining replicas
- Restarts the node and verifies recovery
Cleanup
Stop and remove containers:
docker compose -f examples/docker-compose-dev.yml down -v
For RF=2 tests:
docker compose -f examples/docker-compose-dev-rf2.yml down -v
Troubleshooting
Containers not starting
Check container status:
docker compose -f examples/docker-compose-dev.yml ps
Check logs:
docker compose -f examples/docker-compose-dev.yml logs miroir
docker compose -f examples/docker-compose-dev.yml logs meili-0
Port conflicts
If ports 7700-7703 are already in use, modify the port mappings in examples/docker-compose-dev.yml.
For RF=2 tests, ensure ports 7710-7716 and 6379 are available.
Tests failing with connection refused
Ensure the Docker Compose stack is running:
docker compose -f examples/docker-compose-dev.yml ps
Wait for all containers to be healthy before running tests.
Node failure test not working
The RF=2 test requires:
- The RF=2 docker-compose stack to be running
- Sufficient memory for 6 Meilisearch containers + Redis
- The
dockercommand to be accessible from the test environment
Run with --ignored flag:
cargo test --test integration test_node_failure_rf2 -- --ignored