Skip to content

Commit

Permalink
update slow-termination test
Browse files Browse the repository at this point in the history
This requires an update each time we add kvStore entries, because it
counts them precisely as we delete them all.
  • Loading branch information
warner committed Oct 26, 2024
1 parent c51ef01 commit 4656cbd
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ async function doSlowTerminate(t, mode) {
.get(vatID);

// 20*2 for imports, 21*2 for exports, 20*2 for promises, 20*1 for
// vatstore = 142. Plus 21 for the usual liveslots stuff, and 6 for
// vatstore = 142. Plus 21 for the usual liveslots stuff, and 7 for
// kernel stuff like vNN.source/options
const initialKVCount = 169;
const initialKVCount = 170;

t.is(remainingKV().length, initialKVCount);
t.false(JSON.parse(kvStore.get('vats.terminated')).includes(vatID));
Expand Down Expand Up @@ -253,36 +253,36 @@ async function doSlowTerminate(t, mode) {
await cleanKV(10, 5); // 5 c-list promises

// that finishes the promises, so the next clean will delete the
// first five of our 47 other kv entries (20 vatstore plus 27
// liveslots overhead
// first five of our 48 other kv entries (20 vatstore plus 28
// overhead)

await cleanKV(5, 5); // 5 other kv
// now there are 42 other kv entries left
t.is(remainingKV().length, 42);
// now there are 43 other kv entries left
t.is(remainingKV().length, 43);

await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 37);
t.is(remainingKV().length, 38);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 32);
t.is(remainingKV().length, 33);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 27);
t.is(remainingKV().length, 28);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 22);
t.is(remainingKV().length, 23);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 17);
t.is(remainingKV().length, 18);
checkTS();
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 12);
t.is(remainingKV().length, 13);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 7);
t.is(remainingKV().length, 8);
await cleanKV(5, 5); // 5 other kv
t.is(remainingKV().length, 2);
t.is(remainingKV().length, 3);

checkTS();

// there are two kv left, so this clean will delete those, then 5 of
// the 7 snapshots
await cleanKV(2, 7); // 2 final kv, and 5 snapshots
// there are three kv left, so this clean will delete those, then 5
// of the 7 snapshots
await cleanKV(3, 8); // 3 final kv, and 5 snapshots
t.deepEqual(remainingKV(), []);
t.is(kernelStorage.kvStore.get(`${vatID}.options`), undefined);
expectedRemainingSnapshots -= 5;
Expand Down

0 comments on commit 4656cbd

Please sign in to comment.