lablup / raftify

Experimental High level Raft framework
https://docs.rs/raftify/latest/raftify
Apache License 2.0
36 stars 14 forks source link

feat: Implement integration test parallel execution #157

Closed jopemachine closed 1 month ago

jopemachine commented 1 month ago

This PR enables parallel execution by removing dependencies between integration tests, isolating the file system and network by using different loopback addresses for each test cluster.

Resolve #95.

Note

Even with this PR applied, due to the limitations of the cargo test command, only the integration tests within the same test binary will be executed in parallel.

Let's introduce the cargo-nextest crate to enable parallel execution of all tests.

❯ cargo nextest run
   Compiling harness v0.1.81 (/home/jopemachine/raftify/harness)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 6.08s
------------
 Nextest run ID ba5aa8b4-21fc-409d-9f14-c1719c741bb8 with nextest profile: default
    Starting 21 tests across 12 binaries
        PASS [   0.003s] raftify peers::tests::test_add_wrong_peer_addr
        PASS [   0.005s] raftify peers::tests::test_peers_serial_reserve_peer
        PASS [   0.054s] raftify storage::heed_storage::test::test_storage_apply_snapshot
        PASS [   0.053s] raftify storage::rocksdb_storage::test::test_storage_apply_snapshot
        PASS [   0.069s] raftify storage::heed_storage::test::test_storage_last_index
        PASS [   0.070s] raftify storage::heed_storage::test::test_storage_first_index
        PASS [   0.122s] raftify storage::heed_storage::test::test_storage_compact
        PASS [   0.128s] raftify storage::heed_storage::test::test_storage_term
        PASS [   0.130s] raftify storage::rocksdb_storage::test::test_storage_compact
        PASS [   0.156s] raftify storage::rocksdb_storage::test::test_storage_append
        PASS [   0.163s] raftify storage::heed_storage::test::test_storage_append
        PASS [   0.108s] raftify storage::rocksdb_storage::test::test_storage_last_index
        PASS [   0.109s] raftify storage::rocksdb_storage::test::test_storage_first_index
        PASS [   0.176s] raftify storage::heed_storage::test::test_storage_entries
        PASS [   0.181s] raftify storage::rocksdb_storage::test::test_storage_entries
        PASS [   0.136s] raftify storage::rocksdb_storage::test::test_storage_term
        PASS [   2.134s] harness::bootstrap test_dynamic_bootstrap
        PASS [   2.213s] harness::bootstrap test_static_bootstrap
        PASS [   2.239s] harness::leader_election test_leader_election_in_three_node_cluster
        PASS [   5.082s] harness::leader_election test_leader_election_in_five_node_cluster
        PASS [   8.094s] harness::data_replication test_data_replication
------------
     Summary [   8.095s] 21 tests run: 21 passed, 0 skipped