mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
77133f0d6b
@ -13,8 +13,6 @@ if [[ -n ${TOXENV} ]]; then
|
||||
pip install --upgrade tox
|
||||
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose build --no-cache --build-arg abci_status=enable planetmint
|
||||
elif [[ $PLANETMINT_INTEGRATION_TEST == 'enable' ]]; then
|
||||
docker-compose build planetmint python-driver
|
||||
else
|
||||
docker-compose build --no-cache planetmint
|
||||
pip install --upgrade codecov
|
||||
|
@ -13,6 +13,9 @@ elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose exec planetmint pytest -v -m abci
|
||||
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
|
||||
|
@ -38,9 +38,15 @@ matrix:
|
||||
- python: 3.9
|
||||
env:
|
||||
- PLANETMINT_ACCEPTANCE_TEST=enable
|
||||
- python: 3.9
|
||||
env:
|
||||
- PLANETMINT_INTEGRATION_TEST=enable
|
||||
|
||||
|
||||
before_install: sudo .ci/travis-before-install.sh
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_555675f0ff21_key -iv $encrypted_555675f0ff21_iv
|
||||
-in secrets/id_ed25519.enc -out id_ed25519 -d
|
||||
- sudo .ci/travis-before-install.sh
|
||||
|
||||
install: .ci/travis-install.sh
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM alpine:3.9
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
|
||||
ARG TM_VERSION=v0.34.11
|
||||
ARG TM_VERSION=v0.34.15
|
||||
RUN mkdir -p /usr/src/app
|
||||
ENV HOME /root
|
||||
COPY . /usr/src/app/
|
||||
|
36
Makefile
36
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: help run start stop logs test test-unit test-unit-watch test-acceptance cov doc doc-acceptance clean reset release dist check-deps clean-build clean-pyc clean-test
|
||||
.PHONY: help run start stop logs lint test test-unit test-unit-watch test-acceptance test-integration cov docs docs-acceptance clean reset release dist check-deps clean-build clean-pyc clean-test
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
@ -70,6 +70,9 @@ stop: check-deps ## Stop Planetmint
|
||||
logs: check-deps ## Attach to the logs
|
||||
@$(DC) logs -f planetmint
|
||||
|
||||
lint: check-deps ## Lint the project
|
||||
@$(DC) up lint
|
||||
|
||||
test: check-deps test-unit test-acceptance ## Run unit and acceptance tests
|
||||
|
||||
test-unit: check-deps ## Run all tests once
|
||||
@ -82,21 +85,23 @@ test-unit-watch: check-deps ## Run all tests and wait. Every time you change cod
|
||||
test-acceptance: check-deps ## Run all acceptance tests
|
||||
@./run-acceptance-test.sh
|
||||
|
||||
test-integration: check-deps ## Run all integration tests
|
||||
@./run-integration-test.sh
|
||||
|
||||
cov: check-deps ## Check code coverage and open the result in the browser
|
||||
@$(DC) run --rm planetmint pytest -v --cov=planetmint --cov-report html
|
||||
$(BROWSER) htmlcov/index.html
|
||||
|
||||
doc: check-deps ## Generate HTML documentation and open it in the browser
|
||||
docs: check-deps ## Generate HTML documentation and open it in the browser
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/root html
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/server html
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/contributing html
|
||||
$(BROWSER) docs/root/build/html/index.html
|
||||
|
||||
doc-acceptance: check-deps ## Create documentation for acceptance tests
|
||||
docs-acceptance: check-deps ## Create documentation for acceptance tests
|
||||
@$(DC) run --rm python-acceptance pycco -i -s /src -d /docs
|
||||
$(BROWSER) acceptance/python/docs/index.html
|
||||
|
||||
clean: clean-build clean-pyc clean-test ## Remove all build, test, coverage and Python artifacts
|
||||
clean: check-deps ## Remove all build, test, coverage and Python artifacts
|
||||
@$(DC) up clean
|
||||
@$(ECHO) "Cleaning was successful."
|
||||
|
||||
reset: check-deps ## Stop and REMOVE all containers. WARNING: you will LOSE all data stored in Planetmint.
|
||||
@ -123,22 +128,3 @@ ifndef IS_DOCKER_COMPOSE_INSTALLED
|
||||
@$(ECHO)
|
||||
@$(DC) # docker-compose is not installed, so we call it to generate an error and exit
|
||||
endif
|
||||
|
||||
clean-build: # Remove build artifacts
|
||||
@rm -fr build/
|
||||
@rm -fr dist/
|
||||
@rm -fr .eggs/
|
||||
@find . -name '*.egg-info' -exec rm -fr {} +
|
||||
@find . -name '*.egg' -exec rm -f {} +
|
||||
|
||||
clean-pyc: # Remove Python file artifacts
|
||||
@find . -name '*.pyc' -exec rm -f {} +
|
||||
@find . -name '*.pyo' -exec rm -f {} +
|
||||
@find . -name '*~' -exec rm -f {} +
|
||||
@find . -name '__pycache__' -exec rm -fr {} +
|
||||
|
||||
clean-test: # Remove test and coverage artifacts
|
||||
@find . -name '.pytest_cache' -exec rm -fr {} +
|
||||
@rm -fr .tox/
|
||||
@rm -f .coverage
|
||||
@rm -fr htmlcov/
|
||||
|
@ -43,10 +43,11 @@ There are also other commands you can execute:
|
||||
* `make start`: Run Planetmint from source and daemonize it (stop it with `make stop`).
|
||||
* `make stop`: Stop Planetmint.
|
||||
* `make logs`: Attach to the logs.
|
||||
* `make lint`: Lint the project
|
||||
* `make test`: Run all unit and acceptance tests.
|
||||
* `make test-unit-watch`: Run all tests and wait. Every time you change code, tests will be run again.
|
||||
* `make cov`: Check code coverage and open the result in the browser.
|
||||
* `make doc`: Generate HTML documentation and open it in the browser.
|
||||
* `make docs`: Generate HTML documentation and open it in the browser.
|
||||
* `make clean`: Remove all build, test, coverage and Python artifacts.
|
||||
* `make reset`: Stop and REMOVE all containers. WARNING: you will LOSE all data stored in Planetmint.
|
||||
|
||||
|
@ -51,7 +51,7 @@ services:
|
||||
command: '.ci/entrypoint.sh'
|
||||
restart: always
|
||||
tendermint:
|
||||
image: tendermint/tendermint:v0.34.11
|
||||
image: tendermint/tendermint:v0.34.15
|
||||
# volumes:
|
||||
# - ./tmdata:/tendermint
|
||||
entrypoint: ''
|
||||
@ -83,6 +83,17 @@ services:
|
||||
environment:
|
||||
- PLANETMINT_ENDPOINT=planetmint
|
||||
|
||||
# Planetmint setup to do integration testing wtih Python
|
||||
python-integration:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./integration/python/Dockerfile
|
||||
volumes:
|
||||
- ./integration/python/src:/src
|
||||
environment:
|
||||
- PLANETMINT_ENDPOINT_1=https://itest1.planetmint.io
|
||||
- PLANETMINT_ENDPOINT_2=https://itest2.planetmint.io
|
||||
|
||||
# Build docs only
|
||||
# docker-compose build bdocs
|
||||
# docker-compose up -d bdocs
|
||||
@ -103,3 +114,20 @@ services:
|
||||
- '33333:80'
|
||||
volumes:
|
||||
- ./docs/root/build/html:/usr/share/nginx/html
|
||||
|
||||
# Lints project according to PEP8
|
||||
lint:
|
||||
image: alpine/flake8
|
||||
command: --max-line-length 119 /planetmint /acceptance /integration /tests
|
||||
volumes:
|
||||
- ./planetmint:/planetmint
|
||||
- ./acceptance:/acceptance
|
||||
- ./integration:/integration
|
||||
- ./tests:/tests
|
||||
|
||||
# Remove all build, test, coverage and Python artifacts
|
||||
clean:
|
||||
image: alpine
|
||||
command: /bin/sh -c "./planetmint/scripts/clean.sh"
|
||||
volumes:
|
||||
- $PWD:/planetmint
|
@ -30,9 +30,9 @@ The version of Planetmint Server described in these docs only works well with Te
|
||||
|
||||
```bash
|
||||
$ sudo apt install -y unzip
|
||||
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.11/tendermint_v0.34.11_linux_amd64.zip
|
||||
$ unzip tendermint_v0.34.11_linux_amd64.zip
|
||||
$ rm tendermint_v0.34.11_linux_amd64.zip
|
||||
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_v0.34.15_linux_amd64.zip
|
||||
$ unzip tendermint_v0.34.15_linux_amd64.zip
|
||||
$ rm tendermint_v0.34.15_linux_amd64.zip
|
||||
$ sudo mv tendermint /usr/local/bin
|
||||
```
|
||||
|
||||
|
@ -60,7 +60,7 @@ you can do this:
|
||||
.. code::
|
||||
|
||||
$ mkdir $(pwd)/tmdata
|
||||
$ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:v0.34.11 init
|
||||
$ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:v0.34.15 init
|
||||
$ cat $(pwd)/tmdata/genesis.json
|
||||
|
||||
You should see something that looks like:
|
||||
|
15
integration/README.md
Normal file
15
integration/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Integration test suite
|
||||
This directory contains the integration test suite for Planetmint.
|
||||
|
||||
The suite uses Docker Compose to run all tests.
|
||||
|
||||
## Running the tests
|
||||
Run `make test-integration` in the project root directory.
|
||||
|
||||
During development you can run single test use `pytest` inside the `python-integration` container with:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm python-integration pytest <use whatever option you need>
|
||||
```
|
||||
|
||||
Note: The `/src` directory contains all the test within the container.
|
6
integration/python/Dockerfile
Normal file
6
integration/python/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM python:3.9
|
||||
|
||||
RUN mkdir -p /src
|
||||
RUN pip install --upgrade \
|
||||
pytest~=6.2.5 \
|
||||
planetmint-driver~=0.9.0
|
99
integration/python/src/test_basic.py
Normal file
99
integration/python/src/test_basic.py
Normal file
@ -0,0 +1,99 @@
|
||||
# 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
|
||||
|
||||
# import Planetmint and create object
|
||||
from planetmint_driver import Planetmint
|
||||
from planetmint_driver.crypto import generate_keypair
|
||||
import time
|
||||
import os
|
||||
|
||||
|
||||
def test_basic():
|
||||
# Setup up connection to Planetmint integration test nodes
|
||||
pm_itest1_url = os.environ.get('PLANETMINT_ENDPOINT_1')
|
||||
pm_itest2_url = os.environ.get('PLANETMINT_ENDPOINT_1')
|
||||
pm_itest1 = Planetmint(pm_itest1_url)
|
||||
pm_itest2 = Planetmint(pm_itest2_url)
|
||||
|
||||
# genarate a keypair
|
||||
alice, bob = generate_keypair(), generate_keypair()
|
||||
|
||||
# create a digital asset for Alice
|
||||
game_boy_token = {
|
||||
'data': {
|
||||
'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
|
||||
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
|
||||
},
|
||||
}
|
||||
|
||||
# prepare the transaction with the digital asset and issue 10 tokens to bob
|
||||
prepared_creation_tx = pm_itest1.transactions.prepare(
|
||||
operation='CREATE',
|
||||
metadata={
|
||||
'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
|
||||
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',},
|
||||
signers=alice.public_key,
|
||||
recipients=[([alice.public_key], 10)],
|
||||
asset=game_boy_token)
|
||||
|
||||
# fulfill and send the transaction
|
||||
fulfilled_creation_tx = pm_itest1.transactions.fulfill(
|
||||
prepared_creation_tx,
|
||||
private_keys=alice.private_key)
|
||||
pm_itest1.transactions.send_commit(fulfilled_creation_tx)
|
||||
time.sleep(4)
|
||||
|
||||
creation_tx_id = fulfilled_creation_tx['id']
|
||||
|
||||
# retrieve transactions from both planetmint nodes
|
||||
creation_tx_itest1 = pm_itest1.transactions.retrieve(creation_tx_id)
|
||||
creation_tx_itest2 = pm_itest2.transactions.retrieve(creation_tx_id)
|
||||
|
||||
# Assert that transaction is stored on both planetmint nodes
|
||||
assert creation_tx_itest1 == creation_tx_itest2
|
||||
|
||||
# Transfer
|
||||
# create the output and inout for the transaction
|
||||
transfer_asset = {'id': creation_tx_id}
|
||||
output_index = 0
|
||||
output = fulfilled_creation_tx['outputs'][output_index]
|
||||
transfer_input = {'fulfillment': output['condition']['details'],
|
||||
'fulfills': {'output_index': output_index,
|
||||
'transaction_id': transfer_asset['id']},
|
||||
'owners_before': output['public_keys']}
|
||||
|
||||
# prepare the transaction and use 3 tokens
|
||||
prepared_transfer_tx = pm_itest1.transactions.prepare(
|
||||
operation='TRANSFER',
|
||||
asset=transfer_asset,
|
||||
inputs=transfer_input,
|
||||
metadata={'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
|
||||
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', },
|
||||
recipients=[([alice.public_key], 10)])
|
||||
|
||||
# fulfill and send the transaction
|
||||
fulfilled_transfer_tx = pm_itest1.transactions.fulfill(
|
||||
prepared_transfer_tx,
|
||||
private_keys=alice.private_key)
|
||||
sent_transfer_tx = pm_itest1.transactions.send_commit(fulfilled_transfer_tx)
|
||||
|
||||
transfer_tx_id = fulfilled_transfer_tx['id']
|
||||
|
||||
# retrieve transactions from both planetmint nodes
|
||||
transfer_tx_itest1 = pm_itest1.transactions.retrieve(transfer_tx_id)
|
||||
transfer_tx_itest2 = pm_itest2.transactions.retrieve(transfer_tx_id)
|
||||
|
||||
# Assert that transaction is stored on both planetmint nodes
|
||||
assert transfer_tx_itest1 == transfer_tx_itest2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
138
integration/python/src/test_multisig.py
Normal file
138
integration/python/src/test_multisig.py
Normal file
@ -0,0 +1,138 @@
|
||||
# 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
|
||||
|
||||
# # Multisignature integration testing
|
||||
# This test checks if we can successfully create and transfer a transaction
|
||||
# with multiple owners.
|
||||
# The script tests various things like:
|
||||
#
|
||||
# - create a transaction with multiple owners
|
||||
# - check if the transaction is stored and has the right amount of public keys
|
||||
# - transfer the transaction to a third person
|
||||
#
|
||||
# We run a series of checks for each step, that is retrieving
|
||||
# the transaction from the remote system, and also checking the public keys
|
||||
# of a given transaction.
|
||||
#
|
||||
# This integration test is a rip-off of our mutliple signature acceptance tests.
|
||||
|
||||
# ## Imports
|
||||
# We need some utils from the `os` package, we will interact with
|
||||
# env variables.
|
||||
import os
|
||||
|
||||
# For this test case we need import and use the Python driver
|
||||
from planetmint_driver import Planetmint
|
||||
from planetmint_driver.crypto import generate_keypair
|
||||
|
||||
def test_multiple_owners():
|
||||
# ## Set up a connection to the Planetmint integration test nodes
|
||||
pm_itest1 = Planetmint(os.environ.get('PLANETMINT_ENDPOINT_1'))
|
||||
pm_itest2 = Planetmint(os.environ.get('PLANETMINT_ENDPOINT_2'))
|
||||
|
||||
# Generate Keypairs for Alice and Bob!
|
||||
alice, bob = generate_keypair(), generate_keypair()
|
||||
|
||||
# ## Alice and Bob create a transaction
|
||||
# Alice and Bob just moved into a shared flat, no one can afford these
|
||||
# high rents anymore. Bob suggests to get a dish washer for the
|
||||
# kitchen. Alice agrees and here they go, creating the asset for their
|
||||
# dish washer.
|
||||
dw_asset = {
|
||||
'data': {
|
||||
'dish washer': {
|
||||
'serial_number': 1337
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# They prepare a `CREATE` transaction. To have multiple owners, both
|
||||
# Bob and Alice need to be the recipients.
|
||||
prepared_dw_tx = pm_itest1.transactions.prepare(
|
||||
operation='CREATE',
|
||||
signers=alice.public_key,
|
||||
recipients=(alice.public_key, bob.public_key),
|
||||
asset=dw_asset)
|
||||
|
||||
# Now they both sign the transaction by providing their private keys.
|
||||
# And send it afterwards.
|
||||
fulfilled_dw_tx = pm_itest1.transactions.fulfill(
|
||||
prepared_dw_tx,
|
||||
private_keys=[alice.private_key, bob.private_key])
|
||||
|
||||
pm_itest1.transactions.send_commit(fulfilled_dw_tx)
|
||||
|
||||
# We store the `id` of the transaction to use it later on.
|
||||
dw_id = fulfilled_dw_tx['id']
|
||||
|
||||
# Let's retrieve the transaction from both nodes
|
||||
pm_itest1_tx = pm_itest1.transactions.retrieve(dw_id)
|
||||
pm_itest2_tx = pm_itest2.transactions.retrieve(dw_id)
|
||||
|
||||
# Both retrieved transactions should be the same
|
||||
assert pm_itest1_tx == pm_itest2_tx
|
||||
|
||||
# Let's check if the transaction was successful.
|
||||
assert pm_itest1.transactions.retrieve(dw_id), \
|
||||
'Cannot find transaction {}'.format(dw_id)
|
||||
|
||||
# The transaction should have two public keys in the outputs.
|
||||
assert len(
|
||||
pm_itest1.transactions.retrieve(dw_id)['outputs'][0]['public_keys']) == 2
|
||||
|
||||
# ## Alice and Bob transfer a transaction to Carol.
|
||||
# Alice and Bob save a lot of money living together. They often go out
|
||||
# for dinner and don't cook at home. But now they don't have any dishes to
|
||||
# wash, so they decide to sell the dish washer to their friend Carol.
|
||||
|
||||
# Hey Carol, nice to meet you!
|
||||
carol = generate_keypair()
|
||||
|
||||
# Alice and Bob prepare the transaction to transfer the dish washer to
|
||||
# Carol.
|
||||
transfer_asset = {'id': dw_id}
|
||||
|
||||
output_index = 0
|
||||
output = fulfilled_dw_tx['outputs'][output_index]
|
||||
transfer_input = {'fulfillment': output['condition']['details'],
|
||||
'fulfills': {'output_index': output_index,
|
||||
'transaction_id': fulfilled_dw_tx[
|
||||
'id']},
|
||||
'owners_before': output['public_keys']}
|
||||
|
||||
# Now they create the transaction...
|
||||
prepared_transfer_tx = pm_itest1.transactions.prepare(
|
||||
operation='TRANSFER',
|
||||
asset=transfer_asset,
|
||||
inputs=transfer_input,
|
||||
recipients=carol.public_key)
|
||||
|
||||
# ... and sign it with their private keys, then send it.
|
||||
fulfilled_transfer_tx = pm_itest1.transactions.fulfill(
|
||||
prepared_transfer_tx,
|
||||
private_keys=[alice.private_key, bob.private_key])
|
||||
|
||||
sent_transfer_tx = pm_itest1.transactions.send_commit(fulfilled_transfer_tx)
|
||||
|
||||
# Retrieve the fulfilled transaction from both nodes
|
||||
pm_itest1_tx = pm_itest1.transactions.retrieve(fulfilled_transfer_tx['id'])
|
||||
pm_itest2_tx = pm_itest2.transactions.retrieve(fulfilled_transfer_tx['id'])
|
||||
|
||||
# Now compare if both nodes returned the same transaction
|
||||
assert pm_itest1_tx == pm_itest2_tx
|
||||
|
||||
# They check if the transaction was successful.
|
||||
assert pm_itest1.transactions.retrieve(
|
||||
fulfilled_transfer_tx['id']) == sent_transfer_tx
|
||||
|
||||
# The owners before should include both Alice and Bob.
|
||||
assert len(
|
||||
pm_itest1.transactions.retrieve(fulfilled_transfer_tx['id'])['inputs'][0][
|
||||
'owners_before']) == 2
|
||||
|
||||
# While the new owner is Carol.
|
||||
assert pm_itest1.transactions.retrieve(fulfilled_transfer_tx['id'])[
|
||||
'outputs'][0]['public_keys'][0] == carol.public_key
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM tendermint/tendermint:v0.34.11
|
||||
FROM tendermint/tendermint:v0.34.15
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
WORKDIR /
|
||||
USER root
|
||||
|
@ -17,7 +17,7 @@ stack_size=${STACK_SIZE:=4}
|
||||
stack_type=${STACK_TYPE:="docker"}
|
||||
stack_type_provider=${STACK_TYPE_PROVIDER:=""}
|
||||
# NOTE versions prior v0.28.0 have different priv_validator format!
|
||||
tm_version=${TM_VERSION:="v0.34.11"}
|
||||
tm_version=${TM_VERSION:="v0.34.15"}
|
||||
mongo_version=${MONGO_VERSION:="3.6"}
|
||||
stack_vm_memory=${STACK_VM_MEMORY:=2048}
|
||||
stack_vm_cpus=${STACK_VM_CPUS:=2}
|
||||
|
@ -71,7 +71,7 @@ config = {
|
||||
'tendermint': {
|
||||
'host': 'localhost',
|
||||
'port': 26657,
|
||||
'version': 'v0.34.11', # look for __tm_supported_versions__
|
||||
'version': 'v0.34.15', # look for __tm_supported_versions__
|
||||
},
|
||||
# FIXME: hardcoding to localmongodb for now
|
||||
'database': _database_map['localmongodb'],
|
||||
|
@ -7,4 +7,4 @@ __version__ = '0.9.0'
|
||||
__short_version__ = '0.9'
|
||||
|
||||
# Supported Tendermint versions
|
||||
__tm_supported_versions__ = ["0.34.11"]
|
||||
__tm_supported_versions__ = ["0.34.15"]
|
||||
|
35
run-integration-test.sh
Executable file
35
run-integration-test.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env 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
|
||||
|
||||
|
||||
# Check if both integration test nodes are reachable
|
||||
check_status () {
|
||||
OK="200 OK"
|
||||
|
||||
STATUS_1=$(curl -I -s -X GET https://itest1.planetmint.io/ | head -n 1)
|
||||
STATUS_2=$(curl -I -s -X GET https://itest2.planetmint.io/ | head -n 1)
|
||||
|
||||
# Check if both response status codes return 200 OK
|
||||
if ! [[ "$STATUS_1" == *"$OK"* ]] || ! [[ "$STATUS_2" == *"$OK"* ]]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_test () {
|
||||
docker-compose run --rm python-integration pytest /src
|
||||
}
|
||||
|
||||
teardown () {
|
||||
docker-compose down
|
||||
}
|
||||
|
||||
check_status
|
||||
run_test
|
||||
exitcode=$?
|
||||
teardown
|
||||
|
||||
exit $exitcode
|
26
scripts/clean.sh
Executable file
26
scripts/clean.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
cd planetmint
|
||||
|
||||
# Remove build artifacts
|
||||
rm -fr build/
|
||||
rm -fr dist/
|
||||
rm -fr .eggs/
|
||||
find . -name '*.egg-info' -exec rm -fr {} +
|
||||
find . -name '*.egg' -type f -exec rm -f {} +
|
||||
|
||||
# Remove Python file artifacts
|
||||
find . -name '*.pyc' -exec rm -f {} +
|
||||
find . -name '*.pyo' -exec rm -f {} +
|
||||
find . -name '*~' -exec rm -f {} +
|
||||
find . -name '__pycache__' -exec rm -fr {} +
|
||||
|
||||
# Remove test and coverage artifacts
|
||||
find . -name '.pytest_cache' -exec rm -fr {} +
|
||||
rm -fr .tox/
|
||||
rm -f .coverage
|
||||
rm -fr htmlcov/
|
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
|
4
secrets/id_ed25519.enc
Normal file
4
secrets/id_ed25519.enc
Normal file
@ -0,0 +1,4 @@
|
||||
³.˜·ÚÇ9DDÔÒ@£Éê…ôÛïëŸÚŒžÛJÔá–©¹KÐ
çêØÝc÷‡‘^ª»…
|
||||
YÄ/õT |%²Å&âÔvfõ#Ä"â_®P’à#öS¡Ôè4ôiQSýún0‡4?vÞx…N! <20>5Ê;i óŸ÷WH¾P²"Šx§û5ÎÎ9Ç"Œ]i¦"³4ü—‚IòD8ðôÌ‹é¶Ðtý•ÊueŒaÎÿ;˜‡Ô©’ì¾`êÕ‹1Þ¬F·˜ÁXõëP<C3AB>E6ÏŠ×\ô"’Á$eÍO ˆó<CB86><¢õàPèÛ¡Sò&;i¤æ‰Õ¹2V 3Ÿ/ÐJD+;åT£–רL(œtêR9vEû¤ñ-+!ñÂZ±ðŒŠhÛf¸æ5ߤÓ8S.âúG4ÌnŠ«ÄÙáMQüÝ!_ãêzËÜú¶•‹Å`UULì’@·Í¡¼w‹ŸV3@ų?‡ø’)'Å>Û>K¤Cx%);Çä8
|
||||
n÷ÑŽ<C385>5ô¡ù<C2A1>ÆËvj],20ÒÈ<C392>§î;Ðç
mÜÇ(m‡s=©
|
||||
€¯µvK)5ˆT¢Q_ ¹Lð†D¶ƒ™:hüüÉ+<2B>
|
@ -221,7 +221,7 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
|
||||
'tendermint': {
|
||||
'host': 'localhost',
|
||||
'port': 26657,
|
||||
'version': 'v0.34.11'
|
||||
'version': 'v0.34.15'
|
||||
},
|
||||
'log': {
|
||||
'file': LOG_FILE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user