mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 00:51:12 +00:00
tests-functional/ -> test/functional/ tests-unit-network/ -> test/unit-network/ No Go code changes beyond the two package paths. Every reference follows: Makefile targets, the pytest-lint and reliability workflows, the three Jenkinsfiles, the root Dockerfile, pyrightconfig.json, .gitignore, the benchmark and functional-test scripts, and the docs. All paths inside the moved directories are self-contained (docker compose uses `context: .`, the Python helpers resolve from __file__), so the extra level of nesting does not reach outside. refs #7067
84 lines
3.6 KiB
Python
84 lines
3.6 KiB
Python
import pytest
|
|
|
|
from steps import messenger
|
|
from utils.config import Config
|
|
|
|
|
|
def pytest_generate_tests(metafunc):
|
|
if "peer_image" in metafunc.fixturenames:
|
|
images = Config.peer_docker_images or ([Config.docker_image] if Config.docker_image else [])
|
|
ids = [(image.split(":")[-1] or "self") for image in images]
|
|
metafunc.parametrize("peer_image", images, ids=ids)
|
|
|
|
|
|
@pytest.mark.compatibility
|
|
@pytest.mark.parametrize(
|
|
("vut_light", "peer_light"),
|
|
[
|
|
pytest.param(False, False, id="full-full"),
|
|
pytest.param(False, True, id="full-light"),
|
|
pytest.param(True, False, id="light-full"),
|
|
pytest.param(True, True, id="light-light"),
|
|
],
|
|
)
|
|
class TestChatCompatibility:
|
|
"""Cross-version chat smoke: vut (build under test) talks to peer (a released backend).
|
|
|
|
Each test runs in a full/light waku mode matrix: vut runs in the first mode,
|
|
peer and third run in the second.
|
|
"""
|
|
|
|
@pytest.fixture()
|
|
def vut(self, backend_new_profile, vut_light):
|
|
return backend_new_profile("vut", waku_light_client=vut_light)
|
|
|
|
@pytest.fixture()
|
|
def peer(self, backend_new_profile, peer_image, peer_light):
|
|
return backend_new_profile("peer", image=peer_image, waku_light_client=peer_light)
|
|
|
|
@pytest.fixture()
|
|
def third(self, backend_new_profile, peer_image, peer_light):
|
|
return backend_new_profile("third", image=peer_image, waku_light_client=peer_light)
|
|
|
|
def test_one_to_one_compatibility(self, vut, peer):
|
|
messenger.make_contacts(vut, peer)
|
|
messenger.one_to_one_message(1, sender=vut, receiver=peer)
|
|
messenger.one_to_one_message(1, sender=peer, receiver=vut)
|
|
|
|
def test_group_chat_compatibility(self, vut, peer, third):
|
|
messenger.make_contacts(vut, peer)
|
|
messenger.make_contacts(vut, third)
|
|
|
|
group_id = messenger.join_private_group(admin=vut, member=peer)
|
|
messenger.private_group_message(2, group_id, sender=vut, receiver=peer)
|
|
|
|
messenger.add_group_member(vut, group_id, third, observers=[peer, third])
|
|
messenger.private_group_message(2, group_id, sender=vut, receiver=third)
|
|
|
|
messenger.remove_group_member(vut, group_id, third, observers=[peer])
|
|
messenger.private_group_message(2, group_id, sender=peer, receiver=vut)
|
|
|
|
messenger.leave_group(peer, group_id, observers=[vut])
|
|
|
|
def test_community_compatibility(self, vut, peer, third):
|
|
community_id = messenger.create_community(vut)
|
|
|
|
# Pre-install the community's persistent filter on the joiner before joining.
|
|
# On light clients this avoids status-im/status-go#7547: otherwise the join's
|
|
# internal warm-up fetchCommunity is the one that creates (and later forgets)
|
|
# the bare community filter, collaterally tearing down the aggregated filter
|
|
# subscription so pushed community messages are rejected. Spectating first
|
|
# makes the filter already exist, so the warm-up fetches reuse it.
|
|
messenger.spectate_and_fetch_community(peer, community_id)
|
|
chat_id = messenger.join_community(member=peer, admin=vut, community_id=community_id)
|
|
messenger.community_messages(chat_id, 2, sender=vut, receiver=peer)
|
|
|
|
messenger.spectate_and_fetch_community(third, community_id)
|
|
messenger.join_community(member=third, admin=vut, community_id=community_id)
|
|
messenger.community_messages(chat_id, 2, sender=vut, receiver=third)
|
|
|
|
messenger.ban_community_member(vut, community_id, third)
|
|
messenger.community_messages(chat_id, 2, sender=peer, receiver=vut)
|
|
|
|
messenger.leave_the_community(peer, community_id)
|