Skip to content

Commit

Permalink
fix other swingset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Apr 29, 2023
1 parent 96c70a5 commit 0562ec5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
42 changes: 21 additions & 21 deletions packages/SwingSet/test/vat-warehouse/test-reload-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,50 +51,50 @@ test('vat reload from snapshot', async t => {
c1.queueToVatRoot('target', 'count', []);
// * 2: message (count=0)
// * then we hit snapshotInitial
// * 3: save-snapshot
// * 4: load-snapshot
// * 3: BOYD
// * 4: save-snapshot
// * 5: load-snapshot
expected1.push(`count = 0`);
await c1.run();
t.deepEqual(c1.dump().log, expected1);
t.deepEqual(getPositions(), [3, 4, 5]);
t.deepEqual(getPositions(), [4, 5, 6]);

for (let i = 1; i < 11; i += 1) {
c1.queueToVatRoot('target', 'count', []);
// * 5: message (count=1)
// * 6: message (count=2)
// * 7: message (count=3)
// * 6: message (count=1)
// * 7: message (count=2)
// * 8: message (count=3)
// * 9: message (count=4)
// * then we hit snapshotInterval
// * 8: save-snapshot
// * 9: load-snapshot
// * 10: message (count=4)
// * 11: message (count=5)
// * 12: message (count=6)
// * then we hit snapshotInterval
// * 13: save-snapshot
// * 14: load-snapshot
// * 9: BOYD
// * 10: save-snapshot
// * 11: load-snapshot
// * 12: message (count=5)
// * 13: message (count=6)
// * 15: message (count=7)
// * 16: message (count=8)
// * 17: message (count=9)
// * then we hit snapshotInterval
// * 17: BOYD
// * 18: save-snapshot
// * 19: load-snapshot
// * 20: message (count=10)
// * 20: message (count=9)
// * 21: message (count=10)
expected1.push(`count = ${i}`);
}
await c1.run();
t.deepEqual(c1.dump().log, expected1);
t.deepEqual(getPositions(), [18, 19, 21]);
t.deepEqual(getPositions(), [18, 19, 22]);
await c1.shutdown();

// the worker will start with the load-snapshot at d19, and replay d20
// the worker will start with the load-snapshot at d19, and replay d20+d21
const c2 = await makeSwingsetController(kernelStorage);
const expected2 = [`count = 10`];
const expected2 = [`count = 9`, `count = 10`];
t.deepEqual(c2.dump().log, expected2); // replayed 4 deliveries
c2.queueToVatRoot('target', 'count', []);
// * 21: message(count=11)
// * 22: message(count=11)
expected2.push(`count = 11`);
await c2.run();
t.deepEqual(c2.dump().log, expected2); // note: *not* 0-11
t.deepEqual(getPositions(), [18, 19, 22]);
t.deepEqual(getPositions(), [18, 19, 23]);
await c2.shutdown();
});
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ test('xsnap bundles are stable', async t => {
// snapshotInitial: 2

// now allow the bootstrap message to be delivered as deliveryNum=1,
// which should trigger a snapshot, which is recorded in a
// save-snapshot as deliveryNum=2
// which should trigger a snapshot, which first performs a BOYD in
// deliveryNum=2, then the snapshot is recorded in a save-snapshot
// as deliveryNum=3
t.is(snapStore.getSnapshotInfo('v1'), undefined);
await c2.run();
t.is(snapStore.getSnapshotInfo('v1')?.snapPos, 2);
t.is(snapStore.getSnapshotInfo('v1')?.snapPos, 3);
await c2.shutdown;

// now that the worker has a snapshot, the vat preload won't fetch
Expand Down

0 comments on commit 0562ec5

Please sign in to comment.