From 28997f510fffd13730bc2177b4f422bfbf1d98a0 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Wed, 10 Jul 2024 16:30:13 -0700 Subject: [PATCH] Use FlashMQTempDir in forkingTestSaveAndLoadDelayedWill --- FlashMQTests/willtests.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/FlashMQTests/willtests.cpp b/FlashMQTests/willtests.cpp index 0d9e630..b45b8dd 100644 --- a/FlashMQTests/willtests.cpp +++ b/FlashMQTests/willtests.cpp @@ -5,6 +5,7 @@ #include "flashmqtestclient.h" #include "conffiletemp.h" #include "mainappasfork.h" +#include "flashmqtempdir.h" void MainTests::testMqtt3will() @@ -352,10 +353,7 @@ void MainTests::testMqtt5DelayedWillsDisabled() */ void MainTests::forkingTestSaveAndLoadDelayedWill() { - // TODO: auto-delete temp dir. - char dir_template[255] = "/tmp/forkingTestSaveAndLoadDelayedWill_XXXXXXX"; - mkdtemp(dir_template); - const std::string tempdir(dir_template); + FlashMQTempDir tmpdir; cleanup(); @@ -364,7 +362,7 @@ void MainTests::forkingTestSaveAndLoadDelayedWill() allow_anonymous true log_level debug )"); - confFile.writeLine("storage_dir " + tempdir); + confFile.writeLine("storage_dir " + tmpdir.getPath().string()); confFile.closeFile(); const std::vector args {"--config-file", confFile.getFilePath()};