Skip to content

Commit f3a0d7a

Browse files
committed
test: parametrize functional tests for waku light client mode
Add waku_light_client parametrization to 6 functional test files so each test runs in both full node and light client mode. Doubles test count from 57 to 114. Files parametrized: - test_wakuext_group_chats.py - test_wakuext_contact_verification.py - test_one_to_one_messages.py - test_contact_request.py - test_private_groups_messages.py - test_create_private_groups.py
1 parent d97fe93 commit f3a0d7a

7 files changed

Lines changed: 50 additions & 38 deletions

tests-functional/resources/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ class Account:
143143

144144
NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000"
145145

146+
# Waku light client test IDs
147+
FULL_NODE = "wakuV2LightClient_False"
148+
LIGHT_CLIENT = "wakuV2LightClient_True"
149+
146150
# Well-known burn address, used as a generic recipient in tests
147151
BURN_ADDRESS = "0x000000000000000000000000000000000000dEaD"
148152

tests-functional/tests/reliability/test_contact_request.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
from steps import messenger
66
from clients.signals import SignalType
77
from resources.enums import MessageContentType
8-
from resources.constants import USE_IPV6
8+
from resources.constants import USE_IPV6, FULL_NODE, LIGHT_CLIENT
99

1010

1111
@pytest.mark.reliability
12+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
1213
class TestContactRequests:
1314
@pytest.fixture()
14-
def sender(self, backend_new_profile):
15-
return backend_new_profile("sender", bridge_network=True)
15+
def sender(self, backend_new_profile, waku_light_client):
16+
return backend_new_profile("sender", waku_light_client=waku_light_client, bridge_network=True)
1617

1718
@pytest.fixture()
18-
def receiver(self, backend_new_profile):
19-
return backend_new_profile("receiver", bridge_network=True)
19+
def receiver(self, backend_new_profile, waku_light_client):
20+
return backend_new_profile("receiver", waku_light_client=waku_light_client, bridge_network=True)
2021

2122
def _run_contact_request_baseline(self, sender, receiver, execution_number=None, network_condition=None):
2223
messenger.add_contact(

tests-functional/tests/reliability/test_create_private_groups.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
import pytest
44
from steps import messenger
55
from clients.signals import SignalType
6-
from resources.constants import USE_IPV6
6+
from resources.constants import USE_IPV6, FULL_NODE, LIGHT_CLIENT
77

88

99
@pytest.mark.reliability
10+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
1011
class TestCreatePrivateGroups:
1112

1213
@pytest.fixture()
13-
def community_admin(self, backend_new_profile):
14-
return backend_new_profile("community_admin", bridge_network=True)
14+
def community_admin(self, backend_new_profile, waku_light_client):
15+
return backend_new_profile("community_admin", waku_light_client=waku_light_client, bridge_network=True)
1516

1617
@pytest.fixture()
17-
def community_member(self, backend_new_profile):
18-
return backend_new_profile("member", bridge_network=True)
18+
def community_member(self, backend_new_profile, waku_light_client):
19+
return backend_new_profile("member", waku_light_client=waku_light_client, bridge_network=True)
1920

2021
def _run_create_private_group_baseline(self, community_admin, community_member, private_groups_count=1):
2122
messenger.make_contacts(community_admin, community_member)

tests-functional/tests/reliability/test_one_to_one_messages.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
import pytest
44
from steps import messenger
55
from clients.signals import SignalType
6-
from resources.constants import USE_IPV6
6+
from resources.constants import USE_IPV6, FULL_NODE, LIGHT_CLIENT
77

88

99
@pytest.mark.reliability
10+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
1011
class TestOneToOneMessages:
1112

1213
@pytest.fixture()
13-
def sender(self, backend_new_profile):
14-
return backend_new_profile("sender", bridge_network=True)
14+
def sender(self, backend_new_profile, waku_light_client):
15+
return backend_new_profile("sender", waku_light_client=waku_light_client, bridge_network=True)
1516

1617
@pytest.fixture()
17-
def receiver(self, backend_new_profile):
18-
return backend_new_profile("receiver", bridge_network=True)
18+
def receiver(self, backend_new_profile, waku_light_client):
19+
return backend_new_profile("receiver", waku_light_client=waku_light_client, bridge_network=True)
1920

2021
def _run_one_to_one_message_baseline(self, sender, receiver, message_count=1):
2122
messenger.one_to_one_message(message_count, sender=sender, receiver=receiver)

tests-functional/tests/reliability/test_private_groups_messages.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
import pytest
44
from steps import messenger
55
from clients.signals import SignalType
6-
from resources.constants import USE_IPV6
6+
from resources.constants import USE_IPV6, FULL_NODE, LIGHT_CLIENT
77

88

99
@pytest.mark.reliability
10+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
1011
class TestPrivateGroupMessages:
1112

1213
@pytest.fixture()
13-
def community_admin(self, backend_new_profile):
14-
return backend_new_profile("community_admin", bridge_network=True)
14+
def community_admin(self, backend_new_profile, waku_light_client):
15+
return backend_new_profile("community_admin", waku_light_client=waku_light_client, bridge_network=True)
1516

1617
@pytest.fixture()
17-
def community_member(self, backend_new_profile):
18-
return backend_new_profile("community_member", bridge_network=True)
18+
def community_member(self, backend_new_profile, waku_light_client):
19+
return backend_new_profile("community_member", waku_light_client=waku_light_client, bridge_network=True)
1920

2021
def _run_private_group_messages_baseline(self, community_admin, community_member, message_count=1):
2122
messenger.make_contacts(community_admin, community_member)

tests-functional/tests/test_wakuext_contact_verification.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
import pytest
44

55
from clients.signals import SignalType
6+
from resources.constants import FULL_NODE, LIGHT_CLIENT
67
from resources.enums import ContactVerificationState, MessageContentType
78
from steps import async_messenger
89

910

1011
@pytest.mark.rpc
1112
@pytest.mark.asyncio
13+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
1214
class TestContactVerification:
1315

1416
@pytest.fixture
15-
async def creator(self, async_backend_new_profile):
16-
return await async_backend_new_profile("creator")
17+
async def creator(self, async_backend_new_profile, waku_light_client):
18+
return await async_backend_new_profile("creator", waku_light_client=waku_light_client)
1719

1820
@pytest.fixture
19-
async def member(self, async_backend_new_profile, creator):
20-
m = await async_backend_new_profile("member")
21+
async def member(self, async_backend_new_profile, waku_light_client, creator):
22+
m = await async_backend_new_profile("member", waku_light_client=waku_light_client)
2123
await async_messenger.make_contacts(sender=creator, receiver=m)
2224
return m
2325

tests-functional/tests/test_wakuext_group_chats.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
from uuid import uuid4
22
import pytest
33
from steps import messenger
4+
from resources.constants import FULL_NODE, LIGHT_CLIENT
45
from resources.enums import MessageContentType
56

67

78
@pytest.mark.rpc
9+
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=[FULL_NODE, LIGHT_CLIENT])
810
class TestCreatePrivateGroups:
911

1012
@pytest.fixture()
11-
def community_admin(self, backend_new_profile):
12-
return backend_new_profile("community_admin")
13+
def community_admin(self, backend_new_profile, waku_light_client):
14+
return backend_new_profile("community_admin", waku_light_client=waku_light_client)
1315

1416
@pytest.fixture()
15-
def community_member(self, backend_new_profile):
16-
return backend_new_profile("community_member")
17+
def community_member(self, backend_new_profile, waku_light_client):
18+
return backend_new_profile("community_member", waku_light_client=waku_light_client)
1719

1820
def test_create_group_chat_with_members(self, community_admin, community_member):
1921
messenger.make_contacts(community_admin, community_member)
@@ -60,8 +62,8 @@ def test_leave_group_chat(self, community_admin, community_member):
6062
assert len(members_after_leave) == 1
6163
assert community_admin.public_key not in str(members_after_leave)
6264

63-
def test_send_group_chat_invitation_request(self, community_admin, community_member, backend_new_profile):
64-
third_node = backend_new_profile("third_node")
65+
def test_send_group_chat_invitation_request(self, community_admin, community_member, backend_new_profile, waku_light_client):
66+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
6567
messenger.make_contacts(community_admin, third_node)
6668

6769
messenger.make_contacts(community_admin, community_member)
@@ -103,8 +105,8 @@ def test_create_group_chat_from_invitation(self, community_admin, community_memb
103105
assert chats[0].get("invitationAdmin", "") == community_admin.public_key
104106
assert chats[0].get("name", "") == invitation_group
105107

106-
def test_add_members_to_group_chat(self, community_admin, community_member, backend_new_profile):
107-
third_node = backend_new_profile("third_node")
108+
def test_add_members_to_group_chat(self, community_admin, community_member, backend_new_profile, waku_light_client):
109+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
108110
messenger.make_contacts(community_admin, third_node)
109111

110112
messenger.make_contacts(community_admin, community_member)
@@ -146,8 +148,8 @@ def test_remove_member_from_group_chat(self, community_admin, community_member):
146148
message_pattern=f"@{community_member.public_key} left the group",
147149
)[0]
148150

149-
def test_remove_members_from_group_chat(self, community_admin, community_member, backend_new_profile):
150-
third_node = backend_new_profile("third_node")
151+
def test_remove_members_from_group_chat(self, community_admin, community_member, backend_new_profile, waku_light_client):
152+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
151153
messenger.make_contacts(community_admin, third_node)
152154

153155
messenger.make_contacts(community_admin, community_member)
@@ -211,8 +213,8 @@ def test_change_group_chat_name(self, community_admin, community_member):
211213
assert chats[0].get("name", "") == new_group_name
212214

213215
@pytest.mark.skip(reason="waiting for https://github.com/status-im/status-go/issues/6752 resolution")
214-
def test_get_group_chat_invitations(self, community_admin, community_member, backend_new_profile):
215-
third_node = backend_new_profile("third_node")
216+
def test_get_group_chat_invitations(self, community_admin, community_member, backend_new_profile, waku_light_client):
217+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
216218
messenger.make_contacts(community_admin, third_node)
217219

218220
messenger.make_contacts(community_admin, community_member)
@@ -230,8 +232,8 @@ def test_get_group_chat_invitations(self, community_admin, community_member, bac
230232
third_node.wakuext_service.get_group_chat_invitations()
231233
# TODO: Add more assertions on response
232234

233-
def test_send_group_chat_invitation_rejection(self, community_admin, community_member, backend_new_profile):
234-
third_node = backend_new_profile("third_node")
235+
def test_send_group_chat_invitation_rejection(self, community_admin, community_member, backend_new_profile, waku_light_client):
236+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
235237
messenger.make_contacts(community_admin, third_node)
236238

237239
messenger.make_contacts(community_admin, community_member)

0 commit comments

Comments
 (0)