Skip to content

Commit

Permalink
wait cross check balances
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 25, 2022
1 parent 90ec9fa commit df14f59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion integration_tests/configs/replica.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config {
'is-local': false,
'remote-url': 'http://localhost:8080',
'grpc-only': true,
'concurrency': 1,
'concurrency': 6,
},
},
}
17 changes: 8 additions & 9 deletions integration_tests/test_query_only.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import signal
import subprocess
import time
from functools import partial
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
Expand All @@ -13,7 +12,7 @@
from pystarport import ports

from .network import Cronos
from .utils import ADDRS, wait_for_port
from .utils import ADDRS, wait_for_fn, wait_for_port


class Network(NamedTuple):
Expand Down Expand Up @@ -79,7 +78,6 @@ def network(tmp_path_factory):
finally:
httpd.shutdown()
for proc in procs:
print("killing:", proc.pid)
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
proc.wait()
print("killed:", proc.pid)
Expand Down Expand Up @@ -107,11 +105,13 @@ def test_basic(network):
print("address: ", validator, community)
replica_grpc_port = ports.api_port(network.replica.base_port(0))

def print_balance():
print("primary", pcli.balances(community), pcli.balances(validator))
print("replica", grpc_call(replica_grpc_port, community), grpc_call(replica_grpc_port, validator))
def check_balances():
pbalances = [pcli.balances(community), pcli.balances(validator)]
rbalances = [grpc_call(replica_grpc_port, community), grpc_call(replica_grpc_port, validator)]
print("primary", pbalances)
print("replica", rbalances)
return pbalances == rbalances

print_balance()
txhash = pw3.eth.send_transaction(
{
"from": ADDRS["validator"],
Expand All @@ -121,5 +121,4 @@ def print_balance():
)
receipt = pw3.eth.wait_for_transaction_receipt(txhash)
assert receipt.status == 1
time.sleep(1)
print_balance()
wait_for_fn("cross-check-balances", check_balances)

0 comments on commit df14f59

Please sign in to comment.