diff --git a/examples/W5500/client-with-W5500-RP2040/RP2040W5500SimpleBroker.binary.zip b/examples/W5500/client-with-W5500-RP2040/RP2040W5500SimpleBroker.binary.zip deleted file mode 100644 index f6fd547..0000000 Binary files a/examples/W5500/client-with-W5500-RP2040/RP2040W5500SimpleBroker.binary.zip and /dev/null differ diff --git a/tests/compile-test/Makefile b/tests/compile-tests/Makefile similarity index 100% rename from tests/compile-test/Makefile rename to tests/compile-tests/Makefile diff --git a/tests/compile-test/tinymqtt-test.ino b/tests/compile-tests/tinymqtt-test.ino similarity index 100% rename from tests/compile-test/tinymqtt-test.ino rename to tests/compile-tests/tinymqtt-test.ino diff --git a/tests/network-tests/network-tests.ino b/tests/network-tests/network-tests.ino index fc4d0e3..2528c96 100644 --- a/tests/network-tests/network-tests.ino +++ b/tests/network-tests/network-tests.ino @@ -278,37 +278,41 @@ test(retained_message) broker.retain(10); IPAddress broker_ip = WiFi.localIP(); - MqttClient local_client(&broker); + MqttClient local_client(&broker, "sender"); // Send a retained message // No remote client connected - local_client.publish("topic", "retained", true); + local_client.publish("topic", "retained once", true); + for(int i=0; i<2; i++) { broker.loop(); local_client.loop(); }; - for(int i=0; i<2; i++) - { - broker.loop(); - local_client.loop(); - }; + // Send a second message on the same topic (issue 86) + local_client.publish("topic", "retained once", true); + for(int i=0; i<2; i++) { broker.loop(); local_client.loop(); }; + + // Send a second message on the same topic (issue 86) + local_client.publish("topic", "retained last", true); + for(int i=0; i<2; i++) { broker.loop(); local_client.loop(); }; // No connect a client from 2nd Esp ESP8266WiFiClass::selectInstance(2); - MqttClient remote_client; + MqttClient remote_client("receiver"); remote_client.connect(broker_ip, 1883); remote_client.setCallback(onPublish); assertTrue(remote_client.connected()); - for(int i=0; i<4; i++) { broker.loop(); local_client.loop(); remote_client.loop(); }; + for(int i=0; i<10; i++) { broker.loop(); local_client.loop(); remote_client.loop(); }; assertEqual(broker.clientsCount(), (size_t) 2); // Should not have received anything yet assertEqual(published.size(), (size_t)0); // Now, remote client subscribes to topic - remote_client.subscribe("topic"); - for(int i=0; i<4; i++) { broker.loop(); local_client.loop(); remote_client.loop(); }; + remote_client.subscribe("#"); + for(int i=0; i<10; i++) { broker.loop(); local_client.loop(); remote_client.loop(); }; - // Check that the retained message is published + // Check that the retained message is published once assertEqual(published.size(), (size_t)1); + assertEqual(published["receiver"]["topic"], 1); // FIXME we should check that // 1 - Retained message has the retain flag set