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

How to test behavior with QoS 1 with connection drop-out mid-publish?

Open philCryoport opened this issue 3 years ago • 2 comments

Hi there,

We are considering AWS IoT Core.

Our Quality department has asked for us to run a Operational Quality test between the MQTT client and AWS IoT MQTT broker so that we can document evidence of the following behavior:

  • IF
    • QoS 1 is enabled for publishing from a MQTT client to a MQTT broker's topic
  • AND
    • WHILE the MQTT client is publishing a message to that MQTT broker's topic
    • IF the connection drops mid-publish
  • THEN
    • The MQTT broker will not accept the partial message -- and thus the message won't be delivered to the topic
    • AND
    • The MQTT client will NOT receive a PUBACK

I looked through the code and the only thing I could find that was close to this was https://github.com/eclipse/paho.mqtt.testing/blob/252b6b9a486336221a5fd9d7cd0560f70e7922d7/interoperability/client_test.py#L322 ...but that only tests if there is no connection to begin with.

In contrast, what I'm seeking is a way to demonstrate behavior:

  • IF
    • The connection was there to begin with
  • AND THEN
    • Mid-publish, the connection drops

Help?

philCryoport avatar Jun 09 '22 21:06 philCryoport

One way to do this, is to use a network proxy between the client and broker which will break the connection at the appropriate point. There is such a simple proxy in the testing repo and the C client repo (paho.mqtt.c) written in Python. It can be altered to cut the connection at the point you want.

icraggs avatar Jun 18 '22 13:06 icraggs

One way to do this, is to use a network proxy between the client and broker which will break the connection at the appropriate point. There is such a simple proxy in the testing repo and the C client repo (paho.mqtt.c) written in Python. It can be altered to cut the connection at the point you want.

Neat! I'll try it. Thank you!

philCryoport avatar Jun 20 '22 17:06 philCryoport