paho.mqtt.testing icon indicating copy to clipboard operation
paho.mqtt.testing copied to clipboard

MQTT V5 python conformance test test_shared_subscriptions has wrong callback

Open mbuckton opened this issue 4 years ago • 0 comments

In the test test_shared_subscriptions where it adds the second client connection / subscription, the test checks the callback result of aclient and not bclient.

As in line : 1148 self.waitfor(callback.subscribeds, 1, 3)

Should be self.waitfor(callback2.subscribeds, 1, 3)

What happens is that the test falls through, since the original callback is valid it doesn't wait for the second connection and as a result doesn't clear the callbacks in the next 2 lines resulting in false positives

Complete code block follows

  connack = aclient.connect(host=host, port=port, cleanstart=True)
  self.assertEqual(connack.reasonCode.getName(), "Success")
  self.assertEqual(connack.sessionPresent, False)
  aclient.subscribe([shared_sub_topic, topics[0]], [MQTTV5.SubscribeOptions(2)]*2) 
  self.waitfor(callback.subscribeds, 1, 3)

  connack = bclient.connect(host=host, port=port, cleanstart=True)
  self.assertEqual(connack.reasonCode.getName(), "Success")
  self.assertEqual(connack.sessionPresent, False)
  bclient.subscribe([shared_sub_topic, topics[0]], [MQTTV5.SubscribeOptions(2)]*2) 
  self.waitfor(callback2.subscribeds, 1, 3)

mbuckton avatar Jul 17 '20 05:07 mbuckton