MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / single_node_election

Function single_node_election

nodedb-raft/src/node/core.rs:294–304  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292
293 #[test]
294 fn single_node_election() {
295 let config = test_config(1, vec![]);
296 let mut node = RaftNode::new(config, MemStorage::new());
297
298 node.election_deadline = Instant::now() - Duration::from_millis(1);
299 node.tick();
300
301 assert_eq!(node.role(), NodeRole::Leader);
302 assert_eq!(node.current_term(), 1);
303 assert_eq!(node.leader_id(), 1);
304 }
305
306 #[test]
307 fn single_node_propose_and_commit() {

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
test_configFunction · 0.70
tickMethod · 0.45

Tested by

no test coverage detected