Skip to content

Commit 9dbd9f4

Browse files
wolfsoftwaresystemsltdPaul C
andauthored
replication: fix test build drift (Heartbeat.members, LeaderNode::new, WalWriter) (#5)
The wolfscale lib-test target failed to compile (5 errors) because test code had drifted from the current lib API. The library itself built fine, so this was only caught when running `cargo test`. - protocol.rs: `Message::Heartbeat` gained a `members: Vec<(String, String)>` field; add it to the test constructor and ignore it in the match pattern. - leader.rs: `LeaderNode::new` gained an 8th `executor: Option<Arc<MariaDbExecutor>>` argument; pass `None` in the test. - follower.rs: qualify `WalWriter` as `crate::wal::WalWriter` in the test (the type was never imported into this module). No production code changed — test-only fixes. `cargo test`: 44 passed. Co-authored-by: Paul C <paulc@wolf.uk.com>
1 parent 4c8036d commit 9dbd9f4

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/replication/follower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ mod tests {
711711
let dir = tempdir().unwrap();
712712
let (tx, _rx) = mpsc::channel(100);
713713

714-
let wal_writer = WalWriter::new(
714+
let wal_writer = crate::wal::WalWriter::new(
715715
dir.path().to_path_buf(),
716716
test_wal_config(),
717717
"follower".to_string(),

src/replication/leader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ mod tests {
741741
cluster,
742742
ReplicationConfig::default(),
743743
tx,
744+
None,
744745
);
745746
}
746747
}

src/replication/protocol.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,14 @@ mod tests {
285285
term: 1,
286286
leader_id: "node-1".to_string(),
287287
commit_lsn: 100,
288+
members: vec![],
288289
};
289290

290291
let bytes = msg.serialize().unwrap();
291292
let restored = Message::deserialize(&bytes).unwrap();
292293

293294
match restored {
294-
Message::Heartbeat { term, leader_id, commit_lsn } => {
295+
Message::Heartbeat { term, leader_id, commit_lsn, .. } => {
295296
assert_eq!(term, 1);
296297
assert_eq!(leader_id, "node-1");
297298
assert_eq!(commit_lsn, 100);

0 commit comments

Comments
 (0)