feat(migration): add lock heartbeats, predictive dry-run planning, and stricter ledger option validation
This commit is contained in:
@@ -65,6 +65,24 @@ tap.test('checkpoint: ctx.checkpoint is undefined for non-resumable steps', asyn
|
||||
expect(observed).toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('checkpoint: successful resumable step clears stored progress', async () => {
|
||||
const m1 = new SmartMigration({ targetVersion: '1.1.0', db, ledgerName: 'checkpoint_cleanup' });
|
||||
m1.step('big-job').from('1.0.0').to('1.1.0').resumable().up(async (ctx) => {
|
||||
await ctx.checkpoint!.write('processed', 5);
|
||||
});
|
||||
await m1.run();
|
||||
|
||||
const m2 = new SmartMigration({ targetVersion: '1.2.0', db, ledgerName: 'checkpoint_cleanup' });
|
||||
let resumedFrom: number | undefined;
|
||||
m2
|
||||
.step('big-job').from('1.1.0').to('1.2.0').resumable().up(async (ctx) => {
|
||||
resumedFrom = await ctx.checkpoint!.read<number>('processed');
|
||||
});
|
||||
|
||||
await m2.run();
|
||||
expect(resumedFrom).toBeUndefined();
|
||||
});
|
||||
|
||||
tap.test('cleanup: close shared db', async () => {
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user