miroir/tests
jedarden 32bda26613 P9.2: Integration test harness with docker-compose
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>
2026-05-23 07:26:55 -04:00
..
benches/score-comparability miroir-zc2.5: Fix dump import compatibility matrix enhancement bead refs 2026-05-20 07:18:56 -04:00
fixtures miroir-zc2.5: Fix dump import compatibility matrix enhancement bead refs 2026-05-20 07:18:56 -04:00
integration.rs P9.2: Integration test harness with docker-compose 2026-05-23 07:26:55 -04:00
README.md P9.2: Integration test harness with docker-compose 2026-05-23 07:26:55 -04:00
verify_p6_2_peer_discovery.sh P6.2: Fix verification script shebang for NixOS compatibility 2026-05-23 02:47:02 -04:00
verify_p7_1_core_metrics.sh P7.1: Core metrics families acceptance tests 2026-05-23 02:29:28 -04:00

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:

  1. Indexes documents with RF=2 (each document replicated to both replica groups)
  2. Stops a Meilisearch node mid-test (docker stop miroir-meili-1)
  3. Verifies that searches still work using remaining replicas
  4. 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:

  1. The RF=2 docker-compose stack to be running
  2. Sufficient memory for 6 Meilisearch containers + Redis
  3. The docker command to be accessible from the test environment

Run with --ignored flag:

cargo test --test integration test_node_failure_rf2 -- --ignored