Add retries to MQTT connect in OTA agent tests
/* Test network header include. */
#include IOT_TEST_NETWORK_HEADER
+/* Test framework includes. */
+#include "aws_test_utils.h"
+
/* Configuration for this test. */
#include "aws_test_ota_config.h"
/**
* @brief Configuration for this test group.
*/
+#define otatestMQTT_RETRIES_START_MS ( 250 )
+#define otatestMQTT_RETRIES_MAX ( 7 )
#define otatestMAX_LOOP_MEM_LEAK_CHECK ( 1 )
#define otatestSHUTDOWN_WAIT pdMS_TO_TICKS( 10000 )
#define otatestAGENT_INIT_WAIT 10000
@@ -185,10 +190,13 @@ TEST_SETUP( Full_OTA_AGENT )
connectInfo.clientIdentifierLength = sizeof( clientcredentialIOT_THING_NAME ) - 1;
/* Connect to the broker. */
- connectStatus = IotMqtt_Connect( &networkInfo,
+ RETRY_EXPONENTIAL( connectStatus = IotMqtt_Connect( &networkInfo,
&connectInfo,
otatestAGENT_INIT_WAIT,
- &xMQTTClientHandle );
+ &xMQTTClientHandle ),
+ IOT_MQTT_SUCCESS,
+ otatestMQTT_RETRIES_START_MS,
+ otatestMQTT_RETRIES_MAX );
TEST_ASSERT_EQUAL_INT_MESSAGE(
IOT_MQTT_SUCCESS, connectStatus,
