Merge pull request #10 from status-im/chore/adjustments

fixes
This commit is contained in:
fbarbu15 2024-09-11 20:50:48 +03:00 committed by GitHub
commit 0c6974d5cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 8 deletions

View File

@ -19,9 +19,9 @@ def get_env_var(var_name, default=None):
# Configuration constants. Need to be upercase to appear in reports
NUM_MESSAGES = get_env_var("NUM_MESSAGES", 50)
PRIVATE_GROUPS = get_env_var("NUM_MESSAGES", 50)
NUM_CONTACT_REQUESTS = get_env_var("NUM_CONTACT_REQUESTS", 10)
NUM_MESSAGES = get_env_var("NUM_MESSAGES", 25)
PRIVATE_GROUPS = get_env_var("NUM_MESSAGES", 25)
NUM_CONTACT_REQUESTS = get_env_var("NUM_CONTACT_REQUESTS", 5)
DELAY_BETWEEN_MESSAGES = get_env_var("DELAY_BETWEEN_MESSAGES", 1)
RUNNING_IN_CI = get_env_var("CI")
API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 10)

View File

@ -19,7 +19,19 @@ class StatusNodeRPC:
params = []
payload = {"jsonrpc": "2.0", "method": method, "params": params, "id": 1}
logger.debug(f"Node: {self.node_name} sends request at address: {self.base_url} with payload: {json.dumps(payload)}")
response = requests.post(self.base_url, headers={"Content-Type": "application/json"}, data=json.dumps(payload), timeout=timeout)
logger.debug(f"Received response: {response.text}")
assert "result" in response.json()
return response.json()
try:
response = requests.post(self.base_url, headers={"Content-Type": "application/json"}, data=json.dumps(payload), timeout=timeout)
logger.debug(f"Received response: {response.text}")
response.raise_for_status()
assert "result" in response.json(), "Response does not contain 'result' key."
return response.json()
except requests.exceptions.ReadTimeout:
error_message = f"Request to {self.base_url} usig method {method} timed out after {timeout} seconds. Node: {self.node_name}"
logger.error(error_message)
raise RuntimeError(error_message)
except requests.exceptions.RequestException as e:
logger.error(f"An error occurred: {str(e)}")
raise

View File

@ -20,6 +20,7 @@ class StepsCommon:
self.first_node.start()
self.first_node.wait_fully_started()
self.first_node_pubkey = self.first_node.get_pubkey()
self.community_nodes = []
@pytest.fixture(scope="function", autouse=False)
def start_2_nodes(self):

View File

@ -7,9 +7,10 @@ from src.steps.common import StepsCommon
@pytest.mark.usefixtures("start_1_node")
class TestCommunityMessages(StepsCommon):
@pytest.mark.flaky(reruns=2)
def test_community_messages_baseline(self):
try:
self.community_nodes
assert self.community_nodes
except:
self.setup_community_nodes(node_limit=1)
self.join_created_communities()
@ -67,6 +68,7 @@ class TestCommunityMessages(StepsCommon):
with self.add_low_bandwith():
self.test_community_messages_baseline()
@pytest.mark.flaky(reruns=2)
def test_community_messages_with_node_pause_10_seconds(self):
self.setup_community_nodes(node_limit=1)
self.join_created_communities()
@ -79,6 +81,7 @@ class TestCommunityMessages(StepsCommon):
delay(10)
assert community_node.wait_for_logs([message])
@pytest.mark.flaky(reruns=2)
def test_community_messages_with_node_pause_30_seconds(self):
self.setup_community_nodes(node_limit=1)
self.join_created_communities()

View File

@ -7,6 +7,7 @@ from datetime import datetime
@pytest.mark.usefixtures("start_1_node")
class TestFetchCommunity(StepsCommon):
@pytest.mark.flaky(reruns=2)
def test_fetch_community_baseline(self):
try:
self.community_nodes

View File

@ -7,6 +7,7 @@ from datetime import datetime
@pytest.mark.usefixtures("start_1_node")
class TestJoinCommunity(StepsCommon):
@pytest.mark.flaky(reruns=2)
def test_join_community_baseline(self):
try:
self.community_nodes
@ -65,6 +66,7 @@ class TestJoinCommunity(StepsCommon):
with self.add_low_bandwith():
self.test_join_community_baseline()
@pytest.mark.flaky(reruns=2)
def test_join_community_with_node_pause(self):
self.setup_community_nodes(node_limit=1)
community_id = self.community_nodes[0]["community_id"]

View File

@ -6,6 +6,7 @@ from datetime import datetime
@pytest.mark.usefixtures("start_1_node")
class TestLeaveCommunity(StepsCommon):
@pytest.mark.flaky(reruns=2)
def test_leave_community_baseline(self):
try:
self.community_nodes