Skip to content

Commit

Permalink
test: ✅ add fork test
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Nov 27, 2024
1 parent ce941a0 commit ad8028f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: ["dev_test", "dev_multi", "dev_seq", "dev_smoke", "papi_dev"]
suite: ["dev_test", "dev_multi", "dev_seq", "dev_smoke", "papi_dev", "fork_test"]
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion test/configs/mbStateOverride.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
[]
[
{
"key": "0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da90b65f88190770e2d4021d80a480ecf9c8300db2442725604b8f5eb172692bb15078205c2",
"value": "0x000000000000000001000000000000000000443945309a7a4800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080"
}
]
5 changes: 1 addition & 4 deletions test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,7 @@
{
"name": "fork_test",
"testFileDir": ["suites/fork_test"],
"runScripts": [
"compile-wasm.ts compile -b tmp/moonbeam -o tmp/wasm -c moonbeam-dev"
],

"foundation": {
"type": "dev",
"launchSpec": [
Expand All @@ -968,7 +966,6 @@
"--ethapi=txpool",
"--no-hardware-benchmarks",
"--no-telemetry",
"--wasmtime-precompiled=tmp/wasm",
"--unsafe-force-node-key-generation",
"--reserved-only",
"--no-grandpa",
Expand Down
105 changes: 0 additions & 105 deletions test/scripts/compile-wasm.ts

This file was deleted.

24 changes: 18 additions & 6 deletions test/suites/fork_test/test_fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,40 @@ describeSuite({
foundationMethods: "dev",
options: {
forkConfig: {
url: "https://moonbeam.public.blastapi.io",
verbose: true
url: "https://moonbeam.unitedbloc.com",
verbose: true,
},
},
testCases: ({ it, context , log}) => {
testCases: ({ it, context, log }) => {
let polkadotJs: ApiPromise;

beforeAll(async () => {
polkadotJs = context.polkadotJs();
log("Waiting a minute for lazy loading to do its thing");
await new Promise((resolve) => setTimeout(resolve, 60_000)); // wait for LL loading 1 minute
});

it({
id: "T01",
title: "Checking that launched node can create blocks",
test: async () => {
const block = (await polkadotJs.rpc.chain.getBlock()).block.header.number.toNumber();
await context.createBlock();
await context.createBlock([], { finalize: false });
const block2 = (await polkadotJs.rpc.chain.getBlock()).block.header.number.toNumber();
expect(block2).to.be.greaterThan(block);
},
});

it({
id: "T02",
title: "Check that state overrides work",
test: async () => {
const testAccount = "0x8300db2442725604b8f5Eb172692Bb15078205c2";
log(`Address: ${testAccount}`);

const {
data: { free },
} = await polkadotJs.query.system.account(testAccount);
expect(free.toBigInt(), "Free balance should be 1337000").toBe(1337000000000000000000n);
},
});
},
});

0 comments on commit ad8028f

Please sign in to comment.