isolate test directory

This commit is contained in:
Scott E. Graves 2024-07-16 08:13:13 -05:00
parent 5312797b97
commit 2c0935a771
3 changed files with 9 additions and 10 deletions

View File

@ -626,7 +626,8 @@ static void run_tests(const app_config &cfg, i_provider &provider) {
} }
TEST(providers, encrypt_provider) { TEST(providers, encrypt_provider) {
const auto config_path = utils::path::absolute("./providers_test_encrypt"); const auto config_path =
utils::path::combine(get_test_dir(), {"encrypt_provider"});
ASSERT_TRUE(utils::file::delete_directory_recursively(config_path)); ASSERT_TRUE(utils::file::delete_directory_recursively(config_path));
console_consumer consumer{}; console_consumer consumer{};
@ -634,11 +635,7 @@ TEST(providers, encrypt_provider) {
{ {
app_config cfg(provider_type::encrypt, config_path); app_config cfg(provider_type::encrypt, config_path);
const auto encrypt_path = utils::path::combine( const auto encrypt_path = utils::path::combine(get_test_dir(), {"encrypt"});
std::filesystem::path(utils::path::absolute(__FILE__))
.parent_path()
.string(),
{"encrypt"});
EXPECT_STREQ( EXPECT_STREQ(
encrypt_path.c_str(), encrypt_path.c_str(),
@ -672,7 +669,8 @@ TEST(providers, encrypt_provider) {
#if defined(REPERTORY_ENABLE_S3) && defined(REPERTORY_ENABLE_S3_TESTING) #if defined(REPERTORY_ENABLE_S3) && defined(REPERTORY_ENABLE_S3_TESTING)
TEST(providers, s3_provider) { TEST(providers, s3_provider) {
const auto config_path = utils::path::absolute("./providers_test_s3"); const auto config_path =
utils::path::combine(get_test_dir(), {"s3_provider"});
ASSERT_TRUE(utils::file::delete_directory_recursively(config_path)); ASSERT_TRUE(utils::file::delete_directory_recursively(config_path));
console_consumer consumer{}; console_consumer consumer{};
@ -710,7 +708,8 @@ TEST(providers, s3_provider) {
#endif #endif
TEST(providers, sia_provider) { TEST(providers, sia_provider) {
const auto config_path = utils::path::absolute("./providers_test_sia"); const auto config_path =
utils::path::combine(get_test_dir(), {"sia_provider"});
ASSERT_TRUE(utils::file::delete_directory_recursively(config_path)); ASSERT_TRUE(utils::file::delete_directory_recursively(config_path));
console_consumer consumer{}; console_consumer consumer{};

View File

@ -940,7 +940,7 @@ TEST(remote_fuse, all_tests) {
event_system::instance().start(); event_system::instance().start();
#if defined(_WIN32) #if defined(_WIN32)
mount_location_ = std::string(__FILE__).substr(0, 2); mount_location_ = std::string(get_test_dir()).substr(0, 2);
mock_winfsp_drive drive(mount_location_); mock_winfsp_drive drive(mount_location_);
remote_server server(config, drive, mount_location_); remote_server server(config, drive, mount_location_);
#else #else

View File

@ -494,7 +494,7 @@ TEST(remote_winfsp, all_tests) {
event_system::instance().start(); event_system::instance().start();
#if defined(_WIN32) #if defined(_WIN32)
mount_location_ = std::string(__FILE__).substr(0, 2); mount_location_ = std::string(get_test_dir()).substr(0, 2);
mock_winfsp_drive drive(mount_location_); mock_winfsp_drive drive(mount_location_);
remote_server server(config, drive, mount_location_); remote_server server(config, drive, mount_location_);
#else #else