From 3fd84a8d7f1b8d461c15f1e19bf2dbfce19e76d4 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Thu, 23 Jan 2020 19:57:21 +0100 Subject: [PATCH] Modifies e2e tests so pisad can be run and stop from there --- test/pisa/e2e/conftest.py | 9 +++++++++ test/pisa/e2e/test_basic_e2e.py | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/test/pisa/e2e/conftest.py b/test/pisa/e2e/conftest.py index cef3237..fbf00c9 100644 --- a/test/pisa/e2e/conftest.py +++ b/test/pisa/e2e/conftest.py @@ -1,8 +1,10 @@ import pytest import random +from multiprocessing import Process from decimal import Decimal, getcontext import pisa.conf as conf +from pisa.pisad import main from pisa.utils.auth_proxy import AuthServiceProxy getcontext().prec = 10 @@ -48,6 +50,13 @@ def create_txs(bitcoin_cli): return signed_commitment_tx, signed_penalty_tx +def run_pisad(): + pisad_process = Process(target=main, daemon=True) + pisad_process.start() + + return pisad_process + + def get_random_value_hex(nbytes): pseudo_random_value = random.getrandbits(8 * nbytes) prv_hex = "{:x}".format(pseudo_random_value) diff --git a/test/pisa/e2e/test_basic_e2e.py b/test/pisa/e2e/test_basic_e2e.py index 8c26867..a1b0cec 100644 --- a/test/pisa/e2e/test_basic_e2e.py +++ b/test/pisa/e2e/test_basic_e2e.py @@ -9,13 +9,22 @@ from common.tools import compute_locator from common.appointment import Appointment from common.cryptographer import Cryptographer from pisa.utils.auth_proxy import JSONRPCException -from test.pisa.e2e.conftest import END_TIME_DELTA, build_appointment_data, get_random_value_hex, create_penalty_tx +from test.pisa.e2e.conftest import ( + END_TIME_DELTA, + build_appointment_data, + get_random_value_hex, + create_penalty_tx, + run_pisad, +) # We'll use pisa_cli to add appointments. The expected input format is a list of arguments with a json-encoded # appointment pisa_cli.pisa_api_server = HOST pisa_cli.pisa_api_port = PORT +# Run pisad +pisad_process = run_pisad() + def broadcast_transaction_and_mine_block(bitcoin_cli, commitment_tx, addr): # Broadcast the commitment transaction and mine a block