diff --git a/support/testing/tests/package/test_mosquitto.py b/support/testing/tests/package/test_mosquitto.py index ba10b30b00b5..6b256e5e27f0 100644 --- a/support/testing/tests/package/test_mosquitto.py +++ b/support/testing/tests/package/test_mosquitto.py @@ -25,13 +25,19 @@ def test_run(self): msg = "Hello Buildroot!" # We subscribe to a topic and write one message to a log file. - self.assertRunOk(f"mosquitto_sub -t {topic} -C 1 > {log} &") + cmd = f"( mosquitto_sub -t {topic} -C 1 > {log} 2> /dev/null & )" + self.assertRunOk(cmd) - time.sleep(1) + # We give some time to the subscriber process to settle. + time.sleep(5) # We publish a message. self.assertRunOk(f"mosquitto_pub -t {topic} -m '{msg}'") + # We give some more time to the subscriber process to write + # the log and quit. + time.sleep(5) + # We check the log file contains our message. out, ret = self.emulator.run(f"cat {log}") self.assertEqual(ret, 0)