Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Increasing tolerance in stress.py, and fixing nightly.txt #2228

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nightly/nightly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pytest --timeout=600 sanity/state_sync_routed.py manytx 100
pytest --timeout=300 sanity/state_sync_late.py notx
pytest sanity/rpc_tx_forwarding.py
pytest --timeout=240 sanity/skip_epoch.py
pytest --timeout=600 sanity/fork_sync.py
pytest --timeout=240 sanity/one_val.py
pytest --timeout=240 sanity/lightclnt.py
pytest --timeout=240 sanity/rpc_query.py
Expand All @@ -35,6 +34,7 @@ pytest --timeout=2000 stress/stress.py 3 2 4 0 staking transactions node_set
# pytest stress/network_stress.py

# python adversarial tests
pytest --timeout=600 adversarial/fork_sync.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

pytest adversarial/wrong_sync_info.py
pytest adversarial/malicious_chain.py
pytest adversarial/malicious_chain.py valid_blocks_only
Expand Down
16 changes: 16 additions & 0 deletions pytest/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,19 @@ def user_name():
if username == 'root': # digitalocean
username = gcloud.list()[0].username.replace('_nearprotocol_com', '')
return username

# from https://stackoverflow.com/questions/107705/disable-output-buffering
# this class allows making print always flush by executing
#
# sys.stdout = Unbuffered(sys.stdout)
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines(datas)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
10 changes: 6 additions & 4 deletions pytest/tests/stress/stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
sys.path.append('lib')

from cluster import init_cluster, spin_up_node, load_config
from utils import TxContext
from utils import TxContext, Unbuffered
from transaction import sign_payment_tx, sign_staking_tx
from network import init_network_pillager, stop_network, resume_network

sys.stdout = Unbuffered(sys.stdout)

TIMEOUT = 1500 # after how much time to shut down the test
TIMEOUT_SHUTDOWN = 120 # time to wait after the shutdown was initiated before
MAX_STAKE = int(1e26)
Expand Down Expand Up @@ -449,14 +451,14 @@ def doit(s, n, N, k, monkeys, timeout):
if config['local']:
init_network_pillager()
expect_network_issues()
block_timeout += 20
block_timeout += 40
tx_tolerance += 0.3
if 'monkey_node_restart' in monkey_names:
expect_network_issues()
if 'monkey_node_restart' in monkey_names or 'monkey_node_set' in monkey_names:
block_timeout += 20
block_timeout += 40
balances_timeout += 10
tx_tolerance += 0.4
tx_tolerance += 0.5

stopped = Value('i', 0)
error = Value('i', 0)
Expand Down