Skip to content

Commit

Permalink
Merge branch 'master' into CI_RUNNERS
Browse files Browse the repository at this point in the history
  • Loading branch information
AYAHASSAN287 authored Dec 24, 2024
2 parents 0b5c113 + 25b9952 commit ebc200b
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/nim_waku_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Nim -> Interop Tests PR

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false

on:
workflow_dispatch:
inputs:
node_nwaku:
required: true
type: string
workflow_call:
inputs:
node_nwaku:
required: true
type: string

jobs:
test-pr:
uses: ./.github/workflows/test_PR_image.yml
secrets: inherit
with:
node1: ${{ inputs.node_nwaku }}
node2: ${{ inputs.node_nwaku }}
additional_nodes: ${{ inputs.node_nwaku }}
caller: "nim"
89 changes: 89 additions & 0 deletions .github/workflows/test_PR_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

name: Interop Tests PR

on:
workflow_call:
inputs:
node1:
required: true
type: string
description: "Node that usually publishes messages. Used for all tests"
default: "wakuorg/go-waku:latest"
node2:
required: true
description: "Node that usually queries for published messages. Used for all tests"
type: string
default: "wakuorg/nwaku:latest"
additional_nodes:
required: false
description: "Additional optional nodes used in e2e tests, separated by ,"
type: string
default: "wakuorg/nwaku:latest,wakuorg/go-waku:latest,wakuorg/nwaku:latest"
caller:
required: false
description: "Workflow caller. Used in reporting"
type: string

env:
FORCE_COLOR: "1"
NODE_1: ${{ inputs.node1 }}
NODE_2: ${{ inputs.node2 }}
ADDITIONAL_NODES: ${{ inputs.additional_nodes }}
CALLER: ${{ inputs.caller || 'manual' }}
RLN_CREDENTIALS: ${{ secrets.RLN_CREDENTIALS }}

jobs:

tests:
name: tests
runs-on: ubuntu-latest
timeout-minutes: 120
steps:

- uses: actions/checkout@v4
with:
repository: waku-org/waku-interop-tests

- uses: actions/setup-python@v4
with:

python-version: '3.12'
cache: 'pip'

- run: pip install -r requirements.txt

- name: Run tests
timeout-minutes: 30
run: |
pytest -m 'smoke' -n 4 --dist loadgroup --reruns 1 --junit-xml=pytest_results.xml
- name: Test Report
if: always()
uses: dorny/test-reporter@95058abb17504553158e70e2c058fe1fda4392c2
with:
name: Pytest JUnit Test Report
path: pytest_results.xml
reporter: java-junit
use-actions-summary: 'true'

- name: Create job summary
if: always()
env:
JOB_STATUS: ${{ job.status }}
run: |
echo "## Run Information" >> $GITHUB_STEP_SUMMARY
echo "- **Event**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "- **Actor**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
echo "- **Node1**: ${{ env.NODE_1 }}" >> $GITHUB_STEP_SUMMARY
echo "- **Node2**: ${{ env.NODE_2 }}" >> $GITHUB_STEP_SUMMARY
echo "- **Additonal Nodes**: ${{ env.ADDITIONAL_NODES }}" >> $GITHUB_STEP_SUMMARY
if [ "$JOB_STATUS" != "success" ]; then
echo "There are failures with nwaku node. cc <@&1111608257824440330>" >> $GITHUB_STEP_SUMMARY
fi
{
echo 'JOB_SUMMARY<<EOF'
cat $GITHUB_STEP_SUMMARY
echo EOF
} >> $GITHUB_ENV
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ log_file = log/test.log
log_cli_format = %(asctime)s %(name)s %(levelname)s %(message)s
log_file_format = %(asctime)s %(name)s %(levelname)s %(message)s
timeout = 300
markers =
smoke: marks tests as smoke test (deselect with '-m "not smoke"')
4 changes: 3 additions & 1 deletion src/steps/light_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,6 @@ def create_payload(self, pubsub_topic=None, message=None, **kwargs):
@retry(stop=stop_after_delay(120), wait=wait_fixed(1), reraise=True)
def subscribe_and_light_push_with_retry(self):
self.subscribe_to_pubsub_topics_via_relay()
self.check_light_pushed_message_reaches_receiving_peer()
self.light_push_node1.send_light_push_message(self.create_payload())
get_messages_response = self.main_receiving_nodes[0].get_relay_messages(self.test_pubsub_topic)
assert len(get_messages_response) >= 1, f"Expected al least 1 message but got {len(get_messages_response)}"
3 changes: 3 additions & 0 deletions src/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@
"waku_rln_instance_creation_duration_seconds",
"waku_rln_membership_insertion_duration_seconds",
"waku_rln_membership_credentials_import_duration_seconds",
"waku_rln_proof_remining",
"waku_rln_proofs_generated_total",
"libp2p_pubsub_sig_verify_success_total",
"libp2p_pubsub_sig_verify_failure_total",
"libp2p_pubsub_disconnects_over_non_priority_queue_limit_total",
Expand Down Expand Up @@ -370,4 +372,5 @@
"waku_store_peers",
"waku_px_peers",
"waku_dnsdisc_discovered",
"rendezvousPeerFoundTotal_total",
]
6 changes: 6 additions & 0 deletions tests/discv5/test_discv5.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from src.env_vars import NODE_1, NODE_2
from src.libs.custom_logger import get_custom_logger
from src.node.waku_node import WakuNode
Expand All @@ -11,6 +13,7 @@


class TestDiscv5(StepsRelay, StepsFilter, StepsStore, StepsLightPush):
@pytest.mark.smoke
def running_a_node(self, image, **kwargs):
node = WakuNode(image, f"node{len(self.main_nodes) + 1}_{self.test_id}")
node.start(**kwargs)
Expand All @@ -25,13 +28,15 @@ def wait_for_published_message_to_be_stored(self):
def wait_for_lightpushed_message_to_be_stored(self):
self.check_light_pushed_message_reaches_receiving_peer(peer_list=[self.receiving_node1, self.receiving_node2])

@pytest.mark.smoke
def test_relay(self):
self.node1 = self.running_a_node(NODE_1, relay="true")
self.node2 = self.running_a_node(NODE_2, relay="true", discv5_bootstrap_node=self.node1.get_enr_uri())
self.main_nodes = [self.node1, self.node2]
self.ensure_relay_subscriptions_on_nodes(self.main_nodes, [self.test_pubsub_topic])
self.wait_for_published_message_to_reach_relay_peer()

@pytest.mark.smoke
def test_filter(self):
self.node1 = self.running_a_node(NODE_1, relay="true", filter="true")
self.node2 = self.running_a_node(
Expand All @@ -54,6 +59,7 @@ def test_store(self):
self.subscribe_to_pubsub_topics_via_relay(self.main_nodes)
self.wait_for_published_message_to_be_stored()

@pytest.mark.smoke
def test_lightpush(self):
self.receiving_node1 = self.running_a_node(NODE_1, lightpush="true", relay="true")
self.receiving_node2 = self.running_a_node(NODE_1, lightpush="false", relay="true", discv5_bootstrap_node=self.receiving_node1.get_enr_uri())
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def test_filter_many_subscribed_nodes(self):
assert len(response_list) == max_subscribed_nodes, "Received message count doesn't match sent "

@pytest.mark.skipif("go-waku" in NODE_2, reason="Test works only with nwaku")
@pytest.mark.smoke
def test_store_filter_interaction_with_six_nodes(self):
logger.debug("Create 6 nodes")
self.node4 = WakuNode(NODE_2, f"node4_{self.test_id}")
Expand Down
1 change: 1 addition & 0 deletions tests/filter/test_get_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# here we will also implicitly test filter push, see: https://rfc.vac.dev/spec/12/#messagepush
@pytest.mark.usefixtures("setup_main_relay_node", "setup_main_filter_node", "subscribe_main_nodes")
class TestFilterGetMessages(StepsFilter):
@pytest.mark.smoke
def test_filter_get_message_with_valid_payloads(self):
failed_payloads = []
for payload in SAMPLE_INPUTS:
Expand Down
1 change: 1 addition & 0 deletions tests/filter/test_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

@pytest.mark.usefixtures("setup_main_relay_node", "setup_main_filter_node")
class TestFilterPing(StepsFilter):
@pytest.mark.smoke
def test_filter_ping_on_subscribed_peer(self, subscribe_main_nodes):
self.ping_filter_subscriptions(str(uuid4()))

Expand Down
1 change: 1 addition & 0 deletions tests/relay/test_multiple_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@pytest.mark.usefixtures("setup_main_relay_nodes", "setup_optional_relay_nodes", "subscribe_main_relay_nodes")
class TestRelayMultipleNodes(StepsRelay):
@pytest.mark.smoke
def test_first_node_to_start_publishes(self, subscribe_optional_relay_nodes, relay_warm_up):
self.check_published_message_reaches_relay_peer()

Expand Down
4 changes: 4 additions & 0 deletions tests/relay/test_rln.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class TestRelayRLN(StepsRLN, StepsRelay):
SAMPLE_INPUTS_RLN = SAMPLE_INPUTS + SAMPLE_INPUTS + SAMPLE_INPUTS

@pytest.mark.smoke
def test_valid_payloads_lightpush_at_spam_rate(self, pytestconfig):
message_limit = 1
epoch_sec = 1
Expand Down Expand Up @@ -59,6 +60,7 @@ def test_valid_payloads_at_slow_rate(self, pytestconfig):
if i == message_limit - 1:
break


@pytest.mark.skipif("nwaku" in (NODE_1 + NODE_2), reason="Test works only with nwaku")
def test_valid_payloads_at_spam_rate(self, pytestconfig):
message_limit = 20
Expand Down Expand Up @@ -137,6 +139,7 @@ def test_valid_payloads_random_user_message_limit(self, pytestconfig):
failed_payloads.append(payload["description"])
assert not failed_payloads, f"Payloads failed: {failed_payloads}"

@pytest.mark.skip(reason="Waiting for issue resolution https://github.com/waku-org/nwaku/issues/3208")
@pytest.mark.timeout(600)
def test_valid_payloads_dynamic_at_spam_rate(self, pytestconfig):
message_limit = 100
Expand All @@ -162,6 +165,7 @@ def test_valid_payloads_dynamic_at_spam_rate(self, pytestconfig):
except Exception as e:
assert "RLN validation failed" or "NonceLimitReached" in str(e)

@pytest.mark.skip(reason="Waiting for issue resolution https://github.com/waku-org/nwaku/issues/3208")
@pytest.mark.timeout(600)
def test_valid_payloads_dynamic_at_slow_rate(self, pytestconfig):
message_limit = 100
Expand Down
2 changes: 2 additions & 0 deletions tests/relay/test_subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

@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()
Expand Down
2 changes: 1 addition & 1 deletion tests/store/test_reliability.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_message_relayed_while_store_node_is_paused(self, node_setup):

def test_message_relayed_while_store_node_is_stopped_without_removing(self):
self.setup_first_publishing_node(store="true", relay="true")
self.setup_first_store_node(store="false", relay="true", remove_container=False)
self.setup_first_store_node(store="false", relay="false", remove_container=False)
self.subscribe_to_pubsub_topics_via_relay()
self.publish_message()
self.check_published_message_is_stored(page_size=5)
Expand Down
2 changes: 2 additions & 0 deletions tests/store/test_running_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_main_node_only_relay__peer_only_relay(self):
except Exception as ex:
assert "failed to negotiate protocol: protocols not supported" in str(ex) or "PEER_DIAL_FAILURE" in str(ex)

@pytest.mark.smoke
def test_store_lightpushed_message(self):
self.setup_first_publishing_node(store="true", relay="true", lightpush="true")
self.setup_second_publishing_node(store="false", relay="true")
Expand All @@ -67,6 +68,7 @@ def test_store_lightpushed_message(self):
self.publish_message(via="lightpush", sender=self.store_node1)
self.check_published_message_is_stored(page_size=5, ascending="true")

@pytest.mark.smoke
def test_store_with_filter(self):
self.setup_first_publishing_node(store="true", relay="true", filter="true")
self.setup_first_store_node(store="false", relay="false", filter="true")
Expand Down
1 change: 1 addition & 0 deletions tests/store/test_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_store_with_unknown_pubsub_topic_but_known_content_topic(self):
)
assert len(store_response["messages"]) == 0, "Message count mismatch"

@pytest.mark.smoke
def test_store_with_both_pubsub_topic_and_content_topic(self):
for node in self.store_nodes:
for index, content_topic in enumerate(CONTENT_TOPICS_DIFFERENT_SHARDS):
Expand Down

0 comments on commit ebc200b

Please sign in to comment.