44 * SPDX-License-Identifier: Apache-2.0
55 */
66#include < memory>
7+ #include < net/if.h>
78#include < random>
89#include < string_view>
910#include < type_traits>
@@ -51,7 +52,6 @@ using unique_mqtt_client = std::unique_ptr < std::remove_pointer_t<esp_mqtt_clie
5152
5253SCENARIO (" MQTT Client Operation" )
5354{
54- // [[maybe_unused]] auto protect = TEST_PROTECT();
5555 // Set expectations for the mocked calls.
5656 int mtx = 0 ;
5757 int transport_list = 0 ;
@@ -76,6 +76,7 @@ SCENARIO("MQTT Client Operation")
7676 esp_read_mac_IgnoreAndReturn (ESP_OK);
7777 esp_read_mac_ReturnThruPtr_mac (mac);
7878 esp_transport_list_destroy_IgnoreAndReturn (ESP_OK);
79+ esp_transport_destroy_IgnoreAndReturn (ESP_OK);
7980 vEventGroupDelete_Ignore ();
8081 vQueueDelete_Ignore ();
8182 GIVEN (" An a minimal config" ) {
@@ -113,6 +114,15 @@ SCENARIO("MQTT Client Operation")
113114 REQUIRE (res == ESP_FAIL);
114115 }
115116 }
117+ SECTION (" User set interface to use" ){
118+ http_parser_parse_url_ExpectAnyArgsAndReturn (0 );
119+ http_parser_parse_url_ReturnThruPtr_u (&ret_uri);
120+ struct ifreq if_name = {.ifr_ifrn = {" custom" }};
121+ config.network .if_name = &if_name;
122+ SECTION (" Client is not started" ){
123+ REQUIRE (esp_mqtt_set_config (client.get (), &config)== ESP_OK);
124+ }
125+ }
116126 SECTION (" After Start Client Is Cleanly destroyed" ) {
117127 REQUIRE (esp_mqtt_client_start (client.get ()) == ESP_OK);
118128 // Only need to start the client, destroy is called automatically at the end of
0 commit comments