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

View File

@@ -45,31 +45,31 @@ namespace repertory {
struct local_s3 final {
static constexpr provider_type type{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 {
static constexpr provider_type type{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 {
static constexpr provider_type type{provider_type::remote};
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 {
static constexpr provider_type type{provider_type::remote};
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 {
static constexpr provider_type type{provider_type::remote};
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 {
@@ -92,8 +92,10 @@ protected:
auto test_directory = utils::path::combine(
test::get_test_output_dir(),
{
fmt::format("winfsp_test_{}", as_remote),
app_config::get_provider_name(provider_type::s3),
"winfsp_test",
fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
});
auto cfg_directory = utils::path::combine(test_directory, {"cfg"});
@@ -112,7 +114,7 @@ protected:
auto r_cfg = config->get_remote_mount();
r_cfg.enable = true;
r_cfg.api_port = 40000U;
r_cfg.api_port = provider_t::remote_port;
config->set_remote_mount(r_cfg);
}
@@ -133,8 +135,10 @@ protected:
auto test_directory = utils::path::combine(
test::get_test_output_dir(),
{
fmt::format("winfsp_test_{}", as_remote),
app_config::get_provider_name(provider_type::sia),
"winfsp_test",
fmt::format("{}_{}",
app_config::get_provider_name(current_provider),
as_remote),
});
auto cfg_directory = utils::path::combine(test_directory, {"cfg"});
@@ -170,15 +174,16 @@ protected:
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(
test::get_test_output_dir(),
{
"winfsp_test",
app_config::get_provider_name(provider_t::type) + '_' +
app_config::get_provider_name(provider_t::type2) + '_' +
std::to_string(port),
fmt::format("{}_{}_{}",
app_config::get_provider_name(provider_t::type),
app_config::get_provider_name(provider_t::type2),
provider_t::remote_port),
});
mount_location2 = mount_location;
@@ -196,7 +201,7 @@ protected:
"-dd",
config->get_data_directory(),
"-rm",
fmt::format("localhost:{}", port),
fmt::format("localhost:{}", remote_port),
mount_location,
});
}
@@ -224,7 +229,7 @@ protected:
} break;
case provider_type::unknown:
mount_remote(provider_t::port);
mount_remote();
return;
default: