refactor test
Some checks failed
BlockStorage/repertory_mac/pipeline/head Build queued...
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2025-08-06 15:20:37 -05:00
parent 6bc11ec727
commit 8a68d025b5
2 changed files with 37 additions and 27 deletions

View File

@@ -101,8 +101,10 @@ protected:
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
fmt::format("fuse_test_{}", as_remote), "fuse_test",
app_config::get_provider_name(current_provider), fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
}); });
mount_location = utils::path::combine(test_directory, {"mount"}); mount_location = utils::path::combine(test_directory, {"mount"});
@@ -146,8 +148,10 @@ protected:
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
fmt::format("fuse_test_{}", as_remote), "fuse_test",
app_config::get_provider_name(current_provider), fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
}); });
mount_location = utils::path::combine(test_directory, {"mount"}); mount_location = utils::path::combine(test_directory, {"mount"});
@@ -186,16 +190,17 @@ protected:
execute_mount(drive_args, mount_location); execute_mount(drive_args, mount_location);
}; };
const auto mount_remote = [&](std::uint16_t remote_port) { const auto mount_remote = [&]() {
{ {
mount_location2 = mount_location; mount_location2 = mount_location;
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
"fuse_test", "fuse_test",
app_config::get_provider_name(provider_t::type) + '_' + fmt::format("{}_{}_{}",
app_config::get_provider_name(provider_t::type2) + '_' + app_config::get_provider_name(provider_t::type),
std::to_string(remote_port), app_config::get_provider_name(provider_t::type2),
provider_t::remote_port),
}); });
mount_location = utils::path::combine(test_directory, {"mount"}); mount_location = utils::path::combine(test_directory, {"mount"});
@@ -214,7 +219,7 @@ protected:
"-dd", "-dd",
config2->get_data_directory(), config2->get_data_directory(),
"-rm", "-rm",
fmt::format("localhost:{}", remote_port), fmt::format("localhost:{}", provider_t::remote_port),
}); });
} }
@@ -241,7 +246,7 @@ protected:
} break; } break;
case provider_type::unknown: case provider_type::unknown:
mount_remote(provider_t::remote_port); mount_remote();
return; return;
default: default:
@@ -249,7 +254,7 @@ protected:
return; return;
} }
mount_remote(provider_t::remote_port); mount_remote();
} break; } break;
default: default:

View File

@@ -45,31 +45,31 @@ namespace repertory {
struct local_s3 final { struct local_s3 final {
static constexpr provider_type type{provider_type::s3}; static constexpr provider_type type{provider_type::s3};
static constexpr provider_type type2{provider_type::s3}; static constexpr provider_type type2{provider_type::s3};
static constexpr std::uint16_t port{0U}; static constexpr std::uint16_t remote_port{41000U};
}; };
struct local_sia final { struct local_sia final {
static constexpr provider_type type{provider_type::sia}; static constexpr provider_type type{provider_type::sia};
static constexpr provider_type type2{provider_type::sia}; static constexpr provider_type type2{provider_type::sia};
static constexpr std::uint16_t port{0U}; static constexpr std::uint16_t remote_port{41001U};
}; };
struct remote_s3 final { struct remote_s3 final {
static constexpr provider_type type{provider_type::remote}; static constexpr provider_type type{provider_type::remote};
static constexpr provider_type type2{provider_type::s3}; static constexpr provider_type type2{provider_type::s3};
static constexpr std::uint16_t port{0U}; static constexpr std::uint16_t remote_port{41000U};
}; };
struct remote_sia final { struct remote_sia final {
static constexpr provider_type type{provider_type::remote}; static constexpr provider_type type{provider_type::remote};
static constexpr provider_type type2{provider_type::sia}; static constexpr provider_type type2{provider_type::sia};
static constexpr std::uint16_t port{0U}; static constexpr std::uint16_t remote_port{41001U};
}; };
struct remote_winfsp_to_linux final { struct remote_winfsp_to_linux final {
static constexpr provider_type type{provider_type::remote}; static constexpr provider_type type{provider_type::remote};
static constexpr provider_type type2{provider_type::unknown}; static constexpr provider_type type2{provider_type::unknown};
static constexpr std::uint16_t port{40001U}; static constexpr std::uint16_t remote_port{41002U};
}; };
template <typename provider_t> class winfsp_test : public ::testing::Test { template <typename provider_t> class winfsp_test : public ::testing::Test {
@@ -92,8 +92,10 @@ protected:
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
fmt::format("winfsp_test_{}", as_remote), "winfsp_test",
app_config::get_provider_name(provider_type::s3), fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
}); });
auto cfg_directory = utils::path::combine(test_directory, {"cfg"}); auto cfg_directory = utils::path::combine(test_directory, {"cfg"});
@@ -112,7 +114,7 @@ protected:
auto r_cfg = config->get_remote_mount(); auto r_cfg = config->get_remote_mount();
r_cfg.enable = true; r_cfg.enable = true;
r_cfg.api_port = 40000U; r_cfg.api_port = provider_t::remote_port;
config->set_remote_mount(r_cfg); config->set_remote_mount(r_cfg);
} }
@@ -133,8 +135,10 @@ protected:
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
fmt::format("winfsp_test_{}", as_remote), "winfsp_test",
app_config::get_provider_name(provider_type::sia), fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
}); });
auto cfg_directory = utils::path::combine(test_directory, {"cfg"}); auto cfg_directory = utils::path::combine(test_directory, {"cfg"});
@@ -170,15 +174,16 @@ protected:
execute_mount(drive_args, mount_location); execute_mount(drive_args, mount_location);
}; };
const auto mount_remote = [&](std::uint16_t port = 40000U) { const auto mount_remote = [&]() {
{ {
auto test_directory = utils::path::combine( auto test_directory = utils::path::combine(
test::get_test_output_dir(), test::get_test_output_dir(),
{ {
"winfsp_test", "winfsp_test",
app_config::get_provider_name(provider_t::type) + '_' + fmt::format("{}_{}_{}",
app_config::get_provider_name(provider_t::type2) + '_' + app_config::get_provider_name(provider_t::type),
std::to_string(port), app_config::get_provider_name(provider_t::type2),
provider_t::remote_port),
}); });
mount_location2 = mount_location; mount_location2 = mount_location;
@@ -196,7 +201,7 @@ protected:
"-dd", "-dd",
config->get_data_directory(), config->get_data_directory(),
"-rm", "-rm",
fmt::format("localhost:{}", port), fmt::format("localhost:{}", remote_port),
mount_location, mount_location,
}); });
} }
@@ -224,7 +229,7 @@ protected:
} break; } break;
case provider_type::unknown: case provider_type::unknown:
mount_remote(provider_t::port); mount_remote();
return; return;
default: default: