Use the client to do the loadtest

This commit is contained in:
vrde 2016-04-14 11:47:52 +02:00
parent 891289ed66
commit d5af7a641d
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D
2 changed files with 5 additions and 8 deletions

View File

@ -1,7 +1,6 @@
import requests
import bigchaindb
from bigchaindb import util
from bigchaindb import config_utils
from bigchaindb import exceptions
from bigchaindb import crypto
@ -112,5 +111,5 @@ def temp_client():
"""
private_key, public_key = crypto.generate_key_pair()
return Client(private_key=private_key, public_key=public_key, api_endpoint='http://localhost:5000/api/v1')
return Client(private_key=private_key, public_key=public_key, api_endpoint=bigchaindb.config['api_endpoint'])

View File

@ -7,23 +7,21 @@ import logstats
import bigchaindb
import bigchaindb.config_utils
from bigchaindb.util import ProcessGroup
from bigchaindb.client import temp_client
from bigchaindb.commands.utils import base_parser, start
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
USER_PUBLIC_KEY = 'qZAN9Ngs1v4qP1T5UBYw75M5f2ej7mAJx8gBMF4BBWtZ'
def _run_load(tx_left, stats):
logstats.thread.start(stats)
b = bigchaindb.Bigchain()
client = temp_client()
# b = bigchaindb.Bigchain()
while True:
tx = b.create_transaction(b.me, USER_PUBLIC_KEY, None, 'CREATE')
tx_signed = b.sign_transaction(tx, b.me_private)
b.write_transaction(tx_signed)
tx = client.create()
stats['transactions'] += 1