mirror of
https://github.com/logos-messaging/logos-messaging-interop-tests.git
synced 2026-07-28 19:23:10 +00:00
Adding RC07
This commit is contained in:
parent
2095524663
commit
f75860b413
@ -22,6 +22,10 @@ MESSAGE_RECEIVED_EVENT = "message_received"
|
||||
RC06_CHANNEL_ID = "rc06-channel"
|
||||
RC06_CONTENT_TOPIC = "/test/1/rc06-channel/proto"
|
||||
|
||||
RC07_CHANNEL_ID = "rc07-channel"
|
||||
RC07_CONTENT_TOPIC = "/test/1/rc07-channel/proto"
|
||||
RC07_OTHER_CONTENT_TOPIC = "/test/1/rc07-other/proto"
|
||||
|
||||
CLOSED_CHANNEL_ID = "rc-closed-channel"
|
||||
CLOSED_CONTENT_TOPIC = "/test/1/rc-closed-channel/proto"
|
||||
|
||||
@ -184,6 +188,60 @@ class TestChannelDelivery:
|
||||
leaked = wait_for_channel_received(receiver_collector, RC06_CHANNEL_ID, NO_CHANNEL_DELIVERY_WINDOW_S)
|
||||
assert leaked is None, f"an unmarked message must not surface as a {CHANNEL_RECEIVED_EVENT}; got: {leaked!r}"
|
||||
|
||||
def test_rc07_wrong_content_topic_dropped(self, node_config):
|
||||
"""RC07: a correctly-marked channel message published on a different
|
||||
content topic is dropped at channel ingress.
|
||||
|
||||
A runs the same channelId as B but on RC07_OTHER_CONTENT_TOPIC. B is
|
||||
subscribed to that topic too, so B's messaging layer still surfaces the
|
||||
message (message_received), proving it arrived, but B's channel is bound
|
||||
to RC07_CONTENT_TOPIC and must not fire channel_message_received.
|
||||
"""
|
||||
payload_b64 = to_base64("rc07 message on the wrong content topic")
|
||||
|
||||
node_config.update(
|
||||
{
|
||||
"relay": True,
|
||||
"reliabilityEnabled": False,
|
||||
"numShardsInNetwork": 1,
|
||||
}
|
||||
)
|
||||
|
||||
receiver_collector = EventCollector()
|
||||
receiver_result = WrapperManager.create_and_start(config=node_config, event_cb=receiver_collector.event_callback)
|
||||
assert receiver_result.is_ok(), f"Failed to start receiver: {receiver_result.err()}"
|
||||
|
||||
with receiver_result.ok_value as receiver:
|
||||
sender_config = {
|
||||
**node_config,
|
||||
"staticnodes": [get_node_multiaddr(receiver)],
|
||||
"portsShift": 1,
|
||||
}
|
||||
|
||||
for content_topic in (RC07_CONTENT_TOPIC, RC07_OTHER_CONTENT_TOPIC):
|
||||
subscribe_result = receiver.subscribe_content_topic(content_topic)
|
||||
assert subscribe_result.is_ok(), f"receiver subscribe_content_topic {content_topic} failed: {subscribe_result.err()}"
|
||||
|
||||
receiver_create = receiver.channel_create(RC07_CHANNEL_ID, RC07_CONTENT_TOPIC, SENDER_B)
|
||||
assert receiver_create.is_ok(), f"receiver channel_create failed: {receiver_create.err()}"
|
||||
|
||||
with ChannelSenderProcess(
|
||||
sender_config,
|
||||
content_topic=RC07_OTHER_CONTENT_TOPIC,
|
||||
channel_id=RC07_CHANNEL_ID,
|
||||
sender_id=SENDER_A,
|
||||
payload_b64=payload_b64,
|
||||
settle_s=MESH_SETTLE_S,
|
||||
):
|
||||
arrived = wait_for_message_received(receiver_collector, RC07_OTHER_CONTENT_TOPIC, DELIVERY_TIMEOUT_S)
|
||||
assert arrived is not None, (
|
||||
f"receiver never saw a {MESSAGE_RECEIVED_EVENT} for {RC07_OTHER_CONTENT_TOPIC} within {DELIVERY_TIMEOUT_S}s; "
|
||||
f"cannot conclude the channel dropped it. Collected events: {receiver_collector.snapshot()}"
|
||||
)
|
||||
|
||||
leaked = wait_for_channel_received(receiver_collector, RC07_CHANNEL_ID, NO_CHANNEL_DELIVERY_WINDOW_S)
|
||||
assert leaked is None, f"a message on a foreign content topic must not surface as a {CHANNEL_RECEIVED_EVENT}; got: {leaked!r}"
|
||||
|
||||
def test_receive_after_close_emits_no_channel_event(self, node_config):
|
||||
"""A closed channel must not deliver: B closes its channel, then A sends a
|
||||
valid channel message on the same channel + content topic.
|
||||
@ -197,7 +255,6 @@ class TestChannelDelivery:
|
||||
node_config.update(
|
||||
{
|
||||
"relay": True,
|
||||
"store": False,
|
||||
"reliabilityEnabled": False,
|
||||
"numShardsInNetwork": 1,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user