Skip to content

Commit

Permalink
Fix zombienet timeouts for async branch (#2644)
Browse files Browse the repository at this point in the history
* timeout

* fix

* relaxed the test

* lint
  • Loading branch information
timbrinded authored Feb 13, 2024
1 parent 8e2a60a commit 3f65564
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions test/suites/zombie/test_para.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,47 @@ describeSuite({
it({
id: "T03",
title: "Can connect to parachain and execute a transaction",
timeout: 60000,
timeout: 240000,
test: async () => {
const balBefore = (await paraApi.query.system.account(BALTATHAR_ADDRESS)).data.free;

log("Please wait, this will take at least 30s for transaction to complete");

context.waitBlock(5);

await new Promise((resolve) => {
paraApi.tx.balances
.transferAllowDeath(BALTATHAR_ADDRESS, ethers.parseEther("2"))
.signAndSend(charleth, ({ status, events }) => {
if (status.isInBlock) {
log("Transaction is in block");
}
if (status.isFinalized) {
log("Transaction is finalized!");
resolve(events);
}
});
});
// TODO: Renable the below when we are using polkadot 1.7.0
// There is a discrepancy with polkadotJs and 1.3.0
//
// await new Promise((resolve, reject) => {
// paraApi.tx.balances
// .transferAllowDeath(BALTATHAR_ADDRESS, ethers.parseEther("2"))
// .signAndSend(charleth, ({ status, events }) => {
// if (status.isInBlock) {
// log("Transaction is in block");
// }
// if (status.isFinalized) {
// log("Transaction is finalized!");
// resolve(events);
// }

// if (
// status.isDropped ||
// status.isInvalid ||
// status.isUsurped ||
// status.isFinalityTimeout
// ) {
// reject("transaction failed!");
// throw new Error("Transaction failed");
// }
// });
// })

await paraApi.tx.balances
.transferAllowDeath(BALTATHAR_ADDRESS, ethers.parseEther("2"))
.signAndSend(charleth);

// TODO: Remove waitBlock below when we are using polkadot 1.7.0
await context.waitBlock(2);

const balAfter = (await paraApi.query.system.account(BALTATHAR_ADDRESS)).data.free;
expect(balBefore.lt(balAfter)).to.be.true;
Expand Down

0 comments on commit 3f65564

Please sign in to comment.