diff --git a/src/env_vars.py b/src/env_vars.py index 6a8ca7e4..b14f16ca 100644 --- a/src/env_vars.py +++ b/src/env_vars.py @@ -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", 60) +API_REQUEST_TIMEOUT = get_env_var("API_REQUEST_TIMEOUT", 10) diff --git a/src/node/waku_node.py b/src/node/waku_node.py index dc883d57..86c469d4 100644 --- a/src/node/waku_node.py +++ b/src/node/waku_node.py @@ -59,7 +59,7 @@ class WakuNode: "nat": f"extip:{self._ext_ip}", "peer-exchange": "true", "discv5-discovery": "true", - # "cluster-id": "2", + "cluster-id": "0", } if self.is_gowaku(): diff --git a/src/steps/filter.py b/src/steps/filter.py index efb84308..2d3c5bf5 100644 --- a/src/steps/filter.py +++ b/src/steps/filter.py @@ -17,6 +17,7 @@ logger = get_custom_logger(__name__) class StepsFilter: test_pubsub_topic = VALID_PUBSUB_TOPICS[1] second_pubsub_topic = VALID_PUBSUB_TOPICS[2] + another_cluster_pubsub_topic = "/waku/2/rs/2/2" test_content_topic = "/test/1/waku-filter/proto" second_content_topic = "/test/2/waku-filter/proto" test_payload = "Filter works!!" @@ -105,7 +106,7 @@ class StepsFilter: except Exception as ex: assert "Bad Request" in str(ex) or "Not Found" in str(ex) or "couldn't find any messages" in str(ex) - @retry(stop=stop_after_delay(40), wait=wait_fixed(1), reraise=True) + @retry(stop=stop_after_delay(30), wait=wait_fixed(1), reraise=True) @allure.step def wait_for_subscriptions_on_main_nodes(self, content_topic_list, pubsub_topic=None): if pubsub_topic is None: @@ -118,7 +119,7 @@ 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(70), wait=wait_fixed(1), reraise=True) + @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: diff --git a/tests/filter/test_subscribe_create.py b/tests/filter/test_subscribe_create.py index 3f0fecf0..fee9d887 100644 --- a/tests/filter/test_subscribe_create.py +++ b/tests/filter/test_subscribe_create.py @@ -12,7 +12,7 @@ class TestFilterSubscribeCreate(StepsFilter): self.wait_for_subscriptions_on_main_nodes([self.test_content_topic]) self.check_published_message_reaches_filter_peer() - def test_filter_subscribe_to_multiple_pubsub_topic(self): + def test_filter_subscribe_to_multiple_pubsub_topic_from_same_cluster(self): failed_pubsub_topics = [] for pubsub_topic in VALID_PUBSUB_TOPICS: content_topic = pubsub_topic @@ -26,6 +26,25 @@ class TestFilterSubscribeCreate(StepsFilter): failed_pubsub_topics.append(pubsub_topic) assert not failed_pubsub_topics, f"PubsubTopics failed: {failed_pubsub_topics}" + def test_filter_subscribe_to_pubsub_topic_from_another_cluster_id(self): + self.wait_for_subscriptions_on_main_nodes([self.test_content_topic], pubsub_topic=self.another_cluster_pubsub_topic) + self.check_published_message_reaches_filter_peer(pubsub_topic=self.another_cluster_pubsub_topic) + + def test_filter_subscribe_to_pubsub_topics_from_multiple_clusters(self): + pubsub_topic_list = [self.test_pubsub_topic, self.another_cluster_pubsub_topic, self.second_pubsub_topic] + failed_pubsub_topics = [] + for pubsub_topic in pubsub_topic_list: + content_topic = pubsub_topic + logger.debug(f"Running test with pubsub topic: {pubsub_topic}") + try: + self.wait_for_subscriptions_on_main_nodes([content_topic], pubsub_topic) + message = self.create_message(contentTopic=content_topic) + self.check_published_message_reaches_filter_peer(message, pubsub_topic=pubsub_topic) + except Exception as ex: + logger.error(f"PubsubTopic {pubsub_topic} failed: {str(ex)}") + failed_pubsub_topics.append(pubsub_topic) + assert failed_pubsub_topics == [self.another_cluster_pubsub_topic], f"PubsubTopics failed: {failed_pubsub_topics}" + def test_filter_subscribe_to_30_content_topics_in_one_call(self): failed_content_topics = [] self.wait_for_subscriptions_on_main_nodes([input["value"] for input in SAMPLE_INPUTS[:30]])