From d6f42d8ee05f7d78858ad0a9a87fa2d0eecce90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kudela?= Date: Mon, 2 Oct 2023 11:33:25 +0200 Subject: [PATCH] Repair failed test case - extend `hive_owner_update_limit` --- .../python_tests/hf26_tests/conftest.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/functional/python_tests/hf26_tests/conftest.py b/tests/functional/python_tests/hf26_tests/conftest.py index 180e203c63..3d9b9fef00 100644 --- a/tests/functional/python_tests/hf26_tests/conftest.py +++ b/tests/functional/python_tests/hf26_tests/conftest.py @@ -1,4 +1,6 @@ -from typing import Dict, Optional +from datetime import datetime +import json +from typing import Dict, Final, Optional import pytest @@ -6,6 +8,8 @@ from shared_tools.complex_networks import init_network +ALTERNATE_CHAIN_JSON_FILENAME: Final[str] = "alternate-chain-spec.json" + def run_with_faketime(node, time): #time example: '2020-01-01T00:00:00' requested_start_time = tt.Time.parse(time) @@ -20,8 +24,12 @@ def node_hf25() -> tt.InitNode: @pytest.fixture def node_hf26() -> tt.InitNode: + change_hive_owner_update_limit(seconds_limit=60) + node = tt.InitNode() - node.run() + node.run( + arguments=["--alternate-chain-spec", str(tt.context.get_current_directory() / ALTERNATE_CHAIN_JSON_FILENAME)]) + return node @@ -142,3 +150,17 @@ def network_after_hf26_without_majority(): 'alpha': alpha_net, 'beta': beta_net, } + + +def change_hive_owner_update_limit(seconds_limit: int) -> None: + current_time = datetime.now() + alternate_chain_spec_content = { + "genesis_time": int(current_time.timestamp()), + "hardfork_schedule": [{"hardfork": 26, "block_num": 1}], + "hive_owner_update_limit": seconds_limit + } + + directory = tt.context.get_current_directory() + directory.mkdir(parents=True, exist_ok=True) + with open(directory / ALTERNATE_CHAIN_JSON_FILENAME, 'w') as json_file: + json.dump(alternate_chain_spec_content, json_file)