mqtt_cpp
mqtt_cpp copied to clipboard
Enhanced testing
I wanted to write down some of the problems that I've noticed we've had over the last several months. I think so far all of them have been fixed, but these are things that we never wrote additional tests for:
- Verifying that incoming packets are still processed after each packet type is sent, and each type is received. (e.g. #402)
- Verifying that all of the error cases that the mqtt_cpp codebase explicitly checks for behave as expected (e.g. boost asio claims X bytes are available, but then we only receive Y), in addition to all of the possible ways for malformed packets to be misinterpreted (though, I think there are several tests for this already).
- Various behaviors related to interrupted connections. For this we might use a "mock" boost::asio socket implementation. https://stackoverflow.com/questions/11254169/unit-testing-and-boostasio
Can you think of anything else that's not being handled by the current test coverage?
- Call
force_disconnect()
from client/server side during the receiving packet is processing (for all state).- State means
process_*()
for MQTT packet and underlying TCP/TLS/WS state.
- State means
- MQTT reserved bit (they should be zero) might be not checked perfectly. (This might be a part of 2)
BTW, writing "mock" with Boost.Test, http://turtle.sourceforge.net/ https://github.com/mat007/turtle might be useful.
Related to No.4,
https://github.com/redboltz/mqtt_cpp/blob/master/include/mqtt/endpoint.hpp#L6850-L6863 implementation is a result of many times try and error.
I've used Turtle / Boost mock before. I enjoyed it. I think it would be a good tool to use.
Nice! http://turtle.sourceforge.net/turtle/acknowledgements.html Takatoshi Kondo is me ;)
Huh. You've been involved in a lot of stuff I've worked with over the years. Awesome :-)