From bad29a514a4c675d5bf5669d27e328e808b716f1 Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Fri, 22 Dec 2023 14:28:10 +0200 Subject: [PATCH] adjustments after CI runs --- .github/workflows/test.yml | 6 +++--- src/env_vars.py | 8 ++++---- src/node/api_clients/base_client.py | 2 +- src/steps/filter.py | 2 ++ tests/filter/test_subscribe_create.py | 2 +- tests/filter/test_subscribe_update.py | 4 ++-- tests/filter/test_unsubscribe.py | 10 +++++++--- tests/relay/test_publish.py | 2 +- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aab70427..a87c2195 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,17 +16,17 @@ on: required: true description: "Node that usually publishes messages. Used for all tests" type: string - default: "harbor.status.im/wakuorg/nwaku:latest" + default: "harbor.status.im/wakuorg/go-waku:latest" node2: required: true description: "Node that usually queries for published messages. Used for all tests" type: string - default: "harbor.status.im/wakuorg/go-waku:latest" + default: "harbor.status.im/wakuorg/nwaku:latest" additional_nodes: required: false description: "Additional optional nodes used in e2e tests, separated by ," type: string - default: "harbor.status.im/wakuorg/nwaku:latest,harbor.status.im/wakuorg/go-waku:latest" + default: "harbor.status.im/wakuorg/nwaku:latest,harbor.status.im/wakuorg/go-waku:latest,harbor.status.im/wakuorg/nwaku:latest" protocol: description: "Protocol used to comunicate inside the network" required: true diff --git a/src/env_vars.py b/src/env_vars.py index 5af94bd5..ac181e67 100644 --- a/src/env_vars.py +++ b/src/env_vars.py @@ -16,9 +16,9 @@ def get_env_var(var_name, default=None): # Configuration constants. Need to be upercase to appear in reports DEFAULT_NWAKU = "harbor.status.im/wakuorg/nwaku:latest" DEFAULT_GOWAKU = "harbor.status.im/wakuorg/go-waku:latest" -NODE_1 = get_env_var("NODE_1", DEFAULT_NWAKU) -NODE_2 = get_env_var("NODE_2", DEFAULT_GOWAKU) -ADDITIONAL_NODES = get_env_var("ADDITIONAL_NODES", f"{DEFAULT_NWAKU},{DEFAULT_GOWAKU}") +NODE_1 = get_env_var("NODE_1", DEFAULT_GOWAKU) +NODE_2 = get_env_var("NODE_2", DEFAULT_NWAKU) +ADDITIONAL_NODES = get_env_var("ADDITIONAL_NODES", f"{DEFAULT_NWAKU},{DEFAULT_GOWAKU},{DEFAULT_NWAKU}") # more nodes need to follow the NODE_X pattern DOCKER_LOG_DIR = get_env_var("DOCKER_LOG_DIR", "./log/docker") NETWORK_NAME = get_env_var("NETWORK_NAME", "waku") @@ -29,4 +29,4 @@ DEFAULT_PUBSUB_TOPIC = get_env_var("DEFAULT_PUBSUB_TOPIC", "/waku/2/default-waku PROTOCOL = get_env_var("PROTOCOL", "REST") RUNNING_IN_CI = get_env_var("CI") NODEKEY = get_env_var("NODEKEY", "30348dd51465150e04a5d9d932c72864c8967f806cce60b5d26afeca1e77eb68") -API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 10) +API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 20) diff --git a/src/node/api_clients/base_client.py b/src/node/api_clients/base_client.py index 723668e4..ceeeab81 100644 --- a/src/node/api_clients/base_client.py +++ b/src/node/api_clients/base_client.py @@ -8,7 +8,7 @@ logger = get_custom_logger(__name__) class BaseClient(ABC): def make_request(self, method, url, headers=None, data=None): - logger.debug(f"{method.upper()} call: {url} with payload: {data}") + logger.info(f"{method.upper()} call: {url} with payload: {data}") response = requests.request(method.upper(), url, headers=headers, data=data, timeout=API_REQUEST_TIMEOUT) try: response.raise_for_status() diff --git a/src/steps/filter.py b/src/steps/filter.py index 01421520..ef6c1414 100644 --- a/src/steps/filter.py +++ b/src/steps/filter.py @@ -118,6 +118,8 @@ class StepsFilter: assert filter_sub_response["requestId"] == request_id assert filter_sub_response["statusDesc"] in ["OK", ""] # until https://github.com/waku-org/nwaku/issues/2286 is fixed + @retry(stop=stop_after_delay(30), wait=wait_fixed(1), reraise=True) + @allure.step def subscribe_optional_filter_nodes(self, content_topic_list, pubsub_topic=None): if pubsub_topic is None: pubsub_topic = self.test_pubsub_topic diff --git a/tests/filter/test_subscribe_create.py b/tests/filter/test_subscribe_create.py index 19e439e9..a1098cf3 100644 --- a/tests/filter/test_subscribe_create.py +++ b/tests/filter/test_subscribe_create.py @@ -7,7 +7,7 @@ logger = get_custom_logger(__name__) @pytest.mark.usefixtures("setup_main_relay_node", "setup_main_filter_node") -class TestFilterSubscribeUpdate(StepsFilter): +class TestFilterSubscribeCreate(StepsFilter): def test_filter_subscribe_to_single_topics(self): self.wait_for_subscriptions_on_main_nodes([self.test_content_topic]) self.check_published_message_reaches_filter_peer() diff --git a/tests/filter/test_subscribe_update.py b/tests/filter/test_subscribe_update.py index b69661eb..67731609 100644 --- a/tests/filter/test_subscribe_update.py +++ b/tests/filter/test_subscribe_update.py @@ -7,7 +7,7 @@ logger = get_custom_logger(__name__) @pytest.mark.usefixtures("setup_main_relay_node", "setup_main_filter_node") -class TestFilterSubscribeCreate(StepsFilter): +class TestFilterSubscribeUpdate(StepsFilter): def test_filter_update_subscription_add_a_new_content_topic(self): self.wait_for_subscriptions_on_main_nodes([self.test_content_topic], pubsub_topic=self.test_pubsub_topic) self.update_filter_subscription({"requestId": "1", "contentFilters": [self.second_content_topic], "pubsubTopic": self.test_pubsub_topic}) @@ -62,7 +62,7 @@ class TestFilterSubscribeCreate(StepsFilter): def test_filter_update_subscription_with_no_pubsub_topic(self, subscribe_main_nodes): try: - self.update_filter_subscription({"requestId": "1", "contentFilters": [self.test_content_topic]}) + self.update_filter_subscription({"requestId": "1", "contentFilters": [self.second_content_topic]}) raise AssertionError("Subscribe with no pubusub topics worked!!!") except Exception as ex: assert "Bad Request" in str(ex) diff --git a/tests/filter/test_unsubscribe.py b/tests/filter/test_unsubscribe.py index 47a5d3ee..d847417a 100644 --- a/tests/filter/test_unsubscribe.py +++ b/tests/filter/test_unsubscribe.py @@ -38,9 +38,13 @@ class TestFilterUnSubscribe(StepsFilter): self.check_publish_without_filter_subscription(self.create_message(contentTopic=self.second_content_topic), self.second_pubsub_topic) def test_filter_unsubscribe_from_non_existing_content_topic(self): - self.delete_filter_subscription( - {"requestId": "1", "contentFilters": [self.second_content_topic], "pubsubTopic": self.test_pubsub_topic}, status="can't unsubscribe" - ) + try: + self.delete_filter_subscription( + {"requestId": "1", "contentFilters": [self.second_content_topic], "pubsubTopic": self.test_pubsub_topic}, + status="can't unsubscribe" if self.node2.is_gowaku() else "", + ) + except Exception as ex: + assert "Not Found" and "peer has no subscriptions" in str(ex) self.check_published_message_reaches_filter_peer() def test_filter_unsubscribe_from_non_existing_pubsub_topic(self): diff --git a/tests/relay/test_publish.py b/tests/relay/test_publish.py index 6fbe93cd..8581284d 100644 --- a/tests/relay/test_publish.py +++ b/tests/relay/test_publish.py @@ -57,7 +57,7 @@ class TestRelayPublish(StepsRelay): self.check_published_message_reaches_relay_peer(message, message_propagation_delay=2) raise AssertionError("Message with payload > 1MB was received") except Exception as ex: - assert "couldn't find any messages" in str(ex) or "Bad Request" in str(ex) + assert "couldn't find any messages" in str(ex) or "Bad Request" in str(ex) or "Internal Server Error" in str(ex) def test_publish_with_valid_content_topics(self): failed_content_topics = []