-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for modify
HIVE_OWNER_UPDATE_LIMIT
- Loading branch information
Michał Kudela
committed
Oct 10, 2023
1 parent
f90c152
commit ce28ad6
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
tests/python/functional/foundation_layer_tests/test_modify_hive_owner_update_limit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
|
||
import test_tools as tt | ||
from hive_local_tools.constants import ALTERNATE_CHAIN_JSON_FILENAME | ||
from hive_local_tools.functional.python import change_hive_owner_update_limit | ||
|
||
|
||
@pytest.mark.testnet | ||
@pytest.mark.parametrize("limit", [6, 15, 30, 45, 90, 180, 360, 720]) | ||
def test_modify_hive_owner_update_limit(limit): | ||
change_hive_owner_update_limit(seconds_limit=limit) | ||
|
||
node = tt.InitNode() | ||
node.run( | ||
arguments=["--alternate-chain-spec", str(tt.context.get_current_directory() / ALTERNATE_CHAIN_JSON_FILENAME)] | ||
) | ||
|
||
limit_in_microseconds = node.api.database.get_config()["HIVE_OWNER_UPDATE_LIMIT"] | ||
assert limit_in_microseconds / 1_000_000 == limit, "The `HIVE_OWNER_UPDATE_LIMIT` was not updated correctly." | ||
|
||
|
||
@pytest.mark.testnet | ||
@pytest.mark.parametrize( | ||
"limit", | ||
[ | ||
5, # the limit cannot be less than default (6 second), | ||
7, # the limit must be divisible by 3, | ||
], | ||
) | ||
def test_invalid_hive_owner_update_limit_modification(limit): | ||
change_hive_owner_update_limit(seconds_limit=limit) | ||
|
||
node = tt.InitNode() | ||
with pytest.raises(TimeoutError): | ||
node.run( | ||
arguments=[ | ||
"--alternate-chain-spec", | ||
str(tt.context.get_current_directory() / ALTERNATE_CHAIN_JSON_FILENAME), | ||
] | ||
) |