Skip to content

Commit

Permalink
* MDF [ft ws test] logs only when failed
Browse files Browse the repository at this point in the history
Signed-off-by: wayne <yukang.wei@emqx.io>
  • Loading branch information
StargazerWayne committed May 21, 2024
1 parent f49c9f8 commit 5c4f992
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/scripts/ws_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
g_pub_times = 1
g_connected = 0

log = ""

def on_log(client, userdata, level, buf):
print("log: ",buf)
log = log + buf + '\n'

def on_message(self, obj, msg):
assert msg.topic == str(msg.payload, 'utf-8')
Expand Down Expand Up @@ -74,7 +76,9 @@ def assert_test(self, send_times, _qos, sub, pub):
self._mqttc.disconnect()
qos -= 1

assert g_send_times * (_qos + 1) == g_recv_times
if(g_send_times * (_qos + 1) != g_recv_times):
print(log)
assert(g_send_times * (_qos + 1) == g_recv_times)

g_recv_times = 0
qos = _qos
Expand All @@ -101,7 +105,10 @@ def assert_test(self, send_times, _qos, sub, pub):
self._mqttc.loop_stop()
self._mqttc.disconnect()
qos -= 1
assert 0 == g_recv_times

if(g_recv_times != 0):
print(log)
assert(0 == g_recv_times)

def ws_test():
t1 = Test()
Expand All @@ -114,8 +121,7 @@ def ws_test():
t1.assert_test(3, 2, "+/a/+", "test/a/b")
t1.assert_test(3, 2, "+/a/b", "test/a/b")
t1.assert_test(3, 2, "test/#", "test/a/b")



t1 = Test()
t1.init(prot=MQTTv5)
t1.assert_test(3, 1, "test/a/b", "test/a/b")
Expand Down

0 comments on commit 5c4f992

Please sign in to comment.