1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00
qtmqtt/tests
Even Oscar Andersen 534ece0b07 Make sure unsubscribe followed by subscribe returns new subscription
Since we could only have one subscription for each topic it was
not possible to return a new subscription when a subscription
request comes in on a topic that is scheduled for destruction.

We solve this by switching to a QMultiHash for the active
subscriptions, allowing more then one subscription for a
given topic. However, at most one of these subscriptions
are not present in the list of subscriptions scheduled to
be unsubscribed

This patch also changes multiple unsubscribes to the
same topic. Earlier all would return true, and
m_pendingUnsubscriptions would be updated for all
requests.
The new behavior is that only the first unsubscribe
is acted upon. Furthere requests will return false.

Fixes: QTBUG-135653
Change-Id: I5a79efb68b3191e185325a89cc2042c773bb5c12
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
(cherry picked from commit c383083270)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 71bc423d11)
(cherry picked from commit c6a708a71a)
2025-06-25 03:16:37 +00:00
..
auto Make sure unsubscribe followed by subscribe returns new subscription 2025-06-25 03:16:37 +00:00
benchmarks Change license for test files 2024-03-20 08:11:56 +01:00
common Change license for test files 2024-03-20 08:11:56 +01:00
libfuzzer/mqtt/data_receive Change license for test files 2024-03-20 08:11:56 +01:00
manual Only call find_package when building tests as standalone 2024-11-28 17:21:24 +00:00
CMakeLists.txt Remove remains of qmake conversion from CMakeLists.txt files 2023-02-10 11:52:33 +01:00
README.txt Add README for using auto tests 2018-02-02 07:59:27 +00:00

The tests included in the subdirectories check for functionality and
conformance of the Qt MQTT module.

To be able to run the tests successfully, a broker needs to be available and
reachable.

The continuous integration utilized the paho conformance test broker. It can
be obtained at this location:
https://github.com/eclipse/paho.mqtt.testing

For the unit tests being able to locate this script, use the
MQTT_TEST_BROKER_LOCATION environment variable and set it
to “<install-path>/interoperability/startbroker.py”.

Alternatively, any broker can be instantiated and passed to the auto tests
by using the environment variable MQTT_TEST_BROKER. This must point to a
valid url. The broker must run on the standardized port 1883.

Note, that the unit tests verify functionality against the MQTT 3.1.1 version
of the standard, hence the broker needs to be compliant to the adherent
specifications.