From d87b2bd339b1da932f14349ffa5a2ae9b82b4fa4 Mon Sep 17 00:00:00 2001 From: 5cript Date: Wed, 4 Nov 2026 00:54:03 +0100 Subject: [PATCH] Gave real server tests a directory of their own, not the process temp root - RealServerTests and ExistenceCheckTests took temporaryRoot itself as their TemporaryDirectory and removed it at teardown, every later test that needs it failed in SetUp, the tracker tests after an upload suite for one - Each gets a directory below it now, the mock server's key is written there --- backend/test/backend/real_server_tests.hpp | 5 +++-- backend/test/backend/test_existence_check.hpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/test/backend/real_server_tests.hpp b/backend/test/backend/real_server_tests.hpp index 7b9c939a..c68affe1 100644 --- a/backend/test/backend/real_server_tests.hpp +++ b/backend/test/backend/real_server_tests.hpp @@ -61,7 +61,7 @@ class RealServerTests : public ::testing::Test protected: void SetUp() override { - std::ofstream privateKeyFile{temporaryRoot / "key.private", std::ios_base::binary}; + std::ofstream privateKeyFile{isolateDirectory_.path() / "key.private", std::ios_base::binary}; privateKeyFile.write(privateKey, std::strlen(privateKey)); } @@ -140,7 +140,8 @@ class RealServerTests : public ::testing::Test } protected: - Utility::TemporaryDirectory isolateDirectory_{temporaryRoot, false}; + /** @brief The test's own directory for its server, removed with the test. temporaryRoot outlives every test. */ + Utility::TemporaryDirectory isolateDirectory_{temporaryRoot}; boost::asio::thread_pool pool_{1}; nlohmann::json defaultPackageJson_ = nlohmann::json({ {"name", "test"}, diff --git a/backend/test/backend/test_existence_check.hpp b/backend/test/backend/test_existence_check.hpp index 5f6d1247..d27def1a 100644 --- a/backend/test/backend/test_existence_check.hpp +++ b/backend/test/backend/test_existence_check.hpp @@ -32,7 +32,7 @@ namespace Test return Paths::nativeToUtf8(root_.path() / relative); } - Utility::TemporaryDirectory root_{temporaryRoot, false}; + Utility::TemporaryDirectory root_{temporaryRoot}; }; TEST_F(ExistenceCheckTests, LocalMissingPathIsAbsentAndExistingPathsExist)