@@ -2,7 +2,9 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <filesystem>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -11,8 +13,10 @@ class MissionStoreTest : public ::testing::Test
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
dir_ = std::filesystem::temp_directory_path() / "lm_test_store";
|
||||
std::filesystem::remove_all(dir_);
|
||||
static std::atomic<unsigned> seq{0};
|
||||
dir_ = std::filesystem::temp_directory_path()
|
||||
/ ("lm_test_" + std::to_string(getpid()) + "_"
|
||||
+ std::to_string(seq.fetch_add(1)));
|
||||
std::filesystem::create_directories(dir_);
|
||||
store_path_ = dir_ / "missions.json";
|
||||
std::filesystem::copy_file(std::filesystem::path(TEST_FIXTURE_DIR) / "missions.json",
|
||||
@@ -21,6 +25,12 @@ protected:
|
||||
store_ = std::make_unique<lm::MissionStore>(store_path_);
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(dir_, ec);
|
||||
}
|
||||
|
||||
std::filesystem::path dir_;
|
||||
std::filesystem::path store_path_;
|
||||
std::unique_ptr<lm::MissionStore> store_;
|
||||
|
||||
Reference in New Issue
Block a user