commit
0c6974d5cb
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue