From 4e5e186784fa234a2f1b4b3a2fffe2eb4d92553a Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 6 Jun 2023 10:36:58 -0300 Subject: [PATCH] speed up MQTT tests --- test/unit_test.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/unit_test.c b/test/unit_test.c index 19283bf2..1316476a 100644 --- a/test/unit_test.c +++ b/test/unit_test.c @@ -475,17 +475,16 @@ static void test_mqtt_ver(uint8_t mqtt_version) { // Publish with QoS0 to subscribed topic and check reception opts.topic = topic, opts.message = data, opts.qos = 0, opts.retain = false; mg_mqtt_pub(c, &opts); - for (i = 0; i < 500 && test_data.flags == 0; i++) mg_mgr_poll(&mgr, 10); - ASSERT(test_data.flags == 0); // No PUBACK for QoS0 for (i = 0; i < 500 && buf[1] == 0; i++) mg_mgr_poll(&mgr, 10); if (strcmp(buf, "Xx/f12/hi") != 0) MG_INFO(("[%s]", buf)); + ASSERT(!(test_data.flags & flags_published)); // No PUBACK for QoS0 ASSERT(strcmp(buf, "Xx/f12/hi") == 0); memset(buf + 1, 0, sizeof(buf) - 1); test_data.flags = 0; // Publish with QoS1 to subscribed topic and check reception opts.topic = topic, opts.message = data, opts.qos = 1, opts.retain = false; - retries = 1; + retries = 0; // don't do retries for test speed do { // retry on failure after an expected timeout mg_mqtt_pub(c, &opts); for (i = 0; i < 500 && test_data.flags == 0; i++) mg_mgr_poll(&mgr, 10); @@ -534,7 +533,7 @@ connect_with_options: opts.num_props = 4; construct_props(properties); } - retries = 1; + retries = 0; // don't do retries for test speed do { // retry on failure after an expected timeout mg_mqtt_pub(c, &opts); for (i = 0; i < 500 && test_data.flags == 0; i++) mg_mgr_poll(&mgr, 10); @@ -552,7 +551,7 @@ connect_with_options: opts.num_props = 4; construct_props(properties); } - retries = 1; + retries = 0; // don't do retries for test speed do { // retry on failure after an expected timeout mg_mqtt_pub(c, &opts); for (i = 0; i < 500 && !(test_data.flags & flags_received); i++)