Skip to content

Commit

Permalink
test(vow): check vow consumers for busy loops or hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jun 12, 2024
1 parent 6d3f88c commit c78ff0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
42 changes: 13 additions & 29 deletions packages/boot/test/upgrading/upgrade-vats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,23 +536,18 @@ test('upgrade vat-vow', async t => {
await EV(vowRoot).resolveVowWatchers(localVowsUpdates);
await EV(promiseKit.resolver).resolve('ciao');
t.timeout(10_000);
await EV(fakeVowKit.resolver).reject(
harden({
const upgradeRejection = harden({
status: 'rejected',
reason: {
name: 'vatUpgraded',
upgradeMessage: 'vat upgraded',
incarnationNumber: 0,
}),
);
},
});
await EV(fakeVowKit.resolver).reject(upgradeRejection.reason);
t.timeout(600_000); // t.timeout.clear() not yet available in our ava version
t.deepEqual(dataOnly(await EV(vowRoot).getWatcherResults()), {
promiseForever: {
status: 'rejected',
reason: {
name: 'vatUpgraded',
upgradeMessage: 'vat upgraded',
incarnationNumber: 0,
},
},
promiseForever: upgradeRejection,
promiseFulfilled: { status: 'fulfilled', value: 'hello' },
promiseRejected: { status: 'rejected', reason: 'goodbye' },
vowForever: {
Expand All @@ -562,22 +557,11 @@ test('upgrade vat-vow', async t => {
vowFulfilled: { status: 'fulfilled', value: 'hello' },
vowRejected: { status: 'rejected', reason: 'goodbye' },
vowPostUpgrade: { status: 'fulfilled', value: 'bonjour' },
vowExternalPromise: { status: 'fulfilled', value: 'ciao' },
vowExternalVow: {
status: 'rejected',
reason: {
name: 'vatUpgraded',
upgradeMessage: 'vat upgraded',
incarnationNumber: 0,
},
},
vowPromiseForever: {
status: 'rejected',
reason: {
name: 'vatUpgraded',
upgradeMessage: 'vat upgraded',
incarnationNumber: 0,
},
},
// The 'fulfilled' result below is wishful thinking. Long-lived
// promises are not supported by `watch` at this time.
// vowExternalPromise: { status: 'fulfilled', value: 'ciao' },
vowExternalPromise: upgradeRejection,
vowExternalVow: upgradeRejection,
vowPromiseForever: upgradeRejection,
});
});
2 changes: 1 addition & 1 deletion packages/boot/test/upgrading/vat-vow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const buildRootObject = (_vatPowers, _args, baggage) => {
const zone = makeDurableZone(baggage);
const { watch, makeVowKit } = prepareVowTools(zone.subZone('VowTools'));

/** @typedef {{ status: 'unsettled', resolver?: import('@agoric/vow').VowResolver } | PromiseSettledResult<any>} WatcherResult */
/** @typedef {({ status: 'unsettled' } | PromiseSettledResult<any>) & { resolver?: import('@agoric/vow').VowResolver }} WatcherResult */

/** @type {MapStore<string, WatcherResult>} */
const nameToResult = zone.mapStore('nameToResult');
Expand Down

0 comments on commit c78ff0e

Please sign in to comment.