fix: add lightpush case to publish_message

This commit is contained in:
Roman 2024-04-29 11:54:21 +08:00
parent f9693755d0
commit 00eeaa553e
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
2 changed files with 7 additions and 14 deletions

View File

@ -111,7 +111,7 @@ class StepsRLN(StepsCommon):
raise
@allure.step
def publish_message(self, message=None, pubsub_topic=None, sender=None):
def publish_message(self, message=None, pubsub_topic=None, sender=None, use_lightpush=False):
if message is None:
message = self.create_message()
if pubsub_topic is None:
@ -119,18 +119,11 @@ class StepsRLN(StepsCommon):
if not sender:
sender = self.node1
sender.send_relay_message(message, pubsub_topic)
def publish_light_push_message(self, message=None, pubsub_topic=None, sender=None):
if message is None:
message = self.create_message()
if pubsub_topic is None:
pubsub_topic = self.test_pubsub_topic
if not sender:
sender = self.node1
payload = self.create_payload(pubsub_topic, message)
sender.send_light_push_message(payload)
if use_lightpush:
payload = self.create_payload(pubsub_topic, message)
sender.send_light_push_message(payload)
else:
sender.send_relay_message(message, pubsub_topic)
@allure.step
def ensure_relay_subscriptions_on_nodes(self, node_list, pubsub_topic_list):

View File

@ -184,7 +184,7 @@ class TestRelayRLN(StepsRLN, StepsRelay):
message = self.create_message(payload=to_base64(payload["value"]))
try:
now = math.trunc(time())
self.publish_light_push_message(message=message, sender=self.light_push_node2)
self.publish_message(message=message, sender=self.light_push_node2, use_lightpush=True)
if i > 0 and (now - previous) == 0:
raise AssertionError("Publish with RLN enabled at spam rate worked!!!")
else: