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

Function full_lifecycle

nodedb-cluster/src/migration.rs:237–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235
236 #[test]
237 fn full_lifecycle() {
238 let mut m = test_migration();
239 assert!(!m.is_active());
240
241 // Phase 1.
242 m.start_base_copy(1_000_000);
243 assert!(m.is_active());
244 m.update_base_copy(500_000);
245 if let MigrationPhase::BaseCopy {
246 bytes_transferred, ..
247 } = m.phase
248 {
249 assert_eq!(bytes_transferred, 500_000);
250 } else {
251 panic!("expected BaseCopy");
252 }
253
254 // Phase 2.
255 m.start_wal_catchup(100, 200);
256 assert!(!m.is_catchup_ready());
257 m.update_wal_catchup(195, 200);
258 assert!(m.is_catchup_ready());
259
260 // Phase 3.
261 m.start_cutover(500).unwrap();
262 assert!(matches!(m.phase, MigrationPhase::AtomicCutOver { .. }));
263
264 // Complete.
265 m.complete(450);
266 assert!(!m.is_active());
267 if let MigrationPhase::Completed {
268 pause_duration_us, ..
269 } = m.phase
270 {
271 assert_eq!(pause_duration_us, 450);
272 }
273 }
274
275 #[test]
276 fn pause_budget_exceeded() {

Callers

nothing calls this directly

Calls 7

test_migrationFunction · 0.85
start_base_copyMethod · 0.80
update_base_copyMethod · 0.80
start_wal_catchupMethod · 0.80
update_wal_catchupMethod · 0.80
start_cutoverMethod · 0.80
completeMethod · 0.45

Tested by

no test coverage detected