Skip to content

Commit

Permalink
test: update zoe+swingset-using tests to provide zcfBundle
Browse files Browse the repository at this point in the history
This updates unit tests in (zoe, governance, run-protocol), specifically
those which use a swingset environment, to fetch the ZCF contract bundle from
the Zoe package, and install it into the kernel config they build. This is
necessary now that Zoe's `setupCreateZCFVat` no longer includes a copy.

Any new tests which follow this pattern will need to do the same.

refs #4487
  • Loading branch information
warner committed Feb 9, 2022
1 parent 6f88e2b commit 22cda0c
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '@endo/init';
import test from 'ava';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js';
import path from 'path';

const CONTRACT_FILES = ['committee', 'binaryVoteCounter'];
Expand Down Expand Up @@ -47,6 +48,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import path from 'path';

import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js';

const CONTRACT_FILES = [
'committee',
Expand Down Expand Up @@ -62,6 +63,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import { E } from '@agoric/eventual-send';
import path from 'path';
import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js';
import {
governanceBundles,
economyBundles,
Expand Down Expand Up @@ -53,6 +54,7 @@ test.before(async t => {
vats.bootstrap.parameters = { contractBundles };

const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

t.context.data = { kernelBundles, config };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import path from 'path';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import { E } from '@agoric/eventual-send';
import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js';

import liquidateMinimumBundle from '../../../../bundles/bundle-liquidateMinimum.js';
import ammBundle from '../../../../bundles/bundle-amm.js';
Expand Down Expand Up @@ -51,6 +52,7 @@ export const buildSwingSetConfig = async (contractBundles, vatNames) => {
vats.bootstrap.parameters = { contractBundles };

const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';
return config;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import path from 'path';

import { loadBasedir, buildVatController } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';

import fs from 'fs';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

const filename = new URL(import.meta.url).pathname;
const dirname = path.dirname(filename);
Expand All @@ -32,6 +32,7 @@ const generateBundlesP = Promise.all(
async function main(argv) {
const config = await loadBasedir(dirname);
config.defaultManagerType = 'xs-worker';
config.bundles = { zcf: { bundle: zcfBundle } };
await generateBundlesP;
const controller = await buildVatController(config, argv);
await controller.run();
Expand Down
2 changes: 2 additions & 0 deletions packages/zoe/test/swingsetTests/makeKind/test-makeKind.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

const CONTRACT_FILES = ['minimalMakeKindContract'];

Expand Down Expand Up @@ -51,6 +52,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
2 changes: 2 additions & 0 deletions packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

const CONTRACT_FILES = ['offerArgsUsageContract'];

Expand Down Expand Up @@ -51,6 +52,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

const CONTRACT_FILES = ['privateArgsUsageContract'];

Expand Down Expand Up @@ -51,6 +52,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
2 changes: 2 additions & 0 deletions packages/zoe/test/swingsetTests/runMint/test-runMint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

// offerArgsUsageContract is just used as a generic contract for the
// purpose of registering a feeBrand before any zcfMint for the
Expand Down Expand Up @@ -54,6 +55,7 @@ test.before(async t => {
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
config.bundles = { zcf: { bundle: zcfBundle } };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down
4 changes: 3 additions & 1 deletion packages/zoe/test/swingsetTests/zoe/test-zoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import test from 'ava';
import path from 'path';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
import bundleSource from '@endo/bundle-source';
import zcfBundle from '../../../bundles/bundle-contractFacet.js';

const filename = new URL(import.meta.url).pathname;
const dirname = path.dirname(filename);
Expand Down Expand Up @@ -49,6 +50,7 @@ test.before(async t => {
contractBundles[bundleName] = bundle;
}),
);
const bundles = { zcf: { bundle: zcfBundle } };
const step3 = Date.now();

const vats = {};
Expand All @@ -64,7 +66,7 @@ test.before(async t => {
bundle: await bundleSource(bootstrapSource),
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
const config = { bootstrap: 'bootstrap', vats, bundles };
config.defaultManagerType = 'xs-worker';

const step4 = Date.now();
Expand Down

0 comments on commit 22cda0c

Please sign in to comment.