forked from boostorg/mqtt5
(Un)subscribe validates the number of topics and reason codes
Test Plan: related to T12015 - (un)subscribe reason codes will always contain as many reason codes as there are topic filters - if, by some odd chance, the client receives the wrong number of rcs or some are invalid, it will treat it as malformed - both subscribe_op and unsubscribe_op should be 100% covered by tests now Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Differential Revision: https://repo.mireo.local/D27592
This commit is contained in:
1 parent
4bf59cc18c
commit
d6c4884d53
10 files changed
+405
-81
No files matched your search
@@ -6,6 +6,8 @@
|
||||
#include <async_mqtt5/mqtt_client.hpp>
|
||||
|
||||
#include "test_common/message_exchange.hpp"
|
||||
#include "test_common/packet_util.hpp"
|
||||
#include "test_common/test_broker.hpp"
|
||||
#include "test_common/test_service.hpp"
|
||||
#include "test_common/test_stream.hpp"
|
||||
|
||||
@@ -122,12 +124,6 @@ BOOST_FIXTURE_TEST_CASE(receive_publish_qos2, shared_test_data) {
|
||||
run_test(std::move(broker_side));
|
||||
}
|
||||
|
||||
disconnect_props dprops_with_reason_string(const std::string& reason_string) {
|
||||
disconnect_props dprops;
|
||||
dprops[prop::reason_string] = reason_string;
|
||||
return dprops;
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(receive_malformed_publish, shared_test_data) {
|
||||
// packets
|
||||
auto malformed_publish = encoders::encode_publish(
|
||||
@@ -137,7 +133,7 @@ BOOST_FIXTURE_TEST_CASE(receive_malformed_publish, shared_test_data) {
|
||||
|
||||
auto disconnect = encoders::encode_disconnect(
|
||||
reason_codes::malformed_packet.value(),
|
||||
dprops_with_reason_string("Malformed PUBLISH received: QoS bits set to 0b11")
|
||||
test::dprops_with_reason_string("Malformed PUBLISH received: QoS bits set to 0b11")
|
||||
);
|
||||
|
||||
test::msg_exchange broker_side;
|
||||
@@ -162,7 +158,7 @@ BOOST_FIXTURE_TEST_CASE(receive_malformed_pubrel, shared_test_data) {
|
||||
|
||||
auto disconnect = encoders::encode_disconnect(
|
||||
reason_codes::malformed_packet.value(),
|
||||
dprops_with_reason_string("Malformed PUBREL received: invalid Reason Code")
|
||||
test::dprops_with_reason_string("Malformed PUBREL received: invalid Reason Code")
|
||||
);
|
||||
|
||||
test::msg_exchange broker_side;
|
||||
|
||||
Reference in new issue
Block a user