mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: No integration test for upsert-validator (#2212)
Solution: Write necessary test
This commit is contained in:
parent
d066bfe132
commit
65bb6e5c91
@ -3,5 +3,11 @@
|
||||
set -e -x
|
||||
|
||||
if [[ -z ${TOXENV} ]]; then
|
||||
docker-compose up -d bdb
|
||||
|
||||
if [[ ${BIGCHAINDB_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose up -d bigchaindb
|
||||
else
|
||||
docker-compose up -d bdb
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -27,7 +27,7 @@ ENV BIGCHAINDB_WSSERVER_ADVERTISED_SCHEME ws
|
||||
|
||||
ENV BIGCHAINDB_TENDERMINT_PORT 46657
|
||||
|
||||
ENV BIGCHAINDB_CI_ABCI abci_status
|
||||
ENV BIGCHAINDB_CI_ABCI ${abci_status}
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
|
@ -562,7 +562,8 @@ def _abci_http(request):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def abci_http(abci_server, tendermint_host, tendermint_port):
|
||||
def abci_http(_setup_database, _configure_bigchaindb, abci_server,
|
||||
tendermint_host, tendermint_port):
|
||||
import requests
|
||||
import time
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import json
|
||||
from copy import deepcopy
|
||||
|
||||
import pytest
|
||||
from abci.server import ProtocolHandler
|
||||
@ -8,9 +9,7 @@ from abci.wire import read_message
|
||||
from abci.messages import to_request_deliver_tx, to_request_check_tx
|
||||
|
||||
|
||||
pytestmark = pytest.mark.tendermint
|
||||
|
||||
|
||||
@pytest.mark.tendermint
|
||||
@pytest.mark.bdb
|
||||
def test_app(tb):
|
||||
from bigchaindb.tendermint import App
|
||||
@ -99,3 +98,34 @@ def test_app(tb):
|
||||
|
||||
# when empty block is generated hash of previous block should be returned
|
||||
assert block0['app_hash'] == new_block_hash
|
||||
|
||||
|
||||
@pytest.mark.abci
|
||||
def test_upsert_validator(b, alice):
|
||||
from bigchaindb.backend.query import VALIDATOR_UPDATE_ID
|
||||
from bigchaindb.backend import query, connect
|
||||
from bigchaindb.models import Transaction
|
||||
|
||||
conn = connect()
|
||||
public_key = '1718D2DBFF00158A0852A17A01C78F4DCF3BA8E4FB7B8586807FAC182A535034'
|
||||
power = 1
|
||||
validator = {'pub_key': {'type': 'ed25519',
|
||||
'data': public_key},
|
||||
'power': power}
|
||||
validator_update = {'validator': validator,
|
||||
'update_id': VALIDATOR_UPDATE_ID}
|
||||
|
||||
query.store_validator_update(conn, deepcopy(validator_update))
|
||||
|
||||
tx = Transaction.create([alice.public_key],
|
||||
[([alice.public_key], 1)],
|
||||
asset=None)\
|
||||
.sign([alice.private_key])
|
||||
|
||||
code, message = b.write_transaction(tx, 'broadcast_tx_commit')
|
||||
assert code == 202
|
||||
|
||||
validators = b.get_validators()
|
||||
validators = [(v['pub_key']['data'], v['voting_power']) for v in validators]
|
||||
|
||||
assert ((public_key, power) in validators)
|
||||
|
@ -352,7 +352,6 @@ def test_get_utxoset_merkle_root(b, utxoset):
|
||||
assert merkle_root == expected_merkle_root
|
||||
|
||||
|
||||
@pytest.mark.execute
|
||||
@pytest.mark.abci
|
||||
def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
|
Loading…
x
Reference in New Issue
Block a user