refactor tests
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
2023-11-18 15:34:43 -06:00
parent 7a24cc54f8
commit 4348e89f99
5 changed files with 222 additions and 215 deletions

View File

@@ -36,12 +36,9 @@ app_config::app_config(const provider_type &prov,
api_port_(default_rpc_port(prov)),
api_user_("repertory"),
config_changed_(false),
data_directory_(
data_directory.empty() ? default_data_directory(prov)
: ((prov == provider_type::remote) || (prov == provider_type::s3))
? utils::path::absolute(data_directory)
: utils::path::absolute(utils::path::combine(
data_directory, {get_provider_name(prov)}))),
data_directory_(data_directory.empty()
? default_data_directory(prov)
: utils::path::absolute(data_directory)),
download_timeout_secs_(30),
enable_chunk_downloader_timeout_(true),
enable_comm_duration_events_(false),
@@ -639,9 +636,9 @@ auto app_config::load() -> bool {
}
void app_config::save() {
const auto configFilePath = get_config_file_path();
const auto file_path = get_config_file_path();
recur_mutex_lock lock(read_write_mutex_);
if (config_changed_ || not utils::file::is_file(configFilePath)) {
if (config_changed_ || not utils::file::is_file(file_path)) {
if (not utils::file::is_directory(data_directory_)) {
if (not utils::file::create_full_directory_path(data_directory_)) {
utils::error::raise_error(
@@ -654,7 +651,7 @@ void app_config::save() {
json data = get_json();
auto success = false;
for (auto i = 0; not success && (i < 5); i++) {
if (not(success = utils::file::write_json_file(configFilePath, data))) {
if (not(success = utils::file::write_json_file(file_path, data))) {
std::this_thread::sleep_for(1s);
}
}

View File

@@ -121,10 +121,11 @@ auto main(int argc, char **argv) -> int {
std::cerr << "Name of S3 instance not provided" << std::endl;
res = exit_code::invalid_syntax;
} else {
data_directory = utils::path::combine(
data_directory.empty() ? app_config::default_data_directory(prov)
: data_directory,
{unique_id});
data_directory = utils::path::absolute(
data_directory.empty()
? utils::path::combine(app_config::default_data_directory(prov),
{unique_id})
: data_directory);
}
}
}

View File

@@ -135,6 +135,9 @@ auto parse_drive_options(int argc, char **argv,
} else if ((std::string(argv[i]) == options::remote_mount_option[0]) ||
(std::string(argv[i]) == options::remote_mount_option[1])) {
i++;
} else if ((std::string(argv[i]) == options::data_directory_option[0]) ||
(std::string(argv[i]) == options::data_directory_option[1])) {
i++;
}
#ifdef REPERTORY_ENABLE_S3
else if ((std::string(argv[i]) == options::name_option[0]) ||