From 17b710fda7d6e9b5a059489a6d96f12130a5da7f Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Mon, 14 Feb 2022 12:27:03 +0100 Subject: [PATCH 1/5] added integration tests to travix matrix --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index e1ec9c3..70beaa5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,9 +38,11 @@ matrix: - python: 3.9 env: - PLANETMINT_ACCEPTANCE_TEST=enable + - python: 3.9 - PLANETMINT_INTEGRATION_TEST=enable + before_install: sudo .ci/travis-before-install.sh install: .ci/travis-install.sh From 852432b5ac30de954706074e1477dd051d44dd01 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Tue, 15 Feb 2022 09:37:34 +0100 Subject: [PATCH 2/5] fixed env typo in travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 70beaa5..dc13169 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,7 @@ matrix: env: - PLANETMINT_ACCEPTANCE_TEST=enable - python: 3.9 + env: - PLANETMINT_INTEGRATION_TEST=enable From cdb465d6bc3f28a8d8831a15e917bf25fcfde6d3 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Wed, 16 Feb 2022 16:42:11 +0100 Subject: [PATCH 3/5] added election script --- scripts/election.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 scripts/election.sh diff --git a/scripts/election.sh b/scripts/election.sh new file mode 100755 index 0000000..0ff2d00 --- /dev/null +++ b/scripts/election.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +# Change user and activate virtualenv +activate () { + cd /home/bigchaindb + source env/bigchaindb/bin/activate +} + +# Show tendermint node id +show_id () { + su tendermint -c "cd && go/bin/tendermint show_node_id" +} + +# Show validator public key +show_validator () { + su tendermint -c "cd && go/bin/tendermint show_validator" +} + +# Elect new voting power for node +elect_validator () { + activate + bigchaindb election new upsert-validator $1 $2 $3 --private-key /tmp/priv_validator_key.json +} + +# Show election state +show_election () { + activate + bigchaindb election show $1 +} + +# Approve election +approve_validator () { + activate + bigchaindb election approve $1 --private-key /tmp/priv_validator_key.json +} + +# Fetch tendermint id and pubkey and create upsert proposal +elect () { + node_id=$(show_id) + validator_pubkey=$(show_validator | jq -r .value) + proposal=$(elect_validator $validator_pubkey $1 $node_id 2>&1 | grep SUCCESS) + echo ${proposal##* } +} + +usage () { + echo "usage: TODO" +} + +while [ "$1" != "" ]; do + case $1 in + show_id ) show_id + ;; + show_validator ) show_validator + ;; + elect ) shift + elect $1 + ;; + show_election ) shift + show_election $1 + ;; + approve ) shift + approve_validator $1 + ;; + * ) usage + exit 1 + esac + shift +done + +exitcode=$? + +exit $exitcode \ No newline at end of file From f2a87a2c9ceef60795825bcfa94033e46f301e4c Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Thu, 17 Feb 2022 08:48:59 +0100 Subject: [PATCH 4/5] added script for ci testing Signed-off-by: Lorenz Herzberger --- .ci/travis_script.sh | 1 + scripts/test.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100755 scripts/test.sh diff --git a/.ci/travis_script.sh b/.ci/travis_script.sh index 5cf1d43..8525f79 100755 --- a/.ci/travis_script.sh +++ b/.ci/travis_script.sh @@ -15,6 +15,7 @@ elif [[ ${PLANETMINT_ACCEPTANCE_TEST} == 'enable' ]]; then ./run-acceptance-test.sh elif [[ ${PLANETMINT_INTEGRATION_TEST} == 'enable' ]]; then ./run-integration-test.sh + ./scripts/test.sh else docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml fi diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..bec85ba --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright © 2020 Interplanetary Database Association e.V., +# Planetmint and IPDB software contributors. +# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) +# Code is Apache-2.0 and docs are CC-BY-4.0 + +result=$(ssh root@64.225.106.52 'bash -s' < ./election.sh elect 35) +ssh root@64.225.105.60 'bash -s' < ./election.sh approve $result + +exitcode=$? + +exit exitcode \ No newline at end of file From 54c04b386752e387b3570cf9b79fdb11dabf2e96 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Thu, 17 Feb 2022 08:52:29 +0100 Subject: [PATCH 5/5] added ci secret to test script Signed-off-by: Lorenz Herzberger --- scripts/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index bec85ba..0d78298 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -4,8 +4,8 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -result=$(ssh root@64.225.106.52 'bash -s' < ./election.sh elect 35) -ssh root@64.225.105.60 'bash -s' < ./election.sh approve $result +result=$(ssh root@64.225.106.52 -i id_ed25519 'bash -s' < ./election.sh elect 35) +ssh root@64.225.105.60 -i id_ed25519 'bash -s' < ./election.sh approve $result exitcode=$?