Skip to content

Commit

Permalink
fix upgrade e2e test (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored Jun 19, 2024
1 parent c9f25a8 commit e790efd
Show file tree
Hide file tree
Showing 4 changed files with 1,708 additions and 1,158 deletions.
9 changes: 5 additions & 4 deletions tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
"version": "1.0.0",
"description": "Astar end to end tests.",
"license": "MIT",
"type": "module",
"scripts": {
"test": "LOG_LEVEL=error vitest --silent --no-color",
"test:runtime-upgrade-shibuya": "RUNTIME=shibuya yarn test tests/runtime-upgrade.test.ts",
"test:runtime-upgrade-shiden": "RUNTIME=shiden yarn test tests/runtime-upgrade.test.ts",
"test:runtime-upgrade-astar": "RUNTIME=astar yarn test tests/runtime-upgrade.test.ts"
},
"dependencies": {
"@acala-network/chopsticks-testing": "^0.6.4",
"@polkadot/util-crypto": "^10.1.10",
"typescript": "^4.8.4",
"vitest": "^0.31.0"
"@acala-network/chopsticks-testing": "^0.12.2",
"@polkadot/util-crypto": "^12.6.2",
"typescript": "^5.3.0",
"vitest": "^1.4.0"
},
"prettier": {
"tabWidth": 2,
Expand Down
11 changes: 6 additions & 5 deletions tests/e2e/tests/runtime-upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@ describe('runtime upgrade', async () => {
const { alice } = testingPairs();

const runtime = process.env.RUNTIME || 'shibuya';
const cxt = await setupContext({ endpoint: endpoints[runtime] });
const { api, dev } = cxt;
const { api, dev, teardown } = await setupContext({ endpoint: endpoints[runtime] });

beforeAll(async () => {
await dev.setStorage({
Sudo: {
Key: alice.address,
},
System: {
Account: [[[alice.address], { data: { free: 100n * 10n ** 18n } }]],
Account: [[[alice.address], { providers: 1, data: { free: 1000n * 10n ** 18n } }]],
},
});
});

afterAll(async () => {
await cxt.teardown();
await teardown();
});

// Execution hook before runtime upgrade. To test storage migrations, set up the storage items
Expand Down Expand Up @@ -73,12 +72,14 @@ describe('runtime upgrade', async () => {
await api.tx.sudo
.sudoUncheckedWeight(
api.tx.system.setCode('0x' + code.toString('hex')),
0
{}
)
.signAndSend(alice);

// Do block production.
await dev.newBlock({ count: 2 });
// wait a bit for pjs/api to update
await new Promise((r) => setTimeout(r, 1000));

// The spec version is increased.
const curSpecVersion = await specVersion(api);
Expand Down
File renamed without changes.
Loading

0 comments on commit e790efd

Please sign in to comment.