@@ -15,7 +15,7 @@ Concord is a distributed, strongly-consistent **embedded** key-value store built
1515# Compile the project
1616mix compile
1717
18- # Run all tests
18+ # Run unit tests (fast, isolated)
1919mix test
2020
2121# Run specific test file
@@ -27,6 +27,15 @@ mix test test/concord_test.exs:42
2727# Run with coverage
2828mix test --cover
2929
30+ # Run e2e tests (multi-node, distributed scenarios)
31+ mix test.e2e
32+
33+ # Run only distributed e2e tests
34+ mix test.e2e.distributed
35+
36+ # Run specific e2e test file
37+ MIX_ENV=e2e_test mix test e2e_test/distributed/leader_election_test.exs
38+
3039# Run linting
3140mix credo
3241
@@ -192,15 +201,16 @@ The configuration follows standard Elixir patterns with environment-specific fil
192201
193202## Testing Strategy
194203
195- Test categories:
204+ ### Unit Tests (` test/ ` )
205+
206+ Fast, isolated tests for individual components:
207+
196208- ** Unit Tests** : Basic CRUD operations, validation (e.g., ` test/concord_test.exs ` )
197209- ** Feature Tests** : TTL, compression, bulk operations, queries, indexes
198210- ** Auth Tests** : Token management, authorization flows
199211- ** RBAC Tests** : Role management, ACL rules, permission checking (` test/concord/rbac_test.exs ` - 34 tests)
200212- ** Multi-Tenancy Tests** : Tenant lifecycle, quotas, usage tracking (` test/concord/multi_tenancy_test.exs ` - 41 tests)
201213- ** Telemetry Tests** : Event emission verification
202- - ** Integration Tests** : Multi-node scenarios, HTTP API
203- - ** Performance Tests** : Benchmarks in ` test/performance/ `
204214
205215** Important Testing Notes:**
206216- Tests use ` Concord.TestHelper.start_test_cluster() ` to initialize Ra cluster
@@ -210,6 +220,39 @@ Test categories:
210220- State machine version changes require cluster restart or data cleanup
211221- Tests run with ` async: false ` to avoid Ra cluster conflicts
212222
223+ ### E2E Tests (` e2e_test/ ` )
224+
225+ ** Separate test suite** for distributed, multi-node scenarios:
226+
227+ - ** Leader Election** : Raft leader election and failover (` e2e_test/distributed/leader_election_test.exs ` )
228+ - ** Network Partitions** : Split-brain, quorum behavior, partition healing (` e2e_test/distributed/network_partition_test.exs ` )
229+ - ** Data Consistency** : Replication, concurrent writes, TTL consistency (` e2e_test/distributed/data_consistency_test.exs ` )
230+ - ** Node Failures** : Crash tolerance, recovery, log replay (` e2e_test/distributed/node_failure_test.exs ` )
231+
232+ ** E2E Testing Environment:**
233+ - Uses ` MIX_ENV=e2e_test ` (separate from unit tests)
234+ - Spawns actual Erlang nodes with LocalCluster (3-5 nodes per test)
235+ - Longer execution time: ~ 5 minutes for full suite
236+ - Resource intensive: ~ 1GB RAM, requires EPMD running
237+ - See ` e2e_test/README.md ` for detailed documentation
238+
239+ ** Running E2E Tests:**
240+ ``` bash
241+ # Run all e2e tests
242+ mix test.e2e
243+
244+ # Run only distributed tests
245+ mix test.e2e.distributed
246+
247+ # Run specific e2e test
248+ MIX_ENV=e2e_test mix test e2e_test/distributed/leader_election_test.exs
249+
250+ # Run with verbose output
251+ MIX_ENV=e2e_test mix test e2e_test/ --trace
252+ ```
253+
254+ ### Performance Tests
255+
213256** Running Performance Benchmarks:**
214257``` bash
215258# Run all benchmarks
@@ -235,7 +278,7 @@ mix run test/performance/kv_operations_benchmark.exs
235278- Track leader changes via telemetry events
236279
237280### Important File Locations
238- - Raft logs and snapshots: ` {data_dir}/ ` (default: ` ./data/dev ` in development)
281+ - Raft logs and snapshots: ` {data_dir}/ ` (default: ` ./data/dev ` in development, ` ./data/e2e_test ` in e2e tests )
239282- Ra data directory: ` nonode@nohost/ ` (gitignored - test artifacts)
240283- ETS tables:
241284 - ` :concord_store ` - Main KV storage
@@ -249,6 +292,10 @@ mix run test/performance/kv_operations_benchmark.exs
249292- Audit logs: ` audit_logs/ ` directory (JSONL format)
250293- RBAC module: ` lib/concord/rbac.ex `
251294- Multi-tenancy: ` lib/concord/multi_tenancy.ex ` , ` lib/concord/multi_tenancy/rate_limiter.ex `
295+ - ** E2E Tests** : ` e2e_test/ ` directory (separate from ` test/ ` )
296+ - ` e2e_test/support/e2e_cluster_helper.ex ` - Multi-node cluster utilities
297+ - ` e2e_test/distributed/ ` - Distributed system tests
298+ - ` config/e2e_test.exs ` - E2E test configuration
252299
253300## Feature-Specific Guidance
254301
0 commit comments