Skip to content

Commit

Permalink
check 2
Browse files Browse the repository at this point in the history
  • Loading branch information
wirednkod committed Oct 1, 2023
1 parent ec901be commit 88f2f6a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 113 deletions.
17 changes: 0 additions & 17 deletions .zombienet-tests/0003-calls.toml

This file was deleted.

59 changes: 0 additions & 59 deletions .zombienet-tests/0003-calls.ts

This file was deleted.

7 changes: 0 additions & 7 deletions .zombienet-tests/0003-calls.zndsl

This file was deleted.

File renamed without changes.
52 changes: 52 additions & 0 deletions .zombienet-tests/0003-check-events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { connect } from "./utils"

export async function run(_nodeName: string, networkInfo: any) {
const { chainHead } = await connect(networkInfo)

let initialized = false

let finalizedCount = 0
let finalized = false

let newBlockCount = 0
let newBlock = false

let bestBlockCount = 0
let bestBlock = false

await new Promise((resolve, reject) => {
let requested = false
const chainHeadFollower = chainHead(
true,
(event) => {
console.log("event", event.type)

if (event.type === "newBlock" && ++newBlockCount === 2) {
chainHeadFollower.unpin([event.blockHash])
newBlock = true
return
}

if (initialized || event.type === "initialized") {
initialized = true
return
}

if (event.type === "finalized" && ++finalizedCount === 2) {
finalized = true
}

if (event.type === "bestBlockChanged" && ++bestBlockCount === 5) {
bestBlock = true
}

if (finalized && newBlock && bestBlock) {
resolve(chainHeadFollower.unfollow())
} else {
return
}
},
reject,
)
})
}
7 changes: 7 additions & 0 deletions .zombienet-tests/0003-check-events.zndsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Description: Simple Parachain Smoke Test
Network: ./0003-check-events.toml
Creds: config

alice: is up
bob: is up
alice: ts-script ./0003-check-events.ts within 200 seconds
10 changes: 0 additions & 10 deletions .zombienet-tests/0004-check-events.zndsl

This file was deleted.

20 changes: 0 additions & 20 deletions .zombienet-tests/0004-checkEvents.ts

This file was deleted.

0 comments on commit 88f2f6a

Please sign in to comment.