mirror of
https://github.com/planetmint/planetmint.git
synced 2025-06-07 14:46:38 +00:00
Merge pull request #39 from LaurentDeMontBlanc/integration-test
Integration test
This commit is contained in:
commit
8ca0eec642
@ -15,6 +15,7 @@ elif [[ ${PLANETMINT_ACCEPTANCE_TEST} == 'enable' ]]; then
|
|||||||
./run-acceptance-test.sh
|
./run-acceptance-test.sh
|
||||||
elif [[ ${PLANETMINT_INTEGRATION_TEST} == 'enable' ]]; then
|
elif [[ ${PLANETMINT_INTEGRATION_TEST} == 'enable' ]]; then
|
||||||
./run-integration-test.sh
|
./run-integration-test.sh
|
||||||
|
./scripts/test.sh
|
||||||
else
|
else
|
||||||
docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
|
docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
|
||||||
fi
|
fi
|
||||||
|
@ -38,6 +38,8 @@ matrix:
|
|||||||
- python: 3.9
|
- python: 3.9
|
||||||
env:
|
env:
|
||||||
- PLANETMINT_ACCEPTANCE_TEST=enable
|
- PLANETMINT_ACCEPTANCE_TEST=enable
|
||||||
|
- python: 3.9
|
||||||
|
env:
|
||||||
- PLANETMINT_INTEGRATION_TEST=enable
|
- PLANETMINT_INTEGRATION_TEST=enable
|
||||||
|
|
||||||
|
|
||||||
|
76
scripts/election.sh
Executable file
76
scripts/election.sh
Executable file
@ -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
|
12
scripts/test.sh
Executable file
12
scripts/test.sh
Executable file
@ -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 -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=$?
|
||||||
|
|
||||||
|
exit exitcode
|
Loading…
x
Reference in New Issue
Block a user