forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zombienet: warp-sync integration test added (paritytech#12675)
* zombienet: warp-sync integration test added * spelling * Readme corrected * dir name updated * Check second phase of warp sync * zombienet pipeline enable + naive test network * zombienet stage added * paritypr/substrate-debug image added for zombienet testing * debugs added * debugs added * buildah problem fixed * rollback * runner tag * test name corrected * dir renamed (regex problem) * common code clean up * common code clean up * fix * warp sync test improvements * full sha used as short is too short (https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2051228#L38) * disable tracing for nodes * COMMON_USER -> DOCKERIO_USER * refs reworked * paritypr/substrate image used * DOCKERIO -> DOCKER * generate-ws-db toml cleanup * improvements * fix * raw chain spec used * zombienet v1.3.18 used * zombienet: warp sync test enabled * chain-spec path corrected * log parsing improved Checking if log does not container error or verification failed messages * warp sync test: removed validators * fix * review remarks applied * dir test name changed: 0000_block_building -> 0000-block-building * transaction finalized test added * transaction finalized test: error handling improved * trigger CI job * trigger CI job * trigger CI job * trigger CI job * Explicitly touch `version.rs` to invalidate the related cache * zombienet add logs as artifacts * Revert "Explicitly touch `version.rs` to invalidate the related cache" This reverts commit 9d00ccf. * file naming changed Co-authored-by: parity-processbot <> Co-authored-by: Vladimir Istyufeev <vladimir@parity.io> Co-authored-by: Javier Viola <javier@parity.io>
- Loading branch information
Showing
14 changed files
with
587 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This file is part of .gitlab-ci.yml | ||
# Here are all jobs that are executed during "zombienet" stage | ||
|
||
# common settings for all zombienet jobs | ||
.zombienet-common: | ||
before_script: | ||
- echo "Zombie-net Tests Config" | ||
- echo "${ZOMBIENET_IMAGE}" | ||
- echo "${SUBSTRATE_IMAGE_NAME} ${SUBSTRATE_IMAGE_TAG}" | ||
- echo "${GH_DIR}" | ||
- export DEBUG=zombie,zombie::network-node | ||
- export ZOMBIENET_INTEGRATION_TEST_IMAGE=${SUBSTRATE_IMAGE_NAME}:${SUBSTRATE_IMAGE_TAG} | ||
- echo "${ZOMBIENET_INTEGRATION_TEST_IMAGE}" | ||
stage: zombienet | ||
image: "${ZOMBIENET_IMAGE}" | ||
needs: | ||
- job: publish-docker-substrate-temporary | ||
extends: | ||
- .kubernetes-env | ||
- .zombienet-refs | ||
variables: | ||
GH_DIR: "https://github.com/paritytech/substrate/tree/${CI_COMMIT_SHA}/zombienet" | ||
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1 | ||
artifacts: | ||
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" | ||
when: always | ||
expire_in: 2 days | ||
paths: | ||
- ./zombienet-logs | ||
after_script: | ||
- mkdir -p ./zombienet-logs | ||
- cp /tmp/zombie*/logs/* ./zombienet-logs/ | ||
allow_failure: true | ||
retry: 2 | ||
tags: | ||
- zombienet-polkadot-integration-test | ||
|
||
zombienet-0000-block-building: | ||
extends: | ||
- .zombienet-common | ||
script: | ||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh | ||
--github-remote-dir="${GH_DIR}/0000-block-building" | ||
--test="block-building.zndsl" | ||
|
||
|
||
zombienet-0001-basic-warp-sync: | ||
extends: | ||
- .zombienet-common | ||
script: | ||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh | ||
--github-remote-dir="${GH_DIR}/0001-basic-warp-sync" | ||
--test="test-warp-sync.zndsl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[settings] | ||
enable_tracing = false | ||
|
||
[relaychain] | ||
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" | ||
default_command = "substrate" | ||
chain = "local" | ||
|
||
[[relaychain.nodes]] | ||
name = "alice" | ||
validator = true | ||
|
||
[[relaychain.nodes]] | ||
name = "bob" | ||
validator = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Description: Block building | ||
Network: ./block-building.toml | ||
Creds: config | ||
|
||
alice: is up | ||
bob: is up | ||
|
||
alice: reports node_roles is 4 | ||
bob: reports node_roles is 4 | ||
|
||
alice: reports peers count is at least 1 | ||
bob: reports peers count is at least 1 | ||
|
||
alice: reports block height is at least 5 within 20 seconds | ||
bob: reports block height is at least 5 within 20 seconds | ||
|
||
alice: count of log lines containing "error" is 0 within 2 seconds | ||
bob: count of log lines containing "error" is 0 within 2 seconds | ||
|
||
alice: js-script ./transaction-gets-finalized.js within 30 seconds |
59 changes: 59 additions & 0 deletions
59
zombienet/0000-block-building/transaction-gets-finalized.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//based on: https://polkadot.js.org/docs/api/examples/promise/transfer-events | ||
|
||
const assert = require("assert"); | ||
|
||
async function run(nodeName, networkInfo, args) { | ||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName]; | ||
const api = await zombie.connect(wsUri, userDefinedTypes); | ||
|
||
// Construct the keyring after the API (crypto has an async init) | ||
const keyring = new zombie.Keyring({ type: "sr25519" }); | ||
|
||
// Add Alice to our keyring with a hard-derivation path (empty phrase, so uses dev) | ||
const alice = keyring.addFromUri('//Alice'); | ||
const bob = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; | ||
|
||
// Create a extrinsic, transferring 10^20 units to Bob | ||
const transfer = api.tx.balances.transfer(bob, 10n**20n); | ||
|
||
let transaction_success_event = false; | ||
try { | ||
await new Promise( async (resolve, reject) => { | ||
const unsubscribe = await transfer | ||
.signAndSend(alice, { nonce: -1 }, ({ events = [], status }) => { | ||
console.log('Transaction status:', status.type); | ||
|
||
if (status.isInBlock) { | ||
console.log('Included at block hash', status.asInBlock.toHex()); | ||
console.log('Events:'); | ||
|
||
events.forEach(({ event: { data, method, section }, phase }) => { | ||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString()); | ||
|
||
if (section=="system" && method =="ExtrinsicSuccess") { | ||
transaction_success_event = true; | ||
} | ||
}); | ||
} else if (status.isFinalized) { | ||
console.log('Finalized block hash', status.asFinalized.toHex()); | ||
unsubscribe(); | ||
if (transaction_success_event) { | ||
resolve(); | ||
} else { | ||
reject("ExtrinsicSuccess has not been seen"); | ||
} | ||
} else if (status.isError) { | ||
unsubscribe(); | ||
reject("Transaction status.isError"); | ||
} | ||
|
||
}); | ||
}); | ||
} catch (error) { | ||
assert.fail("Transfer promise failed, error: " + error); | ||
} | ||
|
||
assert.ok("test passed"); | ||
} | ||
|
||
module.exports = { run } |
Oops, something went wrong.