eclipse / paho.mqtt.testing

An Eclipse Paho project - a Python broker for testing
https://eclipse.org/paho
Other
108 stars 73 forks source link

MQTT V5 python conformance test test_shared_subscriptions has wrong callback #66

Open mbuckton opened 4 years ago

mbuckton commented 4 years ago

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)