Skip to content

Commit

Permalink
config.defaultManagerType beats env.SWINGSET_WORKER_TYPE
Browse files Browse the repository at this point in the history
Previously, the priority order of worker-type specification was:
* highest: config.vats.NAME.creationOptions.managerType
* env.SWINGSET_WORKER_TYPE
* lowest: config.defaultManagerType

The `yarn test:xs` command uses `SWINGSET_WORKER_TYPE=xs-worker` to
use an xsnap worker on any test that doesn't care to be more specific.

However, for a test to express a stronger preference (e.g. because it
looks at snapshots, transcript entries, or metering data), it would
have to use the per-vat `creationOptions` control, which is
inconvenient ot specify for every vat. Also, this control is only
available for static vats: all dynamic vats would use
`env.SWINGSET_WORKER_TYPE`, followed by `config.defaultManagerType`.

With this change, we make the environment variable the lowest-priority
control:
* highest: config.vats.NAME.creationOptions.managerType
* config.defaultManagerType
* lowest: env.SWINGSET_WORKER_TYPE

Tests which need all vats to use a 'local' worker, even under `yarn
test:xs`, can then use `config: { defaultManagerType: 'local }`
without fear of being overridden by the yarn environment.

Tests which do not care should continue to omit `defaultManagerType`,
allowing `yarn test` or `yarn test:xs` to choose for them.
  • Loading branch information
warner committed Apr 23, 2023
1 parent 397e401 commit 43051ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/controller/initializeSwingset.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export async function initializeSwingset(

// Override the worker type if specified by the caller, to avoid having to
// edit the config just to run everything under a different manager.
const defaultManagerType = SWINGSET_WORKER_TYPE || config.defaultManagerType;
const defaultManagerType = config.defaultManagerType || SWINGSET_WORKER_TYPE;
switch (defaultManagerType) {
case 'local':
case 'xsnap': // preferred
Expand Down

0 comments on commit 43051ca

Please sign in to comment.