Refactored app_config unit tests

This commit is contained in:
Scott E. Graves 2025-02-15 09:33:55 -06:00
parent 68e71d0b82
commit 85c769009a

View File

@ -382,6 +382,8 @@ static void common_tests(app_config &config, provider_type prov) {
remote_cfg1.recv_timeout_ms = 2U; remote_cfg1.recv_timeout_ms = 2U;
remote_cfg1.send_timeout_ms = 1U; remote_cfg1.send_timeout_ms = 1U;
ASSERT_NE(remote_cfg1, remote_cfg2);
test_getter_setter(cfg, &app_config::get_remote_config, test_getter_setter(cfg, &app_config::get_remote_config,
&app_config::set_remote_config, remote_cfg1, &app_config::set_remote_config, remote_cfg1,
remote_cfg2, "", ""); remote_cfg2, "", "");
@ -429,7 +431,7 @@ static void common_tests(app_config &config, provider_type prov) {
value.c_str()); value.c_str());
}}, }},
{JSON_REMOTE_MOUNT, {JSON_REMOTE_MOUNT,
[](auto &&cfg) { [](app_config &cfg) {
remote::remote_mount mnt_cfg1{}; remote::remote_mount mnt_cfg1{};
mnt_cfg1.api_port = 1U; mnt_cfg1.api_port = 1U;
mnt_cfg1.client_pool_size = 2U; mnt_cfg1.client_pool_size = 2U;
@ -442,8 +444,10 @@ static void common_tests(app_config &config, provider_type prov) {
mnt_cfg2.enable = true; mnt_cfg2.enable = true;
mnt_cfg2.encryption_token = "5"; mnt_cfg2.encryption_token = "5";
ASSERT_NE(mnt_cfg1, mnt_cfg2);
test_getter_setter(cfg, &app_config::get_remote_mount, test_getter_setter(cfg, &app_config::get_remote_mount,
&app_config::get_remote_mount, mnt_cfg1, mnt_cfg2, &app_config::set_remote_mount, mnt_cfg1, mnt_cfg2,
"", ""); "", "");
remote::remote_mount mnt_cfg3{}; remote::remote_mount mnt_cfg3{};
@ -492,7 +496,7 @@ static void common_tests(app_config &config, provider_type prov) {
EXPECT_EQ(max_ring_buffer_file_size, cfg.get_ring_buffer_file_size()); EXPECT_EQ(max_ring_buffer_file_size, cfg.get_ring_buffer_file_size());
}}, }},
{JSON_S3_CONFIG, [](auto &&cfg) {}}, {JSON_S3_CONFIG, [](auto &&cfg) {}},
{JSON_SIA_CONFIG, [](auto &&cfg) {}}, {JSON_SIA_CONFIG, [](app_config &cfg) {}},
{JSON_TASK_WAIT_MS, {JSON_TASK_WAIT_MS,
[](app_config &cfg) { [](app_config &cfg) {
test_getter_setter( test_getter_setter(