Skip to content

Commit 8ff93da

Browse files
committed
test: parametrize functional tests for waku light client mode
Parametrize all functional tests to run in both full node and light client mode. Light client params marked xfail(strict=False) for #7393. Replace inline string IDs with constants.
1 parent 24d0132 commit 8ff93da

12 files changed

Lines changed: 144 additions & 44 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: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,26 @@
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(
13+
"waku_light_client",
14+
[
15+
pytest.param(False, id=FULL_NODE),
16+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
17+
],
18+
indirect=True,
19+
)
1220
class TestContactRequests:
1321
@pytest.fixture()
14-
def sender(self, backend_new_profile):
15-
return backend_new_profile("sender", bridge_network=True)
22+
def sender(self, backend_new_profile, waku_light_client):
23+
return backend_new_profile("sender", waku_light_client=waku_light_client, bridge_network=True)
1624

1725
@pytest.fixture()
18-
def receiver(self, backend_new_profile):
19-
return backend_new_profile("receiver", bridge_network=True)
26+
def receiver(self, backend_new_profile, waku_light_client):
27+
return backend_new_profile("receiver", waku_light_client=waku_light_client, bridge_network=True)
2028

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

tests-functional/tests/reliability/test_create_private_groups.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
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(
11+
"waku_light_client",
12+
[
13+
pytest.param(False, id=FULL_NODE),
14+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
15+
],
16+
indirect=True,
17+
)
1018
class TestCreatePrivateGroups:
1119

1220
@pytest.fixture()
13-
def community_admin(self, backend_new_profile):
14-
return backend_new_profile("community_admin", bridge_network=True)
21+
def community_admin(self, backend_new_profile, waku_light_client):
22+
return backend_new_profile("community_admin", waku_light_client=waku_light_client, bridge_network=True)
1523

1624
@pytest.fixture()
17-
def community_member(self, backend_new_profile):
18-
return backend_new_profile("member", bridge_network=True)
25+
def community_member(self, backend_new_profile, waku_light_client):
26+
return backend_new_profile("member", waku_light_client=waku_light_client, bridge_network=True)
1927

2028
def _run_create_private_group_baseline(self, community_admin, community_member, private_groups_count=1):
2129
messenger.make_contacts(community_admin, community_member)

tests-functional/tests/reliability/test_one_to_one_messages.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
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(
11+
"waku_light_client",
12+
[
13+
pytest.param(False, id=FULL_NODE),
14+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
15+
],
16+
indirect=True,
17+
)
1018
class TestOneToOneMessages:
1119

1220
@pytest.fixture()
13-
def sender(self, backend_new_profile):
14-
return backend_new_profile("sender", bridge_network=True)
21+
def sender(self, backend_new_profile, waku_light_client):
22+
return backend_new_profile("sender", waku_light_client=waku_light_client, bridge_network=True)
1523

1624
@pytest.fixture()
17-
def receiver(self, backend_new_profile):
18-
return backend_new_profile("receiver", bridge_network=True)
25+
def receiver(self, backend_new_profile, waku_light_client):
26+
return backend_new_profile("receiver", waku_light_client=waku_light_client, bridge_network=True)
1927

2028
def _run_one_to_one_message_baseline(self, sender, receiver, message_count=1):
2129
messenger.one_to_one_message(message_count, sender=sender, receiver=receiver)

tests-functional/tests/reliability/test_private_groups_messages.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
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(
11+
"waku_light_client",
12+
[
13+
pytest.param(False, id=FULL_NODE),
14+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
15+
],
16+
indirect=True,
17+
)
1018
class TestPrivateGroupMessages:
1119

1220
@pytest.fixture()
13-
def community_admin(self, backend_new_profile):
14-
return backend_new_profile("community_admin", bridge_network=True)
21+
def community_admin(self, backend_new_profile, waku_light_client):
22+
return backend_new_profile("community_admin", waku_light_client=waku_light_client, bridge_network=True)
1523

1624
@pytest.fixture()
17-
def community_member(self, backend_new_profile):
18-
return backend_new_profile("community_member", bridge_network=True)
25+
def community_member(self, backend_new_profile, waku_light_client):
26+
return backend_new_profile("community_member", waku_light_client=waku_light_client, bridge_network=True)
1927

2028
def _run_private_group_messages_baseline(self, community_admin, community_member, message_count=1):
2129
messenger.make_contacts(community_admin, community_member)

tests-functional/tests/test_wakuext_contact_requests.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import re
22
from uuid import uuid4
33
import pytest
4+
from resources.constants import FULL_NODE, LIGHT_CLIENT
45
from resources.enums import MessageContentType
56
from steps import async_messenger
67
from clients.api import ApiResponseError
78

89

910
@pytest.mark.rpc
1011
@pytest.mark.asyncio
11-
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=["wakuV2LightClient_False", "wakuV2LightClient_True"])
12+
@pytest.mark.parametrize(
13+
"waku_light_client",
14+
[
15+
pytest.param(False, id=FULL_NODE),
16+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
17+
],
18+
indirect=True,
19+
)
1220
class TestContactRequests:
1321

1422
@pytest.fixture

tests-functional/tests/test_wakuext_contact_verification.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,30 @@
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(
14+
"waku_light_client",
15+
[
16+
pytest.param(False, id=FULL_NODE),
17+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
18+
],
19+
indirect=True,
20+
)
1221
class TestContactVerification:
1322

1423
@pytest.fixture
15-
async def creator(self, async_backend_new_profile):
16-
return await async_backend_new_profile("creator")
24+
async def creator(self, async_backend_new_profile, waku_light_client):
25+
return await async_backend_new_profile("creator", waku_light_client=waku_light_client)
1726

1827
@pytest.fixture
19-
async def member(self, async_backend_new_profile, creator):
20-
m = await async_backend_new_profile("member")
28+
async def member(self, async_backend_new_profile, waku_light_client, creator):
29+
m = await async_backend_new_profile("member", waku_light_client=waku_light_client)
2130
await async_messenger.make_contacts(sender=creator, receiver=m)
2231
return m
2332

tests-functional/tests/test_wakuext_group_chats.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
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(
10+
"waku_light_client",
11+
[
12+
pytest.param(False, id=FULL_NODE),
13+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
14+
],
15+
indirect=True,
16+
)
817
class TestCreatePrivateGroups:
918

1019
@pytest.fixture()
11-
def community_admin(self, backend_new_profile):
12-
return backend_new_profile("community_admin")
20+
def community_admin(self, backend_new_profile, waku_light_client):
21+
return backend_new_profile("community_admin", waku_light_client=waku_light_client)
1322

1423
@pytest.fixture()
15-
def community_member(self, backend_new_profile):
16-
return backend_new_profile("community_member")
24+
def community_member(self, backend_new_profile, waku_light_client):
25+
return backend_new_profile("community_member", waku_light_client=waku_light_client)
1726

1827
def test_create_group_chat_with_members(self, community_admin, community_member):
1928
messenger.make_contacts(community_admin, community_member)
@@ -60,8 +69,8 @@ def test_leave_group_chat(self, community_admin, community_member):
6069
assert len(members_after_leave) == 1
6170
assert community_admin.public_key not in str(members_after_leave)
6271

63-
def test_send_group_chat_invitation_request(self, community_admin, community_member, backend_new_profile):
64-
third_node = backend_new_profile("third_node")
72+
def test_send_group_chat_invitation_request(self, community_admin, community_member, backend_new_profile, waku_light_client):
73+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
6574
messenger.make_contacts(community_admin, third_node)
6675

6776
messenger.make_contacts(community_admin, community_member)
@@ -103,8 +112,8 @@ def test_create_group_chat_from_invitation(self, community_admin, community_memb
103112
assert chats[0].get("invitationAdmin", "") == community_admin.public_key
104113
assert chats[0].get("name", "") == invitation_group
105114

106-
def test_add_members_to_group_chat(self, community_admin, community_member, backend_new_profile):
107-
third_node = backend_new_profile("third_node")
115+
def test_add_members_to_group_chat(self, community_admin, community_member, backend_new_profile, waku_light_client):
116+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
108117
messenger.make_contacts(community_admin, third_node)
109118

110119
messenger.make_contacts(community_admin, community_member)
@@ -146,8 +155,8 @@ def test_remove_member_from_group_chat(self, community_admin, community_member):
146155
message_pattern=f"@{community_member.public_key} left the group",
147156
)[0]
148157

149-
def test_remove_members_from_group_chat(self, community_admin, community_member, backend_new_profile):
150-
third_node = backend_new_profile("third_node")
158+
def test_remove_members_from_group_chat(self, community_admin, community_member, backend_new_profile, waku_light_client):
159+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
151160
messenger.make_contacts(community_admin, third_node)
152161

153162
messenger.make_contacts(community_admin, community_member)
@@ -211,8 +220,8 @@ def test_change_group_chat_name(self, community_admin, community_member):
211220
assert chats[0].get("name", "") == new_group_name
212221

213222
@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")
223+
def test_get_group_chat_invitations(self, community_admin, community_member, backend_new_profile, waku_light_client):
224+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
216225
messenger.make_contacts(community_admin, third_node)
217226

218227
messenger.make_contacts(community_admin, community_member)
@@ -230,8 +239,8 @@ def test_get_group_chat_invitations(self, community_admin, community_member, bac
230239
third_node.wakuext_service.get_group_chat_invitations()
231240
# TODO: Add more assertions on response
232241

233-
def test_send_group_chat_invitation_rejection(self, community_admin, community_member, backend_new_profile):
234-
third_node = backend_new_profile("third_node")
242+
def test_send_group_chat_invitation_rejection(self, community_admin, community_member, backend_new_profile, waku_light_client):
243+
third_node = backend_new_profile("third_node", waku_light_client=waku_light_client)
235244
messenger.make_contacts(community_admin, third_node)
236245

237246
messenger.make_contacts(community_admin, community_member)

tests-functional/tests/test_wakuext_message_reactions.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from clients.api import ApiResponseError
66
from clients.signals import SignalType
77
from resources.enums import MessageContentType
8+
from resources.constants import FULL_NODE, LIGHT_CLIENT
89
from steps import async_messenger
910

1011

@@ -20,7 +21,14 @@ async def sender(self, async_backend_new_profile, waku_light_client):
2021
async def receiver(self, async_backend_new_profile, waku_light_client):
2122
return await async_backend_new_profile("receiver", waku_light_client=waku_light_client)
2223

23-
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=["wakuV2LightClient_False", "wakuV2LightClient_True"])
24+
@pytest.mark.parametrize(
25+
"waku_light_client",
26+
[
27+
pytest.param(False, id=FULL_NODE),
28+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
29+
],
30+
indirect=True,
31+
)
2432
async def test_one_to_one_message_reactions(self, sender, receiver, waku_light_client):
2533
"""Test message reactions with different wakuV2LightClient configurations"""
2634
await async_messenger.make_contacts(sender, receiver)
@@ -89,7 +97,13 @@ async def test_one_to_one_message_reactions(self, sender, receiver, waku_light_c
8997
)
9098
)
9199

92-
@pytest.mark.parametrize("waku_light_client", [False], indirect=True, ids=["wakuV2LightClient_False"])
100+
@pytest.mark.parametrize(
101+
"waku_light_client",
102+
[
103+
pytest.param(False, id=FULL_NODE),
104+
],
105+
indirect=True,
106+
)
93107
async def test_limit_of_20_reactions(self, sender, receiver, waku_light_client):
94108
"""Test that you cannot send more than 20 message reactions on a single message"""
95109
await async_messenger.make_contacts(sender, receiver)

tests-functional/tests/test_wakuext_messages_fetching.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import pytest
22

3+
from resources.constants import FULL_NODE, LIGHT_CLIENT
34
from steps import messenger
45

56

67
@pytest.mark.rpc
7-
@pytest.mark.parametrize("waku_light_client", [False, True], indirect=True, ids=["wakuV2LightClient_False", "wakuV2LightClient_True"])
8+
@pytest.mark.parametrize(
9+
"waku_light_client",
10+
[
11+
pytest.param(False, id=FULL_NODE),
12+
pytest.param(True, id=LIGHT_CLIENT, marks=pytest.mark.xfail(reason="status-go#7393 filter subscription race", strict=False)),
13+
],
14+
indirect=True,
15+
)
816
class TestFetchingChatMessages:
917

1018
@pytest.fixture()

0 commit comments

Comments
 (0)