2019-07-27 11:49:03 +08:00
|
|
|
import functools
|
|
|
|
|
2019-05-07 11:44:13 +08:00
|
|
|
import pytest
|
|
|
|
|
2019-11-21 11:47:54 +08:00
|
|
|
from libp2p.tools.constants import FLOODSUB_PROTOCOL_ID
|
|
|
|
from libp2p.tools.factories import GossipsubFactory
|
|
|
|
from libp2p.tools.pubsub.floodsub_integration_test_settings import (
|
2019-07-27 11:49:03 +08:00
|
|
|
floodsub_protocol_pytest_params,
|
2019-08-03 13:36:19 +08:00
|
|
|
perform_test_from_obj,
|
2019-07-26 18:35:25 +08:00
|
|
|
)
|
2019-05-07 11:44:13 +08:00
|
|
|
|
2019-07-26 18:35:25 +08:00
|
|
|
|
2019-05-07 11:44:13 +08:00
|
|
|
@pytest.mark.asyncio
|
2019-07-27 11:49:03 +08:00
|
|
|
async def test_gossipsub_initialize_with_floodsub_protocol():
|
2019-08-01 00:09:09 +08:00
|
|
|
GossipsubFactory(protocols=[FLOODSUB_PROTOCOL_ID])
|
2019-05-07 11:44:13 +08:00
|
|
|
|
2019-07-26 18:35:25 +08:00
|
|
|
|
2019-08-01 06:00:12 +08:00
|
|
|
@pytest.mark.parametrize("test_case_obj", floodsub_protocol_pytest_params)
|
2019-05-07 11:44:13 +08:00
|
|
|
@pytest.mark.asyncio
|
2019-08-03 07:48:43 +08:00
|
|
|
@pytest.mark.slow
|
2019-07-27 11:49:03 +08:00
|
|
|
async def test_gossipsub_run_with_floodsub_tests(test_case_obj):
|
|
|
|
await perform_test_from_obj(
|
|
|
|
test_case_obj,
|
2019-08-14 05:36:42 +08:00
|
|
|
functools.partial(
|
|
|
|
GossipsubFactory, degree=3, degree_low=2, degree_high=4, time_to_live=30
|
|
|
|
),
|
2019-07-27 11:49:03 +08:00
|
|
|
)
|