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

Function cold_node_must_be_active

nodedb-cluster/src/rebalancer/plan.rs:353–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

351
352 #[test]
353 fn cold_node_must_be_active() {
354 // Node 3 is not Active (it's Draining) → cannot receive.
355 let mut t = topo(&[1, 2, 3]);
356 t.set_state(3, NodeState::Draining);
357 let mut r = RoutingTable::uniform(2, &[1, 2, 3], 1);
358 r.set_leader(0, 1);
359 r.set_leader(1, 1);
360 let metrics = vec![
361 lm(1, 500, 5000, 200.0, 200.0),
362 lm(2, 5, 5, 5.0, 5.0),
363 lm(3, 0, 0, 0.0, 0.0),
364 ];
365 let plan = compute_load_based_plan(&metrics, &r, &t, &RebalancerPlanConfig::default());
366 for m in &plan {
367 assert_ne!(m.target_node, 3, "Draining node must not receive moves");
368 }
369 }
370}

Callers

nothing calls this directly

Calls 4

compute_load_based_planFunction · 0.85
set_leaderMethod · 0.80
topoFunction · 0.70
set_stateMethod · 0.45

Tested by

no test coverage detected