Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for upgrade polkadot version in node #269

Merged
merged 4 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
31 changes: 31 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,34 @@ zombienet-scale-net-config:
retry: 2
tags:
- zombienet-polkadot-integration-test

zombienet-upgrade-node:
stage: deploy
<<: *kubernetes-env
image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
# needs:
# - job: publish-docker-pr

variables:
GH_DIR: 'https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/k8s'

before_script:
- echo "Zombienet Upgrade node"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie*
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export COL_IMAGE="docker.io/paritypr/colander:4519"

script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--test="0001-upgrade-node.feature"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test
2 changes: 1 addition & 1 deletion scripts/zombie-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ do
if [[ $line =~ [^0-9]+([0-9]+) ]]; then
restart "${BASH_REMATCH[1]}"
else
restart
restart 0
fi;
elif [[ "$line" == "pause" ]]; then
pause
Expand Down
1 change: 1 addition & 0 deletions src/networkNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class NetworkNode implements NetworkNodeInterface {
args.push(cmd);

await client.runCommand(args, undefined, true);
return true;
}

async pause() {
Expand Down
10 changes: 9 additions & 1 deletion src/providers/k8s/dynResourceDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@ function make_transfer_containter(): any {
command: [
"ash",
"-c",
`until [ -f ${FINISH_MAGIC_FILE} ]; do echo waiting for tar to finish; sleep 1; done; echo copy files has finished`,
[ "wget https://github.com/moparisthebest/static-curl/releases/download/v7.83.1/curl-amd64 -O /cfg/curl",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you bother downloading curl when you have wget already ?

Copy link
Collaborator Author

@pepoviola pepoviola Jul 15, 2022

Choose a reason for hiding this comment

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

Hi @chevdor, this is an init container since the polkadot image don't have wget or curl and the image run as non-root user I make curl (downloading the static version) available through init containers.

"&&",
"echo downloaded",
"&&",
"chmod +x /cfg/curl",
"&&",
"echo chmoded",
"&&",
`until [ -f ${FINISH_MAGIC_FILE} ]; do echo waiting for tar to finish; sleep 1; done; echo copy files has finished`].join(" ")
],
};
}
Expand Down
11 changes: 11 additions & 0 deletions tests/k8s/0001-upgrade-node.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description: Check that paritydb works without affecting finality lag and block production.
Network: ./0001-upgrade-node.toml
Creds: config


validator-0: reports block height is at least 10 within 120 seconds
# 15 secs to download aprox
validator-0: run ./downloadPolkadot.sh within 200 seconds
validator-0: restart
sleep 20 seconds
validator-0: reports block height is at least 25 within 120 seconds
14 changes: 14 additions & 0 deletions tests/k8s/0001-upgrade-node.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[settings]
timeout = 1000
bootnode = true

[relaychain]
default_image = "docker.io/parity/polkadot:v0.9.25"
chain = "rococo-local"
default_command = "polkadot"


[[relaychain.node_groups]]
name = "validator"
count = 2
args = ["-lparachain=debug", "--db=paritydb"]
11 changes: 11 additions & 0 deletions tests/k8s/downloadPolkadot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -euxo pipefail

# add /cfg as first `looking dir` to allow to overrides commands.
export PATH="/cfg":$PATH

cd /cfg
curl -L -O https://github.com/paritytech/polkadot/releases/download/v0.9.26/polkadot
chmod +x /cfg/polkadot
echo $(polkadot --version)
pepoviola marked this conversation as resolved.
Show resolved Hide resolved