From 7b677433922d7397769f409b73bc613e6d732def Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Fri, 22 Mar 2024 16:52:57 +1300 Subject: [PATCH] fix tests (#174) * fix tests * more retry on CI --- .../__snapshots__/stable-asset.test.ts.snap | 8 ++--- tests/bridge-sdk/shared.ts | 4 +++ .../__snapshots__/kusama-para.test.ts.snap | 13 ++++---- .../__snapshots__/kusama-relay.test.ts.snap | 29 ++++-------------- .../__snapshots__/polkadot-para.test.ts.snap | 30 ++++++++++--------- .../__snapshots__/polkadot-relay.test.ts.snap | 30 ++++--------------- vitest.config.mts | 2 +- 7 files changed, 44 insertions(+), 72 deletions(-) diff --git a/tests/acala/__snapshots__/stable-asset.test.ts.snap b/tests/acala/__snapshots__/stable-asset.test.ts.snap index 7770e65..691ff4e 100644 --- a/tests/acala/__snapshots__/stable-asset.test.ts.snap +++ b/tests/acala/__snapshots__/stable-asset.test.ts.snap @@ -12,7 +12,7 @@ exports[`acala stable asset > mint overflow > events 1`] = ` "paysFee": "Yes", "weight": { "proofSize": "(rounded 17000)", - "refTime": "(rounded 1400000000)", + "refTime": "(rounded 1300000000)", }, }, }, @@ -62,7 +62,7 @@ exports[`acala stable asset > swap overflow > events 1`] = ` "paysFee": "Yes", "weight": { "proofSize": "(rounded 11000)", - "refTime": "(rounded 3300000000)", + "refTime": "(rounded 3000000000)", }, }, }, @@ -165,7 +165,7 @@ exports[`karura stable asset > mint overflow > events 1`] = ` "paysFee": "Yes", "weight": { "proofSize": "(rounded 17000)", - "refTime": "(rounded 1400000000)", + "refTime": "(rounded 1300000000)", }, }, }, @@ -215,7 +215,7 @@ exports[`karura stable asset > swap overflow > events 1`] = ` "paysFee": "Yes", "weight": { "proofSize": "(rounded 11000)", - "refTime": "(rounded 3300000000)", + "refTime": "(rounded 3000000000)", }, }, }, diff --git a/tests/bridge-sdk/shared.ts b/tests/bridge-sdk/shared.ts index d8476e6..8e342f0 100644 --- a/tests/bridge-sdk/shared.ts +++ b/tests/bridge-sdk/shared.ts @@ -172,6 +172,10 @@ export const buildTests = (tests: ReadonlyArray) => { await fromchain.chain.newBlock() await tochain.chain.newBlock() + if (tochain.api.query.messageQueue) { + // messageQueue always delay XCM for one block for no good reason https://github.com/paritytech/polkadot-sdk/issues/3709 + await tochain.chain.newBlock() + } await sleep(100) const chainBalanceNow = await chainBalance(sdk, fromData, address) diff --git a/tests/xcm-transfer/__snapshots__/kusama-para.test.ts.snap b/tests/xcm-transfer/__snapshots__/kusama-para.test.ts.snap index d7522f9..ab46bfe 100644 --- a/tests/xcm-transfer/__snapshots__/kusama-para.test.ts.snap +++ b/tests/xcm-transfer/__snapshots__/kusama-para.test.ts.snap @@ -520,15 +520,18 @@ exports[`'statemine' -> 'karura' xcm transfer 'USDT' > xcmPallet transfer > to c [ { "data": { - "messageHash": "(hash)", - "messageId": "(hash)", - "weight": { + "id": "(hash)", + "origin": { + "Sibling": 1000, + }, + "success": true, + "weightUsed": { "proofSize": 0, "refTime": 1000000000, }, }, - "method": "Success", - "section": "xcmpQueue", + "method": "Processed", + "section": "messageQueue", }, ] `; diff --git a/tests/xcm-transfer/__snapshots__/kusama-relay.test.ts.snap b/tests/xcm-transfer/__snapshots__/kusama-relay.test.ts.snap index 9b628b6..1a89ef5 100644 --- a/tests/xcm-transfer/__snapshots__/kusama-relay.test.ts.snap +++ b/tests/xcm-transfer/__snapshots__/kusama-relay.test.ts.snap @@ -355,35 +355,16 @@ exports[`'kusama' -> 'karura' xcm transfer 'KSM' > xcmPallet transfer > to chain [ { "data": { - "count": 1, - }, - "method": "DownwardMessagesReceived", - "section": "parachainSystem", - }, - { - "data": { - "messageHash": "(hash)", - "messageId": "(hash)", - "outcome": { - "Complete": { - "proofSize": 0, - "refTime": 1000000000, - }, - }, - }, - "method": "ExecutedDownward", - "section": "dmpQueue", - }, - { - "data": { - "dmqHead": "(hash)", + "id": "(hash)", + "origin": "Parent", + "success": true, "weightUsed": { "proofSize": 0, "refTime": 1000000000, }, }, - "method": "DownwardMessagesProcessed", - "section": "parachainSystem", + "method": "Processed", + "section": "messageQueue", }, ] `; diff --git a/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap b/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap index 6fdceb7..6ca955e 100644 --- a/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap +++ b/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap @@ -543,17 +543,16 @@ exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > to chain [ { "data": { - "messageHash": "(hash)", - "messageId": "(hash)", - "outcome": { - "Complete": { - "proofSize": 0, - "refTime": 1000000000, - }, + "id": "(hash)", + "origin": "Parent", + "success": true, + "weightUsed": { + "proofSize": 0, + "refTime": 1000000000, }, }, - "method": "ExecutedDownward", - "section": "dmpQueue", + "method": "Processed", + "section": "messageQueue", }, ] `; @@ -731,15 +730,18 @@ exports[`'statemint' -> 'acala' xcm transfer 'WBTC' > xcmPallet transfer > to ch [ { "data": { - "messageHash": "(hash)", - "messageId": "(hash)", - "weight": { + "id": "(hash)", + "origin": { + "Sibling": 1000, + }, + "success": true, + "weightUsed": { "proofSize": 0, "refTime": 1000000000, }, }, - "method": "Success", - "section": "xcmpQueue", + "method": "Processed", + "section": "messageQueue", }, ] `; diff --git a/tests/xcm-transfer/__snapshots__/polkadot-relay.test.ts.snap b/tests/xcm-transfer/__snapshots__/polkadot-relay.test.ts.snap index 917772c..44bd17e 100644 --- a/tests/xcm-transfer/__snapshots__/polkadot-relay.test.ts.snap +++ b/tests/xcm-transfer/__snapshots__/polkadot-relay.test.ts.snap @@ -355,35 +355,16 @@ exports[`'polkadot' -> 'acala' xcm transfer 'DOT' > xcmPallet transfer > to chai [ { "data": { - "count": 1, - }, - "method": "DownwardMessagesReceived", - "section": "parachainSystem", - }, - { - "data": { - "messageHash": "(hash)", - "messageId": "(hash)", - "outcome": { - "Complete": { - "proofSize": 0, - "refTime": 1000000000, - }, - }, - }, - "method": "ExecutedDownward", - "section": "dmpQueue", - }, - { - "data": { - "dmqHead": "(hash)", + "id": "(hash)", + "origin": "Parent", + "success": true, "weightUsed": { "proofSize": 0, "refTime": 1000000000, }, }, - "method": "DownwardMessagesProcessed", - "section": "parachainSystem", + "method": "Processed", + "section": "messageQueue", }, ] `; @@ -442,6 +423,7 @@ exports[`'polkadot' -> 'astar' xcm transfer 'DOT' > xcmPallet transfer > to chai }, { "data": { + "messageHash": "(hash)", "messageId": "(hash)", "outcome": { "Complete": { diff --git a/vitest.config.mts b/vitest.config.mts index 76340c7..c1be4ff 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -7,7 +7,7 @@ export default defineConfig({ testTimeout: 240_000, pool: 'forks', passWithNoTests: true, - retry: 2, + retry: process.env.CI ? 3 : 2, }, plugins: [swc.vite()], })