Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: a test framework for verifying upgrade of Zoe and ZCF #7966

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

Chris-Hibbert
Copy link
Contributor

refs: #6678

Description

a test framework for verifying upgrade of Zoe and ZCF. This includes bootstrap scripts that can be used to upgrade Zoe and ZCF.

The test starts from the currently installed version of Zoe and ZCF. First it verifies that reallocation via staging and via the helper work and that the version internal to ZCF is not present. It then upgrades Zoe and ZCF as necessary to introduce the new behavior. Finally, it re-runs the initial verification to show that the ZCF internal version works.

This currently fails on the first step since it runs in a state in which the new Zoe/ZCF code has already replaced the old. To check it in, we will change the parity of the test that the new internal zcf.atomicRearrange() is not present, since this version runs in an environment where that change has already been made.

Variants of this test will run on master without this PR to verify that upgrading to the new Zoe/ZCF works, and in
deployment/upgrade-test to show that the upgrade to the new zoe & zcf will succeed. A copy of this code run on master without this PR, with bundles containing the new Zoe & ZCF code will show that the upgrade from the current state succeeds, and zcf's behavior in the probe contract will be different before and after.

Security Considerations

Validates the upgrade plan.

Scaling Considerations

None

Documentation Considerations

None

Testing Considerations

It's all about testing.

@Chris-Hibbert Chris-Hibbert self-assigned this Jun 22, 2023
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch 2 times, most recently from 700e334 to 4f384fc Compare June 22, 2023 21:07
@Chris-Hibbert Chris-Hibbert requested a review from turadg June 22, 2023 22:39
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch 3 times, most recently from ee15adb to 1618fb4 Compare June 23, 2023 00:18
@turadg turadg mentioned this pull request Jun 23, 2023
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch from 1618fb4 to 37ab31a Compare July 17, 2023 16:50
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch from 37ab31a to cde1e35 Compare July 17, 2023 23:45
Chris-Hibbert added a commit that referenced this pull request Jul 20, 2023
Build bundles locally, and add instructions for that.

Fix prober script to survive when the prober was bundled with the
helper version of atomicRearrange from the future, but it's run under
an older docker image.
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the context setup in the modules that use them. "supports" is meant for more generic code. If we ever need multiple bootstrap tests that use the same context setup we can re-evaluate.

/** @typedef {Awaited<ReturnType<typeof makeSwingsetTestKit>>} SwingsetTestKit */

export const makeTestContext = async t => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's only the context for test-vats-restart. why move this from that module to this shared one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there would be more sharing. I moved it back.


// to retain for ESlint, used by typedef
E;

// main/production config doesn't have initialPrice, upon which 'open vaults' depends
const PLATFORM_CONFIG = '@agoric/vats/decentral-itest-vaults-config.json';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be in specified in supports. Each test can choose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved with makeTestContext()

};

export const makeZoeTestContext = async t => {
console.time('DefaultTestContext');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider ZoeTestContext. but also, why put in the common supports? It's used only one in test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed, and moved

const source = `${dirname}/${ZCF_PROBE_SRC}`;

const zcfProbeBundle = await bundleSource(source);
// uncomment and add `import fs from "fs";` to generate a bundle of the prober contract
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please clarify under what conditions someone would need to do this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only needed to build the prober which will be used in the deployment test. Once it has been built once, and checked in with #8018, it won't need to be done again.

But the reviewer of that PR may reasonably demand the ability to reproduce the process, so we describe it here.

@Chris-Hibbert Chris-Hibbert requested a review from turadg July 21, 2023 23:44
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch from 48340ce to 6bea479 Compare July 24, 2023 18:47
Chris-Hibbert added a commit that referenced this pull request Jul 25, 2023
Build bundles locally, and add instructions for that.

Fix prober script to survive when the prober was bundled with the
helper version of atomicRearrange from the future, but it's run under
an older docker image.
Base automatically changed from 6678-upgradeZoeZcf to master July 27, 2023 20:22
@Chris-Hibbert Chris-Hibbert enabled auto-merge July 27, 2023 20:23
It starts from the currently installed version of Zoe and ZCF. First
it verifies that reallocation via staging and via the helper work and
that the version internal to ZCF is not present. It then upgrades Zoe
and ZCF as necessary to introduce the new behavior. Finally, it
re-runs the initial verification to show that the ZCF internal version
works.

This currently fails on the first step since it runs in a state in
which the new Zoe/ZCF code has already replaced the old.

Variants of this test will run on master without this PR to verify
that upgrading to the new Zoe/ZCF works, and in
deployment/upgrade-test to show that the upgrade to the new zoe & zcf
will succeed.
@Chris-Hibbert Chris-Hibbert force-pushed the 6678-test-upgradeZoeZcf branch from 6bea479 to 5813535 Compare July 27, 2023 20:42
@Chris-Hibbert Chris-Hibbert added this pull request to the merge queue Jul 28, 2023
Merged via the queue into master with commit 3a7ade3 Jul 28, 2023
@Chris-Hibbert Chris-Hibbert deleted the 6678-test-upgradeZoeZcf branch July 28, 2023 01:11
mhofman pushed a commit that referenced this pull request Aug 7, 2023
test: a test framework for verifying upgrade of Zoe and ZCF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants