chore: use another cluster id (#55)

* use another cluster id

* adjust tests
This commit is contained in:
fbarbu15 2024-07-11 23:00:18 +03:00 committed by GitHub
parent d5cd78950a
commit a27c028104
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 43 additions and 45 deletions

View File

@ -23,11 +23,11 @@ echo "Sleeping 20 seconds"
sleep 20
echo "Subscribe"
curl -v -X POST "http://127.0.0.1:41717/relay/v1/subscriptions" -H "Content-Type: application/json" -d '["/waku/2/rs/0/1"]'
curl -v -X POST "http://127.0.0.1:10628/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "aa7ae897-e14b-494a-b1c5-a5c69488ced0", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:12108/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "497fb697-4e1c-443b-b681-7c90f7e406bb", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:6707/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "bb2137a4-3d63-4afd-bc40-78eba0af4167", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:30889/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "cbd1d59a-8989-4dc3-83a4-b6859e08cadf", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:41717/relay/v1/subscriptions" -H "Content-Type: application/json" -d '["/waku/2/rs/3/1"]'
curl -v -X POST "http://127.0.0.1:10628/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "aa7ae897-e14b-494a-b1c5-a5c69488ced0", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/3/1"}'
curl -v -X POST "http://127.0.0.1:12108/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "497fb697-4e1c-443b-b681-7c90f7e406bb", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/3/1"}'
curl -v -X POST "http://127.0.0.1:6707/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "bb2137a4-3d63-4afd-bc40-78eba0af4167", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/3/1"}'
curl -v -X POST "http://127.0.0.1:30889/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "cbd1d59a-8989-4dc3-83a4-b6859e08cadf", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/3/1"}'
echo "Sleeping 5 seconds"
sleep 5

View File

@ -12,6 +12,7 @@ from src.node.api_clients.rest import REST
from src.node.docker_mananger import DockerManager
from src.env_vars import DOCKER_LOG_DIR
from src.data_storage import DS
from src.test_data import DEFAULT_CLUSTER_ID
logger = get_custom_logger(__name__)
@ -108,7 +109,7 @@ class WakuNode:
"nat": f"extip:{self._ext_ip}",
"peer-exchange": "true",
"discv5-discovery": "true",
"cluster-id": "0",
"cluster-id": DEFAULT_CLUSTER_ID,
"rln-creds-id": None,
"rln-creds-source": None,
}

View File

@ -13,13 +13,14 @@ from src.env_vars import (
)
from src.node.waku_node import WakuNode
from src.steps.common import StepsCommon
from src.test_data import VALID_PUBSUB_TOPICS
logger = get_custom_logger(__name__)
class StepsLightPush(StepsCommon):
test_content_topic = "/myapp/1/latest/proto"
test_pubsub_topic = "/waku/2/rs/0/0"
test_pubsub_topic = VALID_PUBSUB_TOPICS[0]
test_payload = "Light push works!!"
@pytest.fixture(scope="function", autouse=True)

View File

@ -13,13 +13,14 @@ from src.env_vars import (
)
from src.node.waku_node import WakuNode
from src.steps.common import StepsCommon
from src.test_data import VALID_PUBSUB_TOPICS
logger = get_custom_logger(__name__)
class StepsStore(StepsCommon):
test_content_topic = "/myapp/1/latest/proto"
test_pubsub_topic = "/waku/2/rs/0/0"
test_pubsub_topic = VALID_PUBSUB_TOPICS[0]
test_payload = "Store works!!"
@pytest.fixture(scope="function", autouse=True)

View File

@ -96,28 +96,35 @@ CONTENT_TOPICS_SHARD_7 = [
"/newsService/4.0/updates/yaml",
]
VALID_PUBSUB_TOPICS = ["/waku/2/rs/0/0", "/waku/2/rs/0/1", "/waku/2/rs/0/9", "/waku/2/rs/0/25", "/waku/2/rs/0/1000"]
PUBSUB_TOPICS_STORE = [
"/waku/2/rs/0/0",
"/waku/2/rs/0/1",
"/waku/2/rs/0/2",
"/waku/2/rs/0/3",
"/waku/2/rs/0/4",
"/waku/2/rs/0/5",
"/waku/2/rs/0/6",
"/waku/2/rs/0/7",
"/waku/2/rs/0/8",
DEFAULT_CLUSTER_ID = "3"
VALID_PUBSUB_TOPICS = [
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/0",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/1",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/9",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/25",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/1000",
]
INVALID_PUBSUB_TOPICS = ["/test/2/rs/0/1", "/waku/3/rs/0/1", "/waku/2/test/0/1", "/waku/2/rs/0/b", "/waku/2/rs/0"]
PUBSUB_TOPICS_STORE = [
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/0",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/1",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/2",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/3",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/4",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/5",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/6",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/7",
f"/waku/2/rs/{DEFAULT_CLUSTER_ID}/8",
]
INVALID_PUBSUB_TOPICS = ["/test/2/rs/0/1", "/waku/3/rs/0/1", "/waku/2/test/0/1", "/waku/2/rs/3/b", "/waku/2/rs/0"]
PUBSUB_TOPICS_DIFFERENT_CLUSTERS = [
"/waku/2/rs/0/0",
"/waku/2/rs/0/1",
"/waku/2/rs/2/0",
"/waku/2/rs/2/1",
"/waku/2/rs/2/999",
"/waku/2/rs/5/0",
"/waku/2/rs/5/1",
"/waku/2/rs/5/999",
"/waku/2/rs/8/0",
"/waku/2/rs/999/999",
]

View File

@ -150,7 +150,7 @@ class TestLightPushPublish(StepsLightPush):
self.light_push_node1.send_light_push_message({"message": self.create_message()})
delay(0.1)
messages = self.receiving_node1.get_relay_messages(self.test_pubsub_topic)
assert len(messages) == 1
assert len(messages) == 0
def test_light_push_with_valid_timestamps(self):
failed_timestamps = []

View File

@ -41,6 +41,7 @@ class TestRunningNodes(StepsLightPush):
self.setup_first_receiving_node(lightpush="true", relay="true", filter="true")
self.setup_first_lightpush_node(lightpush="true", relay="true", filter="true")
self.subscribe_to_pubsub_topics_via_relay()
delay(0.5)
self.check_light_pushed_message_reaches_receiving_peer()
def test_lightpush_node_with_relay_works_correctly(self):

View File

@ -49,14 +49,6 @@ class TestRelayStaticSharding(StepsSharding):
for pubsub_topic in PUBSUB_TOPICS_SAME_CLUSTER[1:]:
self.check_published_message_reaches_relay_peer(pubsub_topic=pubsub_topic)
def test_subscribe_via_api_to_new_pubsub_topics_on_other_cluster(self):
topics = ["/waku/2/rs/2/0", "/waku/2/rs/3/0", "/waku/2/rs/4/0"]
self.setup_main_relay_nodes(cluster_id=2, pubsub_topic=topics[0])
self.subscribe_first_relay_node(pubsub_topics=topics)
self.subscribe_second_relay_node(pubsub_topics=topics)
for pubsub_topic in topics:
self.check_published_message_reaches_relay_peer(pubsub_topic=pubsub_topic)
def test_subscribe_one_by_one_to_different_pubsub_topics_and_send_messages(self):
self.setup_main_relay_nodes(cluster_id=self.auto_cluster, pubsub_topic=self.test_pubsub_topic)
for pubsub_topic in PUBSUB_TOPICS_SAME_CLUSTER:

View File

@ -1,7 +1,6 @@
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.steps.sharding import StepsSharding
from src.test_data import PUBSUB_TOPICS_DIFFERENT_CLUSTERS, PUBSUB_TOPICS_SAME_CLUSTER
@ -21,12 +20,6 @@ class TestRunningNodesStaticSharding(StepsSharding):
for pubsub_topic in PUBSUB_TOPICS_SAME_CLUSTER:
self.check_published_message_reaches_relay_peer(pubsub_topic=pubsub_topic)
def test_multiple_pubsub_topics_different_clusters(self):
self.setup_main_relay_nodes(pubsub_topic=PUBSUB_TOPICS_DIFFERENT_CLUSTERS)
self.subscribe_main_relay_nodes(pubsub_topics=PUBSUB_TOPICS_DIFFERENT_CLUSTERS)
for pubsub_topic in PUBSUB_TOPICS_DIFFERENT_CLUSTERS:
self.check_published_message_reaches_relay_peer(pubsub_topic=pubsub_topic)
def test_2_nodes_same_cluster_different_shards(self):
self.setup_first_relay_node_with_filter(pubsub_topic=self.test_pubsub_topic)
self.setup_second_relay_node(pubsub_topic="/waku/2/rs/2/1")
@ -40,9 +33,9 @@ class TestRunningNodesStaticSharding(StepsSharding):
def test_2_nodes_different_cluster_same_shard(self):
self.setup_first_relay_node_with_filter(pubsub_topic=self.test_pubsub_topic)
self.setup_second_relay_node(pubsub_topic="/waku/2/rs/3/0")
self.setup_second_relay_node(pubsub_topic="/waku/2/rs/4/0")
self.subscribe_first_relay_node(pubsub_topics=[self.test_pubsub_topic])
self.subscribe_second_relay_node(pubsub_topics=["/waku/2/rs/3/0"])
self.subscribe_second_relay_node(pubsub_topics=["/waku/2/rs/4/0"])
try:
self.check_published_message_reaches_relay_peer(pubsub_topic=self.test_pubsub_topic)
raise AssertionError("Publish on different cluster worked!!!")
@ -51,9 +44,9 @@ class TestRunningNodesStaticSharding(StepsSharding):
def test_2_nodes_different_cluster_different_shard(self):
self.setup_first_relay_node_with_filter(pubsub_topic=self.test_pubsub_topic)
self.setup_second_relay_node(pubsub_topic="/waku/2/rs/3/1")
self.setup_second_relay_node(pubsub_topic="/waku/2/rs/4/1")
self.subscribe_first_relay_node(pubsub_topics=[self.test_pubsub_topic])
self.subscribe_second_relay_node(pubsub_topics=["/waku/2/rs/3/1"])
self.subscribe_second_relay_node(pubsub_topics=["/waku/2/rs/4/1"])
try:
self.check_published_message_reaches_relay_peer(pubsub_topic=self.test_pubsub_topic)
raise AssertionError("Publish on different cluster worked!!!")

View File

@ -1,4 +1,5 @@
import pytest
from src.env_vars import NODE_2
from src.libs.custom_logger import get_custom_logger
from src.libs.common import to_base64
from src.steps.store import StepsStore
@ -10,6 +11,7 @@ logger = get_custom_logger(__name__)
@pytest.mark.usefixtures("node_setup")
class TestGetMessages(StepsStore):
# only one test for store v1, all other tests are using the new store v3
@pytest.mark.skipif("go-waku" in NODE_2, reason="Test works only with nwaku")
def test_legacy_store_v1(self):
self.publish_message()
for node in self.store_nodes:

View File

@ -16,7 +16,7 @@ class TestReliability(StepsStore):
assert len(store_response.messages) == 1
except Exception as ex:
if self.store_node1.is_gowaku():
assert "failed to dial: context deadline exceeded" in str(ex) or "connection failed" in str(ex)
assert "failed to dial" in str(ex) or "connection failed" in str(ex)
else:
raise AssertionError(f"Nwaku failed with {ex}")