Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[Zombienet] add upgrade test #5970

Merged
merged 11 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ variables:
CI_IMAGE: "paritytech/ci-linux:production"
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.56"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.2.61"
PIPELINE_SCRIPTS_TAG: "v0.4"

default:
Expand Down Expand Up @@ -231,6 +231,9 @@ build-linux-stable:
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
- echo -n ${VERSION} > ./artifacts/VERSION
- echo -n ${EXTRATAG} > ./artifacts/EXTRATAG
- echo -n ${CI_JOB_ID} > ./artifacts/BUILD_LINUX_JOB_ID
- RELEASE_VERSION=$(./artifacts/polkadot -V | awk '{print $2}'| awk -F "-" '{print $1}')
- echo -n "v${RELEASE_VERSION}" > ./artifacts/BUILD_RELEASE_VERSION
- cp -r scripts/* ./artifacts

test-linux-stable:
Expand Down Expand Up @@ -868,6 +871,38 @@ zombienet-tests-misc-paritydb:
tags:
- zombienet-polkadot-integration-test

zombienet-tests-misc-upgrade-node:
stage: stage3
image: "${ZOMBIENET_IMAGE}"
<<: *kubernetes-env
<<: *zombienet-refs
needs:
- job: publish-polkadot-debug-image
- job: publish-test-collators-image
- job: build-linux-stable
artifacts: true
variables:
GH_DIR: "https://github.com/paritytech/polkadot/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests/misc"
before_script:
- echo "Zombie-net Tests Config"
- echo "${ZOMBIENET_IMAGE_NAME}"
- echo "${PARACHAINS_IMAGE_NAME} ${PARACHAINS_IMAGE_TAG}"
- echo "${GH_DIR}"
- export DEBUG=zombie,zombie::network-node
- BUILD_RELEASE_VERSION="$(cat ./artifacts/BUILD_RELEASE_VERSION)"
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/parity/polkadot:${BUILD_RELEASE_VERSION}"
- export COL_IMAGE=${COLLATOR_IMAGE_NAME}:${COLLATOR_IMAGE_TAG}
- BUILD_LINUX_JOB_ID="$(cat ./artifacts/BUILD_LINUX_JOB_ID)"
- export POLKADOT_PR_BIN_URL="https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/${BUILD_LINUX_JOB_ID}/artifacts/file/artifacts/polkadot"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--test="0002-upgrade-node.feature"
allow_failure: false
retry: 2
tags:
- zombienet-polkadot-integration-test

zombienet-tests-malus-dispute-valid:
stage: stage3
image: "${ZOMBIENET_IMAGE}"
Expand Down
15 changes: 15 additions & 0 deletions zombienet_tests/misc/0002-download-polkadot-from-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -euxo pipefail

TEMP_DIR=/tmp/zombie

# add /tmp/zombie as first `looking dir` to allow to overrides commands.
mkdir -p $TEMP_DIR
export PATH=$TEMP_DIR:$PATH

cd $TEMP_DIR
# see 0002-upgrade-node.feature to view the args.
curl -L -O $1
chmod +x $TEMP_DIR/polkadot
echo $(polkadot --version)
26 changes: 26 additions & 0 deletions zombienet_tests/misc/0002-upgrade-node.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Description: Smoke / Upgrade Node
Network: ./0002-upgrade-node.toml
Creds: config

alice: is up
bob: is up
charlie: is up
dave: is up
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need dave node for this test?


alice: reports block height is at least 10 within 200 seconds
alice: parachain 2000 block height is at least 10 within 200 seconds
bob: reports block height is at least 15 within 240 seconds
bob: parachain 2001 block height is at least 10 within 200 seconds
charlie: reports block height is at least 20 within 320 seconds

# upgrade both nodes
# For testing using native provider you should set this env var
# POLKADOT_PR_BIN_URL=https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/1810914/artifacts/file/artifacts/polkadot
# with the version of polkadot you want to download.
alice: run ./0002-download-polkadot-from-pr.sh with ["{{POLKADOT_PR_BIN_URL}}"] within 200 seconds
bob: run ./0002-download-polkadot-from-pr.sh with ["{{POLKADOT_PR_BIN_URL}}"] within 200 seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This downloads the new polkadot binary, but I don't see it restarting the node using this new binary.


alice: reports block height is at least 40 within 200 seconds
bob: reports block height is at least 40 within 200 seconds
pepoviola marked this conversation as resolved.
Show resolved Hide resolved
alice: parachain 2000 block height is at least 30 within 240 seconds
bob: parachain 2001 block height is at least 30 within 240 seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If download for alice binary download actually takes almost 200s, then bob download also takes almost 200s, then bob has reached block height 30 using the old binary and this check can be a false positive.

The check that new binary makes progress needs to be stronger IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I think we should add support to store the return metric of a test to use in another test. So we can use relative values to assert. I will work on that feature, so we can capture the exact block height before restart the nodes and assert on the progress later.

Thanks!

49 changes: 49 additions & 0 deletions zombienet_tests/misc/0002-upgrade-node.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[settings]
timeout = 1000

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"


[[relaychain.nodes]]
name = "alice"
args = [ "-lparachain=debug,runtime=debug", "--db paritydb" ]

[[relaychain.nodes]]
name = "bob"
args = [ "-lparachain=debug,runtime=debug", "--db rocksdb" ]

[[relaychain.nodes]]
name = "charlie"
args = [ "-lparachain=debug,runtime=debug", "--db paritydb" ]

[[relaychain.nodes]]
name = "dave"
args = [ "-lparachain=debug,runtime=debug", "--db rocksdb" ]


[[parachains]]
id = 2000
addToGenesis = true

[parachains.collator]
name = "collator01"
image = "{{COL_IMAGE}}"
command = "undying-collator"
args = ["-lparachain=debug"]

[[parachains]]
id = 2001
addToGenesis = true

[parachains.collator]
name = "collator02"
image = "{{COL_IMAGE}}"
command = "undying-collator"
args = ["-lparachain=debug"]

[types.Header]
number = "u64"
parent_hash = "Hash"
post_state = "Hash"