mirror of
https://github.com/waku-org/waku-interop-tests.git
synced 2025-01-12 08:24:34 +00:00
013c6e8bb0
* Selecting initial smoke tests set * adding mark "smoke" in pytest.ini * adding mark smoke to workflow file * Remove allure reporting from yml file * Adding more smoke tests * Add PR image to new nwaku workflow * change nwaku_daily.yml to test the PR job changes * remove dependencies from yml file * Remove secrets check from container yml file * remove secrets from all files * change image tag * revert image tag * Revert nwaku_daily.yml to origin * Adding PR number to choose image * adding docker-build-image to yml file * adding docker-image-build dependencies * Adding quay user & password * Adding quay username & password * Fix yml build * Remove changes causing errors * remove tests part to speedup the job * add flag workflow_call: for reusable workflow * checkout on branch instead of master * trying to fetch from branch * Check out specific branch * make node1 input * Adding node1 as input * Add type to required input * fix node input format * change input node1 format * Delete .github/workflows/container-image.yml * Delete .github/workflows/nim_nwaku_pr.yml * Create 2 files for PR tests * revert original yml files * Fix review points on PR * fix review points * revert test_common file to master * revert nim_waku_daily to master * Fix review points
105 lines
5.7 KiB
Python
105 lines
5.7 KiB
Python
import pytest
|
|
from src.env_vars import NODE_2
|
|
from src.libs.custom_logger import get_custom_logger
|
|
from src.steps.relay import StepsRelay
|
|
from src.test_data import INVALID_PUBSUB_TOPICS, VALID_PUBSUB_TOPICS
|
|
|
|
logger = get_custom_logger(__name__)
|
|
|
|
|
|
@pytest.mark.usefixtures("setup_main_relay_nodes")
|
|
class TestRelaySubscribe(StepsRelay):
|
|
@pytest.mark.smoke
|
|
def test_relay_no_subscription(self):
|
|
self.check_publish_without_relay_subscription(self.test_pubsub_topic)
|
|
|
|
@pytest.mark.smoke
|
|
def test_relay_subscribe_to_single_pubsub_topic(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.wait_for_published_message_to_reach_relay_peer()
|
|
|
|
def test_relay_subscribe_to_already_existing_pubsub_topic(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.wait_for_published_message_to_reach_relay_peer()
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.check_published_message_reaches_relay_peer()
|
|
|
|
def test_relay_subscribe_with_multiple_overlapping_pubsub_topics(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS[:3])
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS[1:4])
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS[:4]:
|
|
self.wait_for_published_message_to_reach_relay_peer(pubsub_topic=pubsub_topic)
|
|
|
|
def test_relay_subscribe_with_empty_pubsub_topic_list(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [])
|
|
|
|
def test_relay_subscribe_with_invalid_pubsub_topic_format(self):
|
|
success_pubsub_topics = []
|
|
for pubsub_topic in INVALID_PUBSUB_TOPICS:
|
|
logger.debug(f"Running test with payload {pubsub_topic}")
|
|
try:
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, pubsub_topic)
|
|
success_pubsub_topics.append(pubsub_topic)
|
|
except Exception as ex:
|
|
assert "Bad Request" in str(ex)
|
|
assert not success_pubsub_topics, f"Invalid Pubsub Topics that didn't failed: {success_pubsub_topics}"
|
|
|
|
def test_relay_unsubscribe_from_single_pubsub_topic(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.wait_for_published_message_to_reach_relay_peer()
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.check_publish_without_relay_subscription(self.test_pubsub_topic)
|
|
|
|
@pytest.mark.xfail("go-waku" in NODE_2, reason="Bug reported: https://github.com/waku-org/go-waku/issues/1034")
|
|
def test_relay_unsubscribe_from_all_pubsub_topics(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS)
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS:
|
|
self.wait_for_published_message_to_reach_relay_peer(pubsub_topic=pubsub_topic)
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS)
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS:
|
|
self.check_publish_without_relay_subscription(pubsub_topic)
|
|
|
|
def test_relay_unsubscribe_from_some_pubsub_topics(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS)
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS:
|
|
self.wait_for_published_message_to_reach_relay_peer(pubsub_topic=pubsub_topic)
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS[:3])
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS[:3]:
|
|
self.check_publish_without_relay_subscription(pubsub_topic)
|
|
for pubsub_topic in VALID_PUBSUB_TOPICS[3:]:
|
|
self.check_published_message_reaches_relay_peer(pubsub_topic=pubsub_topic)
|
|
|
|
def test_relay_unsubscribe_from_non_existing_pubsub_topic(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.wait_for_published_message_to_reach_relay_peer()
|
|
try:
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, VALID_PUBSUB_TOPICS[4:5])
|
|
if self.node1.is_nwaku():
|
|
pass # nwaku doesn't fail in this case
|
|
elif self.node1.is_gowaku():
|
|
raise AssertionError("Unsubscribe from non-subscribed pubsub_topic worked!!!")
|
|
else:
|
|
raise NotImplementedError("Not implemented for this node type")
|
|
except Exception as ex:
|
|
assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex)
|
|
self.check_published_message_reaches_relay_peer()
|
|
|
|
def test_relay_unsubscribe_with_invalid_pubsub_topic_format(self):
|
|
success_pubsub_topics = []
|
|
for pubsub_topic in INVALID_PUBSUB_TOPICS:
|
|
logger.debug(f"Running test with payload {pubsub_topic}")
|
|
try:
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, pubsub_topic)
|
|
success_pubsub_topics.append(pubsub_topic)
|
|
except Exception as ex:
|
|
assert "Bad Request" in str(ex)
|
|
assert not success_pubsub_topics, f"Invalid Pubsub Topics that didn't failed: {success_pubsub_topics}"
|
|
|
|
def test_relay_resubscribe_to_unsubscribed_pubsub_topic(self):
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.wait_for_published_message_to_reach_relay_peer()
|
|
self.delete_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.check_publish_without_relay_subscription(self.test_pubsub_topic)
|
|
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
|
|
self.check_published_message_reaches_relay_peer()
|