fix: preserve archive restores after pruning
This commit is contained in:
@@ -185,6 +185,19 @@ tap.test('should prune with keepLast=1', async () => {
|
||||
// Verify only 1 snapshot remains
|
||||
const snapshots = await repo.listSnapshots();
|
||||
expect(snapshots.length).toEqual(1);
|
||||
|
||||
// The remaining snapshot must still restore after partial-pack GC rewrites chunks.
|
||||
const restoreStream = await repo.restore(snapshots[0].id, { item: 'config.tar' });
|
||||
const chunks: Buffer[] = [];
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
restoreStream.on('data', (chunk: Buffer) => chunks.push(chunk));
|
||||
restoreStream.on('end', resolve);
|
||||
restoreStream.on('error', reject);
|
||||
});
|
||||
|
||||
const restored = Buffer.concat(chunks);
|
||||
const expected = Buffer.alloc(32 * 1024, 'item-two-data');
|
||||
expect(restored.equals(expected)).toBeTrue();
|
||||
});
|
||||
|
||||
// ==================== Close ====================
|
||||
|
||||
Reference in New Issue
Block a user