1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Remove indexed option constants.

These constants don't scale well as the index total is increased for an option.

The core code rarely uses these options and they are easily replaced with cfgOptionName().

The tests had started to make use of the constants, so provide functions that build the option name from the optionId and, optionally, the optionKey.
This commit is contained in:
David Steele 2020-10-19 14:03:48 -04:00
parent 86275c4f85
commit 7d069a2b91
30 changed files with 1080 additions and 1325 deletions

View File

@ -275,7 +275,7 @@ sub buildConfig
" //" . (qw{-} x 126) . "\n" .
" CONFIG_OPTION\n" .
" (\n" .
" CONFIG_OPTION_NAME(${strOptionConst})\n" .
" CONFIG_OPTION_NAME(\"${strOptionIndex}\")\n" .
" CONFIG_OPTION_INDEX(" . ($iOptionIndex - 1) . ")\n" .
" CONFIG_OPTION_DEFINE_ID(" . buildConfigDefineOptionEnum($strOption) . ")\n";
@ -296,11 +296,14 @@ sub buildConfig
" )\n";
$rhBuild->{&BLD_FILE}{&BLDLCL_FILE_CONFIG}{&BLD_CONSTANT_GROUP}{&BLDLCL_CONSTANT_OPTION}{&BLD_CONSTANT}
{$strOptionConst}{&BLD_CONSTANT_VALUE} = "\"${strOptionIndex}\"\n STRING_DECLARE(${strOptionConst}_STR);";
if (!$rhConfigDefine->{$strOption}{&CFGDEF_GROUP})
{
$rhBuild->{&BLD_FILE}{&BLDLCL_FILE_CONFIG}{&BLD_CONSTANT_GROUP}{&BLDLCL_CONSTANT_OPTION}{&BLD_CONSTANT}
{$strOptionConst}{&BLD_CONSTANT_VALUE} = "\"${strOptionIndex}\"\n STRING_DECLARE(${strOptionConst}_STR);";
$strBuildSourceConstant .=
"STRING_EXTERN(${strOptionConst}_STR," . (' ' x (49 - length($strOptionConst))) . "${strOptionConst});\n";
$strBuildSourceConstant .=
"STRING_EXTERN(${strOptionConst}_STR," . (' ' x (49 - length($strOptionConst))) . "${strOptionConst});\n";
}
$iOptionTotal += 1;
}

View File

@ -130,8 +130,11 @@ sub buildConfigParse
# Build option constant name if this is the current name for the option
if ($iOptionNameIdx == 0)
{
$strOptionConst = "CFGOPT_" . uc($strOptionNameOut);
$strOptionConst =~ s/\-/_/g;
if (!$rhConfigDefine->{$strOption}{&CFGDEF_GROUP})
{
$strOptionConst = "CFGOPT_" . uc($strOptionNameOut);
$strOptionConst =~ s/\-/_/g;
}
}
# Else use bare string and mark as deprecated
else
@ -145,7 +148,7 @@ sub buildConfigParse
# Add option
$strBuildSource .=
" {\n" .
" .name = " . (defined($strOptionConst) ? $strOptionConst : "\"${strOptionNameOut}\"") . ",\n" .
" .name = \"${strOptionNameOut}\",\n" .
$strOptionArg .
" .val = ${strOptionFlag} ${strOptionVal},\n" .
" },\n";
@ -156,8 +159,7 @@ sub buildConfigParse
{
$strBuildSource .=
" {\n" .
" .name = \"no-" .
(defined($strOptionConst) ? "\" ${strOptionConst}" : "${strOptionNameOut}\"") . ",\n" .
" .name = \"no-${strOptionNameOut}\",\n" .
" .val = ${strOptionFlag} PARSE_NEGATE_FLAG | ${strOptionVal},\n" .
" },\n";
}
@ -168,8 +170,7 @@ sub buildConfigParse
{
$strBuildSource .=
" {\n" .
" .name = \"reset-" .
(defined($strOptionConst) ? "\" ${strOptionConst}" : "${strOptionNameOut}\"") . ",\n" .
" .name = \"reset-${strOptionNameOut}\",\n" .
" .val = ${strOptionFlag} PARSE_RESET_FLAG | ${strOptionVal},\n" .
" },\n";
}

View File

@ -333,10 +333,10 @@ walPath(const String *walFile, const String *pgPath, const String *command)
{
THROW_FMT(
OptionRequiredError,
"option '" CFGOPT_PG1_PATH "' must be specified when relative wal paths are used\n"
"option '%s' must be specified when relative wal paths are used\n"
"HINT: is %%f passed to %s instead of %%p?\n"
"HINT: PostgreSQL may pass relative paths even with %%p depending on the environment.",
strZ(command));
cfgOptionName(cfgOptPgPath), strZ(command));
}
// Get the working directory
@ -359,9 +359,9 @@ walPath(const String *walFile, const String *pgPath, const String *command)
{
THROW_FMT(
OptionInvalidValueError,
PG_NAME " working directory '%s' is not the same as option " CFGOPT_PG1_PATH " '%s'\n"
"HINT: is the " PG_NAME " data_directory configured the same as the " CFGOPT_PG1_PATH " option?",
currentWorkDir, strZ(pgPath));
PG_NAME " working directory '%s' is not the same as option %s '%s'\n"
"HINT: is the " PG_NAME " data_directory configured the same as the %s option?",
currentWorkDir, cfgOptionName(cfgOptPgPath), strZ(pgPath), cfgOptionName(cfgOptPgPath));
}
}

View File

@ -284,7 +284,11 @@ cmdArchivePush(void)
// pg1-path is not optional for async mode
if (!cfgOptionTest(cfgOptPgPath))
THROW(OptionRequiredError, "'" CFGCMD_ARCHIVE_PUSH "' command in async mode requires option '" CFGOPT_PG1_PATH "'");
{
THROW_FMT(
OptionRequiredError, "'" CFGCMD_ARCHIVE_PUSH "' command in async mode requires option '%s'",
cfgOptionName(cfgOptPgPath));
}
// Loop and wait for the WAL segment to be pushed
Wait *wait = waitNew((TimeMSec)(cfgOptionDbl(cfgOptArchiveTimeout) * MSEC_PER_SEC));

File diff suppressed because it is too large Load Diff

View File

@ -146,198 +146,6 @@ Option constants
STRING_DECLARE(CFGOPT_ONLINE_STR);
#define CFGOPT_OUTPUT "output"
STRING_DECLARE(CFGOPT_OUTPUT_STR);
#define CFGOPT_PG1_HOST "pg1-host"
STRING_DECLARE(CFGOPT_PG1_HOST_STR);
#define CFGOPT_PG1_HOST_CMD "pg1-host-cmd"
STRING_DECLARE(CFGOPT_PG1_HOST_CMD_STR);
#define CFGOPT_PG1_HOST_CONFIG "pg1-host-config"
STRING_DECLARE(CFGOPT_PG1_HOST_CONFIG_STR);
#define CFGOPT_PG1_HOST_CONFIG_INCLUDE_PATH "pg1-host-config-include-path"
STRING_DECLARE(CFGOPT_PG1_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG1_HOST_CONFIG_PATH "pg1-host-config-path"
STRING_DECLARE(CFGOPT_PG1_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG1_HOST_PORT "pg1-host-port"
STRING_DECLARE(CFGOPT_PG1_HOST_PORT_STR);
#define CFGOPT_PG1_HOST_USER "pg1-host-user"
STRING_DECLARE(CFGOPT_PG1_HOST_USER_STR);
#define CFGOPT_PG1_LOCAL "pg1-local"
STRING_DECLARE(CFGOPT_PG1_LOCAL_STR);
#define CFGOPT_PG1_PATH "pg1-path"
STRING_DECLARE(CFGOPT_PG1_PATH_STR);
#define CFGOPT_PG1_PORT "pg1-port"
STRING_DECLARE(CFGOPT_PG1_PORT_STR);
#define CFGOPT_PG1_SOCKET_PATH "pg1-socket-path"
STRING_DECLARE(CFGOPT_PG1_SOCKET_PATH_STR);
#define CFGOPT_PG1_USER "pg1-user"
STRING_DECLARE(CFGOPT_PG1_USER_STR);
#define CFGOPT_PG2_HOST "pg2-host"
STRING_DECLARE(CFGOPT_PG2_HOST_STR);
#define CFGOPT_PG2_HOST_CMD "pg2-host-cmd"
STRING_DECLARE(CFGOPT_PG2_HOST_CMD_STR);
#define CFGOPT_PG2_HOST_CONFIG "pg2-host-config"
STRING_DECLARE(CFGOPT_PG2_HOST_CONFIG_STR);
#define CFGOPT_PG2_HOST_CONFIG_INCLUDE_PATH "pg2-host-config-include-path"
STRING_DECLARE(CFGOPT_PG2_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG2_HOST_CONFIG_PATH "pg2-host-config-path"
STRING_DECLARE(CFGOPT_PG2_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG2_HOST_PORT "pg2-host-port"
STRING_DECLARE(CFGOPT_PG2_HOST_PORT_STR);
#define CFGOPT_PG2_HOST_USER "pg2-host-user"
STRING_DECLARE(CFGOPT_PG2_HOST_USER_STR);
#define CFGOPT_PG2_LOCAL "pg2-local"
STRING_DECLARE(CFGOPT_PG2_LOCAL_STR);
#define CFGOPT_PG2_PATH "pg2-path"
STRING_DECLARE(CFGOPT_PG2_PATH_STR);
#define CFGOPT_PG2_PORT "pg2-port"
STRING_DECLARE(CFGOPT_PG2_PORT_STR);
#define CFGOPT_PG2_SOCKET_PATH "pg2-socket-path"
STRING_DECLARE(CFGOPT_PG2_SOCKET_PATH_STR);
#define CFGOPT_PG2_USER "pg2-user"
STRING_DECLARE(CFGOPT_PG2_USER_STR);
#define CFGOPT_PG3_HOST "pg3-host"
STRING_DECLARE(CFGOPT_PG3_HOST_STR);
#define CFGOPT_PG3_HOST_CMD "pg3-host-cmd"
STRING_DECLARE(CFGOPT_PG3_HOST_CMD_STR);
#define CFGOPT_PG3_HOST_CONFIG "pg3-host-config"
STRING_DECLARE(CFGOPT_PG3_HOST_CONFIG_STR);
#define CFGOPT_PG3_HOST_CONFIG_INCLUDE_PATH "pg3-host-config-include-path"
STRING_DECLARE(CFGOPT_PG3_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG3_HOST_CONFIG_PATH "pg3-host-config-path"
STRING_DECLARE(CFGOPT_PG3_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG3_HOST_PORT "pg3-host-port"
STRING_DECLARE(CFGOPT_PG3_HOST_PORT_STR);
#define CFGOPT_PG3_HOST_USER "pg3-host-user"
STRING_DECLARE(CFGOPT_PG3_HOST_USER_STR);
#define CFGOPT_PG3_LOCAL "pg3-local"
STRING_DECLARE(CFGOPT_PG3_LOCAL_STR);
#define CFGOPT_PG3_PATH "pg3-path"
STRING_DECLARE(CFGOPT_PG3_PATH_STR);
#define CFGOPT_PG3_PORT "pg3-port"
STRING_DECLARE(CFGOPT_PG3_PORT_STR);
#define CFGOPT_PG3_SOCKET_PATH "pg3-socket-path"
STRING_DECLARE(CFGOPT_PG3_SOCKET_PATH_STR);
#define CFGOPT_PG3_USER "pg3-user"
STRING_DECLARE(CFGOPT_PG3_USER_STR);
#define CFGOPT_PG4_HOST "pg4-host"
STRING_DECLARE(CFGOPT_PG4_HOST_STR);
#define CFGOPT_PG4_HOST_CMD "pg4-host-cmd"
STRING_DECLARE(CFGOPT_PG4_HOST_CMD_STR);
#define CFGOPT_PG4_HOST_CONFIG "pg4-host-config"
STRING_DECLARE(CFGOPT_PG4_HOST_CONFIG_STR);
#define CFGOPT_PG4_HOST_CONFIG_INCLUDE_PATH "pg4-host-config-include-path"
STRING_DECLARE(CFGOPT_PG4_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG4_HOST_CONFIG_PATH "pg4-host-config-path"
STRING_DECLARE(CFGOPT_PG4_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG4_HOST_PORT "pg4-host-port"
STRING_DECLARE(CFGOPT_PG4_HOST_PORT_STR);
#define CFGOPT_PG4_HOST_USER "pg4-host-user"
STRING_DECLARE(CFGOPT_PG4_HOST_USER_STR);
#define CFGOPT_PG4_LOCAL "pg4-local"
STRING_DECLARE(CFGOPT_PG4_LOCAL_STR);
#define CFGOPT_PG4_PATH "pg4-path"
STRING_DECLARE(CFGOPT_PG4_PATH_STR);
#define CFGOPT_PG4_PORT "pg4-port"
STRING_DECLARE(CFGOPT_PG4_PORT_STR);
#define CFGOPT_PG4_SOCKET_PATH "pg4-socket-path"
STRING_DECLARE(CFGOPT_PG4_SOCKET_PATH_STR);
#define CFGOPT_PG4_USER "pg4-user"
STRING_DECLARE(CFGOPT_PG4_USER_STR);
#define CFGOPT_PG5_HOST "pg5-host"
STRING_DECLARE(CFGOPT_PG5_HOST_STR);
#define CFGOPT_PG5_HOST_CMD "pg5-host-cmd"
STRING_DECLARE(CFGOPT_PG5_HOST_CMD_STR);
#define CFGOPT_PG5_HOST_CONFIG "pg5-host-config"
STRING_DECLARE(CFGOPT_PG5_HOST_CONFIG_STR);
#define CFGOPT_PG5_HOST_CONFIG_INCLUDE_PATH "pg5-host-config-include-path"
STRING_DECLARE(CFGOPT_PG5_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG5_HOST_CONFIG_PATH "pg5-host-config-path"
STRING_DECLARE(CFGOPT_PG5_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG5_HOST_PORT "pg5-host-port"
STRING_DECLARE(CFGOPT_PG5_HOST_PORT_STR);
#define CFGOPT_PG5_HOST_USER "pg5-host-user"
STRING_DECLARE(CFGOPT_PG5_HOST_USER_STR);
#define CFGOPT_PG5_LOCAL "pg5-local"
STRING_DECLARE(CFGOPT_PG5_LOCAL_STR);
#define CFGOPT_PG5_PATH "pg5-path"
STRING_DECLARE(CFGOPT_PG5_PATH_STR);
#define CFGOPT_PG5_PORT "pg5-port"
STRING_DECLARE(CFGOPT_PG5_PORT_STR);
#define CFGOPT_PG5_SOCKET_PATH "pg5-socket-path"
STRING_DECLARE(CFGOPT_PG5_SOCKET_PATH_STR);
#define CFGOPT_PG5_USER "pg5-user"
STRING_DECLARE(CFGOPT_PG5_USER_STR);
#define CFGOPT_PG6_HOST "pg6-host"
STRING_DECLARE(CFGOPT_PG6_HOST_STR);
#define CFGOPT_PG6_HOST_CMD "pg6-host-cmd"
STRING_DECLARE(CFGOPT_PG6_HOST_CMD_STR);
#define CFGOPT_PG6_HOST_CONFIG "pg6-host-config"
STRING_DECLARE(CFGOPT_PG6_HOST_CONFIG_STR);
#define CFGOPT_PG6_HOST_CONFIG_INCLUDE_PATH "pg6-host-config-include-path"
STRING_DECLARE(CFGOPT_PG6_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG6_HOST_CONFIG_PATH "pg6-host-config-path"
STRING_DECLARE(CFGOPT_PG6_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG6_HOST_PORT "pg6-host-port"
STRING_DECLARE(CFGOPT_PG6_HOST_PORT_STR);
#define CFGOPT_PG6_HOST_USER "pg6-host-user"
STRING_DECLARE(CFGOPT_PG6_HOST_USER_STR);
#define CFGOPT_PG6_LOCAL "pg6-local"
STRING_DECLARE(CFGOPT_PG6_LOCAL_STR);
#define CFGOPT_PG6_PATH "pg6-path"
STRING_DECLARE(CFGOPT_PG6_PATH_STR);
#define CFGOPT_PG6_PORT "pg6-port"
STRING_DECLARE(CFGOPT_PG6_PORT_STR);
#define CFGOPT_PG6_SOCKET_PATH "pg6-socket-path"
STRING_DECLARE(CFGOPT_PG6_SOCKET_PATH_STR);
#define CFGOPT_PG6_USER "pg6-user"
STRING_DECLARE(CFGOPT_PG6_USER_STR);
#define CFGOPT_PG7_HOST "pg7-host"
STRING_DECLARE(CFGOPT_PG7_HOST_STR);
#define CFGOPT_PG7_HOST_CMD "pg7-host-cmd"
STRING_DECLARE(CFGOPT_PG7_HOST_CMD_STR);
#define CFGOPT_PG7_HOST_CONFIG "pg7-host-config"
STRING_DECLARE(CFGOPT_PG7_HOST_CONFIG_STR);
#define CFGOPT_PG7_HOST_CONFIG_INCLUDE_PATH "pg7-host-config-include-path"
STRING_DECLARE(CFGOPT_PG7_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG7_HOST_CONFIG_PATH "pg7-host-config-path"
STRING_DECLARE(CFGOPT_PG7_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG7_HOST_PORT "pg7-host-port"
STRING_DECLARE(CFGOPT_PG7_HOST_PORT_STR);
#define CFGOPT_PG7_HOST_USER "pg7-host-user"
STRING_DECLARE(CFGOPT_PG7_HOST_USER_STR);
#define CFGOPT_PG7_LOCAL "pg7-local"
STRING_DECLARE(CFGOPT_PG7_LOCAL_STR);
#define CFGOPT_PG7_PATH "pg7-path"
STRING_DECLARE(CFGOPT_PG7_PATH_STR);
#define CFGOPT_PG7_PORT "pg7-port"
STRING_DECLARE(CFGOPT_PG7_PORT_STR);
#define CFGOPT_PG7_SOCKET_PATH "pg7-socket-path"
STRING_DECLARE(CFGOPT_PG7_SOCKET_PATH_STR);
#define CFGOPT_PG7_USER "pg7-user"
STRING_DECLARE(CFGOPT_PG7_USER_STR);
#define CFGOPT_PG8_HOST "pg8-host"
STRING_DECLARE(CFGOPT_PG8_HOST_STR);
#define CFGOPT_PG8_HOST_CMD "pg8-host-cmd"
STRING_DECLARE(CFGOPT_PG8_HOST_CMD_STR);
#define CFGOPT_PG8_HOST_CONFIG "pg8-host-config"
STRING_DECLARE(CFGOPT_PG8_HOST_CONFIG_STR);
#define CFGOPT_PG8_HOST_CONFIG_INCLUDE_PATH "pg8-host-config-include-path"
STRING_DECLARE(CFGOPT_PG8_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_PG8_HOST_CONFIG_PATH "pg8-host-config-path"
STRING_DECLARE(CFGOPT_PG8_HOST_CONFIG_PATH_STR);
#define CFGOPT_PG8_HOST_PORT "pg8-host-port"
STRING_DECLARE(CFGOPT_PG8_HOST_PORT_STR);
#define CFGOPT_PG8_HOST_USER "pg8-host-user"
STRING_DECLARE(CFGOPT_PG8_HOST_USER_STR);
#define CFGOPT_PG8_LOCAL "pg8-local"
STRING_DECLARE(CFGOPT_PG8_LOCAL_STR);
#define CFGOPT_PG8_PATH "pg8-path"
STRING_DECLARE(CFGOPT_PG8_PATH_STR);
#define CFGOPT_PG8_PORT "pg8-port"
STRING_DECLARE(CFGOPT_PG8_PORT_STR);
#define CFGOPT_PG8_SOCKET_PATH "pg8-socket-path"
STRING_DECLARE(CFGOPT_PG8_SOCKET_PATH_STR);
#define CFGOPT_PG8_USER "pg8-user"
STRING_DECLARE(CFGOPT_PG8_USER_STR);
#define CFGOPT_PROCESS "process"
STRING_DECLARE(CFGOPT_PROCESS_STR);
#define CFGOPT_PROCESS_MAX "process-max"
@ -352,90 +160,6 @@ Option constants
STRING_DECLARE(CFGOPT_RECURSE_STR);
#define CFGOPT_REMOTE_TYPE "remote-type"
STRING_DECLARE(CFGOPT_REMOTE_TYPE_STR);
#define CFGOPT_REPO1_AZURE_ACCOUNT "repo1-azure-account"
STRING_DECLARE(CFGOPT_REPO1_AZURE_ACCOUNT_STR);
#define CFGOPT_REPO1_AZURE_CA_FILE "repo1-azure-ca-file"
STRING_DECLARE(CFGOPT_REPO1_AZURE_CA_FILE_STR);
#define CFGOPT_REPO1_AZURE_CA_PATH "repo1-azure-ca-path"
STRING_DECLARE(CFGOPT_REPO1_AZURE_CA_PATH_STR);
#define CFGOPT_REPO1_AZURE_CONTAINER "repo1-azure-container"
STRING_DECLARE(CFGOPT_REPO1_AZURE_CONTAINER_STR);
#define CFGOPT_REPO1_AZURE_ENDPOINT "repo1-azure-endpoint"
STRING_DECLARE(CFGOPT_REPO1_AZURE_ENDPOINT_STR);
#define CFGOPT_REPO1_AZURE_HOST "repo1-azure-host"
STRING_DECLARE(CFGOPT_REPO1_AZURE_HOST_STR);
#define CFGOPT_REPO1_AZURE_KEY "repo1-azure-key"
STRING_DECLARE(CFGOPT_REPO1_AZURE_KEY_STR);
#define CFGOPT_REPO1_AZURE_KEY_TYPE "repo1-azure-key-type"
STRING_DECLARE(CFGOPT_REPO1_AZURE_KEY_TYPE_STR);
#define CFGOPT_REPO1_AZURE_PORT "repo1-azure-port"
STRING_DECLARE(CFGOPT_REPO1_AZURE_PORT_STR);
#define CFGOPT_REPO1_AZURE_VERIFY_TLS "repo1-azure-verify-tls"
STRING_DECLARE(CFGOPT_REPO1_AZURE_VERIFY_TLS_STR);
#define CFGOPT_REPO1_CIPHER_PASS "repo1-cipher-pass"
STRING_DECLARE(CFGOPT_REPO1_CIPHER_PASS_STR);
#define CFGOPT_REPO1_CIPHER_TYPE "repo1-cipher-type"
STRING_DECLARE(CFGOPT_REPO1_CIPHER_TYPE_STR);
#define CFGOPT_REPO1_HARDLINK "repo1-hardlink"
STRING_DECLARE(CFGOPT_REPO1_HARDLINK_STR);
#define CFGOPT_REPO1_HOST "repo1-host"
STRING_DECLARE(CFGOPT_REPO1_HOST_STR);
#define CFGOPT_REPO1_HOST_CMD "repo1-host-cmd"
STRING_DECLARE(CFGOPT_REPO1_HOST_CMD_STR);
#define CFGOPT_REPO1_HOST_CONFIG "repo1-host-config"
STRING_DECLARE(CFGOPT_REPO1_HOST_CONFIG_STR);
#define CFGOPT_REPO1_HOST_CONFIG_INCLUDE_PATH "repo1-host-config-include-path"
STRING_DECLARE(CFGOPT_REPO1_HOST_CONFIG_INCLUDE_PATH_STR);
#define CFGOPT_REPO1_HOST_CONFIG_PATH "repo1-host-config-path"
STRING_DECLARE(CFGOPT_REPO1_HOST_CONFIG_PATH_STR);
#define CFGOPT_REPO1_HOST_PORT "repo1-host-port"
STRING_DECLARE(CFGOPT_REPO1_HOST_PORT_STR);
#define CFGOPT_REPO1_HOST_USER "repo1-host-user"
STRING_DECLARE(CFGOPT_REPO1_HOST_USER_STR);
#define CFGOPT_REPO1_LOCAL "repo1-local"
STRING_DECLARE(CFGOPT_REPO1_LOCAL_STR);
#define CFGOPT_REPO1_PATH "repo1-path"
STRING_DECLARE(CFGOPT_REPO1_PATH_STR);
#define CFGOPT_REPO1_RETENTION_ARCHIVE "repo1-retention-archive"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_ARCHIVE_STR);
#define CFGOPT_REPO1_RETENTION_ARCHIVE_TYPE "repo1-retention-archive-type"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_ARCHIVE_TYPE_STR);
#define CFGOPT_REPO1_RETENTION_DIFF "repo1-retention-diff"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_DIFF_STR);
#define CFGOPT_REPO1_RETENTION_FULL "repo1-retention-full"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_FULL_STR);
#define CFGOPT_REPO1_RETENTION_FULL_TYPE "repo1-retention-full-type"
STRING_DECLARE(CFGOPT_REPO1_RETENTION_FULL_TYPE_STR);
#define CFGOPT_REPO1_S3_BUCKET "repo1-s3-bucket"
STRING_DECLARE(CFGOPT_REPO1_S3_BUCKET_STR);
#define CFGOPT_REPO1_S3_CA_FILE "repo1-s3-ca-file"
STRING_DECLARE(CFGOPT_REPO1_S3_CA_FILE_STR);
#define CFGOPT_REPO1_S3_CA_PATH "repo1-s3-ca-path"
STRING_DECLARE(CFGOPT_REPO1_S3_CA_PATH_STR);
#define CFGOPT_REPO1_S3_ENDPOINT "repo1-s3-endpoint"
STRING_DECLARE(CFGOPT_REPO1_S3_ENDPOINT_STR);
#define CFGOPT_REPO1_S3_HOST "repo1-s3-host"
STRING_DECLARE(CFGOPT_REPO1_S3_HOST_STR);
#define CFGOPT_REPO1_S3_KEY "repo1-s3-key"
STRING_DECLARE(CFGOPT_REPO1_S3_KEY_STR);
#define CFGOPT_REPO1_S3_KEY_SECRET "repo1-s3-key-secret"
STRING_DECLARE(CFGOPT_REPO1_S3_KEY_SECRET_STR);
#define CFGOPT_REPO1_S3_KEY_TYPE "repo1-s3-key-type"
STRING_DECLARE(CFGOPT_REPO1_S3_KEY_TYPE_STR);
#define CFGOPT_REPO1_S3_PORT "repo1-s3-port"
STRING_DECLARE(CFGOPT_REPO1_S3_PORT_STR);
#define CFGOPT_REPO1_S3_REGION "repo1-s3-region"
STRING_DECLARE(CFGOPT_REPO1_S3_REGION_STR);
#define CFGOPT_REPO1_S3_ROLE "repo1-s3-role"
STRING_DECLARE(CFGOPT_REPO1_S3_ROLE_STR);
#define CFGOPT_REPO1_S3_TOKEN "repo1-s3-token"
STRING_DECLARE(CFGOPT_REPO1_S3_TOKEN_STR);
#define CFGOPT_REPO1_S3_URI_STYLE "repo1-s3-uri-style"
STRING_DECLARE(CFGOPT_REPO1_S3_URI_STYLE_STR);
#define CFGOPT_REPO1_S3_VERIFY_TLS "repo1-s3-verify-tls"
STRING_DECLARE(CFGOPT_REPO1_S3_VERIFY_TLS_STR);
#define CFGOPT_REPO1_TYPE "repo1-type"
STRING_DECLARE(CFGOPT_REPO1_TYPE_STR);
#define CFGOPT_RESUME "resume"
STRING_DECLARE(CFGOPT_RESUME_STR);
#define CFGOPT_SCK_BLOCK "sck-block"

View File

@ -161,7 +161,7 @@ cfgLoadUpdateOption(void)
const String *archiveRetentionType = cfgOptionStr(cfgOptRepoRetentionArchiveType + optionIdx);
const String *msgArchiveOff = strNewFmt(
"WAL segments will not be expired: option '" CFGOPT_REPO1_RETENTION_ARCHIVE_TYPE "=%s' but",
"WAL segments will not be expired: option '%s=%s' but", cfgOptionName(cfgOptRepoRetentionArchiveType + optionIdx),
strZ(archiveRetentionType));
// If the archive retention is not explicitly set then determine what it should be defaulted to
@ -229,11 +229,11 @@ cfgLoadUpdateOption(void)
{
THROW_FMT(
OptionInvalidValueError,
"'%s' is not valid for option '" CFGOPT_REPO1_S3_BUCKET "'"
"'%s' is not valid for option '%s'"
"\nHINT: RFC-2818 forbids dots in wildcard matches."
"\nHINT: TLS/SSL verification cannot proceed with this bucket name."
"\nHINT: remove dots from the bucket name.",
strZ(cfgOptionStr(cfgOptRepoS3Bucket)));
strZ(cfgOptionStr(cfgOptRepoS3Bucket)), cfgOptionName(cfgOptRepoS3Bucket));
}
// Check/update compress-type if compress is valid. There should be no references to the compress option outside this block.

File diff suppressed because it is too large Load Diff

View File

@ -341,7 +341,8 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
// Set local so host settings configured on the remote will not accidentally be picked up
kvPut(
optionReplace,
protocolStorageType == protocolStorageTypeRepo ? VARSTR(CFGOPT_REPO1_LOCAL_STR) : VARSTR(CFGOPT_PG1_LOCAL_STR),
protocolStorageType == protocolStorageTypeRepo ?
VARSTRZ(cfgOptionName(cfgOptRepoLocal)) : VARSTRZ(cfgOptionName(cfgOptPgLocal)),
BOOL_TRUE_VAR);
// Update/remove repo/pg options that are sent to the remote
@ -523,8 +524,8 @@ protocolRemoteGet(ProtocolStorageType protocolStorageType, unsigned int hostId)
{
// Options to query
VariantList *param = varLstNew();
varLstAdd(param, varNewStr(CFGOPT_REPO1_CIPHER_TYPE_STR));
varLstAdd(param, varNewStr(CFGOPT_REPO1_CIPHER_PASS_STR));
varLstAdd(param, varNewStrZ(cfgOptionName(cfgOptRepoCipherType)));
varLstAdd(param, varNewStrZ(cfgOptionName(cfgOptRepoCipherPass)));
VariantList *optionList = configProtocolOption(protocolHelperClient->client, param);

View File

@ -1,6 +1,11 @@
/***********************************************************************************************************************************
Harness for Loading Test Configurations
***********************************************************************************************************************************/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "common/harnessConfig.h"
#include "common/harnessDebug.h"
#include "common/harnessLog.h"
#include "common/harnessTest.h"
@ -79,3 +84,115 @@ harnessCfgLoad(ConfigCommand commandId, const StringList *argListParam)
FUNCTION_HARNESS_RESULT_VOID();
}
/**********************************************************************************************************************************/
void
hrnCfgArgRaw(StringList *argList, ConfigOption optionId, const String *value)
{
hrnCfgArgKeyRawZ(argList, optionId, 1, strZ(value));
}
void
hrnCfgArgKeyRaw(StringList *argList, ConfigOption optionId, unsigned optionKey, const String *value)
{
hrnCfgArgKeyRawZ(argList, optionId, optionKey, strZ(value));
}
void
hrnCfgArgRawFmt(StringList *argList, ConfigOption optionId, const char *format, ...)
{
char buffer[256];
va_list argument;
va_start(argument, format);
(size_t)vsnprintf(buffer, sizeof(buffer) - 1, format, argument);
va_end(argument);
hrnCfgArgKeyRawZ(argList, optionId, 1, buffer);
}
void
hrnCfgArgKeyRawFmt(StringList *argList, ConfigOption optionId, unsigned optionKey, const char *format, ...)
{
char buffer[256];
va_list argument;
va_start(argument, format);
(size_t)vsnprintf(buffer, sizeof(buffer) - 1, format, argument);
va_end(argument);
hrnCfgArgKeyRawZ(argList, optionId, optionKey, buffer);
}
void
hrnCfgArgRawZ(StringList *argList, ConfigOption optionId, const char *value)
{
hrnCfgArgKeyRawZ(argList, optionId, 1, value);
}
void
hrnCfgArgKeyRawZ(StringList *argList, ConfigOption optionId, unsigned optionKey, const char *value)
{
strLstAdd(argList, strNewFmt("--%s=%s", cfgOptionName(optionId + optionKey - 1), value));
}
void
hrnCfgArgRawBool(StringList *argList, ConfigOption optionId, bool value)
{
hrnCfgArgKeyRawBool(argList, optionId, 1, value);
}
void
hrnCfgArgKeyRawBool(StringList *argList, ConfigOption optionId, unsigned optionKey, bool value)
{
strLstAdd(argList, strNewFmt("--%s%s", value ? "" : "no-", cfgOptionName(optionId + optionKey - 1)));
}
void
hrnCfgArgRawReset(StringList *argList, ConfigOption optionId)
{
hrnCfgArgKeyRawReset(argList, optionId, 1);
}
void
hrnCfgArgKeyRawReset(StringList *argList, ConfigOption optionId, unsigned optionKey)
{
strLstAdd(argList, strNewFmt("--reset-%s", cfgOptionName(optionId + optionKey - 1)));
}
/**********************************************************************************************************************************/
void
hrnCfgEnvRaw(ConfigOption optionId, const String *value)
{
hrnCfgEnvIdRawZ(optionId, 1, strZ(value));
}
void
hrnCfgEnvIdRaw(ConfigOption optionId, unsigned optionKey, const String *value)
{
hrnCfgEnvIdRawZ(optionId, optionKey, strZ(value));
}
void
hrnCfgEnvRawZ(ConfigOption optionId, const char *value)
{
hrnCfgEnvIdRawZ(optionId, 1, value);
}
void
hrnCfgEnvIdRawZ(ConfigOption optionId, unsigned optionKey, const char *value)
{
setenv(strZ(strNewFmt(HRN_PGBACKREST_ENV "%s", cfgOptionName(optionId + optionKey - 1))), value, true);
}
void
hrnCfgEnvRemoveRaw(ConfigOption optionId)
{
hrnCfgEnvIdRemoveRaw(optionId, 1);
}
void
hrnCfgEnvIdRemoveRaw(ConfigOption optionId, unsigned optionKey)
{
unsetenv(strZ(strNewFmt(HRN_PGBACKREST_ENV "%s", cfgOptionName(optionId + optionKey - 1))));
}

View File

@ -3,6 +3,11 @@ Harness for Loading Test Configurations
***********************************************************************************************************************************/
#include "config/config.h"
/***********************************************************************************************************************************
Prefix for environment variables
***********************************************************************************************************************************/
#define HRN_PGBACKREST_ENV "PGBACKREST_"
/***********************************************************************************************************************************
Load a test configuration without any side effects
@ -14,3 +19,41 @@ void harnessCfgLoadRaw(unsigned int argListSize, const char *argList[]);
// Automatically adds the exe, command (and role), lock-path, and log-path so executing the binary works locally or in a container.
void harnessCfgLoad(ConfigCommand commandId, const StringList *argList);
void harnessCfgLoadRole(ConfigCommand commandId, ConfigCommandRole commandRoleId, const StringList *argList);
/***********************************************************************************************************************************
Configuration helper functions
These functions set options in the argument list using the option IDs rather than string constants. Each function has a "Key"
variant that works with indexed options and allows the key to be specified, e.g. hrnCfgArgKeyRawZ(cfgOptPgpath, 3, "/pg") will add
--pg3-path=/pg to the argument list.
***********************************************************************************************************************************/
void hrnCfgArgRaw(StringList *argList, ConfigOption optionId, const String *value);
void hrnCfgArgKeyRaw(StringList *argList, ConfigOption optionId, unsigned optionKey, const String *value);
void hrnCfgArgRawFmt(StringList *argList, ConfigOption optionId, const char *format, ...)
__attribute__((format(printf, 3, 4)));
void hrnCfgArgKeyRawFmt(StringList *argList, ConfigOption optionId, unsigned optionKey, const char *format, ...)
__attribute__((format(printf, 4, 5)));
void hrnCfgArgRawZ(StringList *argList, ConfigOption optionId, const char *value);
void hrnCfgArgKeyRawZ(StringList *argList, ConfigOption optionId, unsigned optionKey, const char *value);
void hrnCfgArgRawBool(StringList *argList, ConfigOption optionId, bool value);
void hrnCfgArgKeyRawBool(StringList *argList, ConfigOption optionId, unsigned optionKey, bool value);
void hrnCfgArgRawReset(StringList *argList, ConfigOption optionId);
void hrnCfgArgKeyRawReset(StringList *argList, ConfigOption optionId, unsigned optionKey);
/***********************************************************************************************************************************
Environment helper functions
Add and remove environment options, which are required to pass secrets, e.g. repo1-cipher-pass.
***********************************************************************************************************************************/
void hrnCfgEnvRaw(ConfigOption optionId, const String *value);
void hrnCfgEnvIdRaw(ConfigOption optionId, unsigned optionKey, const String *value);
void hrnCfgEnvRawZ(ConfigOption optionId, const char *value);
void hrnCfgEnvIdRawZ(ConfigOption optionId, unsigned optionKey, const char *value);
void hrnCfgEnvRemoveRaw(ConfigOption optionId);
void hrnCfgEnvIdRemoveRaw(ConfigOption optionId, unsigned optionKey);

View File

@ -125,7 +125,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAdd(argList, strNewFmt("--spool-path=%s", testPath()));
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
@ -226,7 +226,7 @@ testRun(void)
// Load configuration to set repo-path and stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNewFmt("--repo-path=%s", testPath()));
strLstAddZ(argList, "archive-get");
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -249,7 +249,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--archive-async");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/unused");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused");
strLstAdd(argList, strNewFmt("--spool-path=%s/spool", testPath()));
harnessCfgLoad(cfgCmdArchiveGet, argList);
@ -334,9 +334,9 @@ testRun(void)
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
strLstAddZ(argList, "--" CFGOPT_REPO1_PATH "=/repo");
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/repo");
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
@ -502,9 +502,9 @@ testRun(void)
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
strLstAddZ(argList, "--" CFGOPT_REPO1_PATH "=/repo");
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/repo");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
strLstAddZ(argList, "000000010000000100000001");
strLstAddZ(argList, "pg_wal/000000010000000100000001");
@ -520,7 +520,7 @@ testRun(void)
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
strLstAdd(argList, strNewFmt("--log-level-file=debug"));
strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath()));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s/db", testPath()));
hrnCfgArgRawFmt(argList, cfgOptPgPath, "%s/db", testPath());
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "archive-get");
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));

View File

@ -177,8 +177,8 @@ testRun(void)
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleDefault, argList);
@ -299,7 +299,7 @@ testRun(void)
argListTemp = strLstNew();
strLstAddZ(argListTemp, "--" CFGOPT_STANZA "=test");
strLstAdd(argListTemp, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argListTemp, cfgOptRepoPath, "%s/repo", testPath());
strLstAdd(argListTemp, strNewFmt("%s/pg/pg_wal/000000010000000100000002", testPath()));
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
@ -442,8 +442,8 @@ testRun(void)
TEST_TITLE("command must be run on the pg host");
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=host");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);

View File

@ -929,9 +929,9 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
harnessCfgLoad(cfgCmdBackup, argList);
time_t timestamp = 1575401652;
@ -1009,9 +1009,9 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1029,9 +1029,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1054,9 +1054,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1081,9 +1081,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--" CFGOPT_START_FAST);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1105,9 +1105,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1129,9 +1129,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1161,9 +1161,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_CHECKSUM_PAGE);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1210,9 +1210,9 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
harnessCfgLoad(cfgCmdBackup, argList);
// Create pg_control
@ -1246,9 +1246,9 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/pg");
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_FULL);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1445,8 +1445,8 @@ testRun(void)
// Create stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdStanzaCreate, argList);
@ -1457,9 +1457,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1477,9 +1477,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_FORCE);
@ -1509,12 +1509,12 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_DIFF);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1530,9 +1530,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
@ -1558,9 +1558,9 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_DIFF);
@ -1620,8 +1620,8 @@ testRun(void)
// Create stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdStanzaCreate, argList);
@ -1630,9 +1630,9 @@ testRun(void)
// Load options
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_FULL);
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
@ -1727,12 +1727,12 @@ testRun(void)
// Load options
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_FULL);
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
harnessCfgLoad(cfgCmdBackup, argList);
@ -1915,13 +1915,13 @@ testRun(void)
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_DIFF);
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
harnessCfgLoad(cfgCmdBackup, argList);
// Load the previous manifest and null out the checksum-page option to be sure it gets set to false in this backup
@ -2084,8 +2084,8 @@ testRun(void)
// Upgrade stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
@ -2094,11 +2094,11 @@ testRun(void)
// Load options
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG2_PATH "=%s", strZ(pg2Path)));
strLstAddZ(argList, "--" CFGOPT_PG2_PORT "=5433");
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgKeyRaw(argList, cfgOptPgPath, 1, pg1Path);
hrnCfgArgKeyRaw(argList, cfgOptPgPath, 2, pg2Path);
hrnCfgArgKeyRawZ(argList, cfgOptPgPort, 2, "5433");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
strLstAddZ(argList, "--" CFGOPT_START_FAST);
@ -2232,8 +2232,8 @@ testRun(void)
// Upgrade stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
@ -2242,11 +2242,11 @@ testRun(void)
// Load options
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_FULL);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
strLstAddZ(argList, "--" CFGOPT_MANIFEST_SAVE_THRESHOLD "=1");
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
harnessCfgLoad(cfgCmdBackup, argList);
@ -2428,11 +2428,11 @@ testRun(void)
// Load options
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_INCR);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
harnessCfgLoad(cfgCmdBackup, argList);
// Run backup
@ -2462,12 +2462,12 @@ testRun(void)
// Load options
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pg1Path)));
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, "--" CFGOPT_TYPE "=" BACKUP_TYPE_INCR);
strLstAddZ(argList, "--" CFGOPT_DELTA);
strLstAddZ(argList, "--" CFGOPT_REPO1_HARDLINK);
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
harnessCfgLoad(cfgCmdBackup, argList);
// Update pg_control timestamp

View File

@ -317,8 +317,8 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, stanzaOpt);
strLstAdd(argList, pg1PathOpt);
strLstAddZ(argList, "--pg5-host=localhost");
strLstAddZ(argList, "--" CFGOPT_PG5_HOST_CMD "=pgbackrest-bogus");
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 5, "localhost");
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 5, "pgbackrest-bogus");
strLstAddZ(argList, "--pg5-path=/path/to/pg5");
strLstAdd(argList, strNewFmt("--pg5-host-user=%s", testUser()));
harnessCfgLoad(cfgCmdCheck, argList);

View File

@ -24,7 +24,7 @@ testRun(void)
// Load configuration so lock path is set
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
harnessCfgLoad(cfgCmdArchiveGet, argList);
TEST_RESULT_STR_Z(

View File

@ -32,7 +32,7 @@ testRun(void)
{
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--process=1");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
strLstAddZ(argList, "--host-id=1");

View File

@ -69,7 +69,7 @@ testRun(void)
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
strLstAddZ(argList, "--lock-path=/bogus");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_REMOTE);
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));

View File

@ -296,7 +296,7 @@ testRun(void)
TEST_TITLE("error when missing destination");
StringList *argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
harnessCfgLoad(cfgCmdRepoPut, argList);
TEST_ERROR(storagePutProcess(ioBufferReadNew(fileBuffer)), ParamRequiredError, "destination file required");
@ -313,8 +313,8 @@ testRun(void)
TEST_TITLE("put an encrypted file with custom key");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAdd(argList, fileEncCustomName);
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -325,8 +325,8 @@ testRun(void)
TEST_TITLE("put a raw file");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--raw");
strLstAdd(argList, fileRawName);
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -347,8 +347,8 @@ testRun(void)
TEST_TITLE("put encrypted archive.info");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -358,8 +358,8 @@ testRun(void)
TEST_TITLE("put encrypted archive.info.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -369,8 +369,8 @@ testRun(void)
TEST_TITLE("put encrypted backup.info");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -380,8 +380,8 @@ testRun(void)
TEST_TITLE("put encrypted backup.info.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -397,8 +397,8 @@ testRun(void)
bufUsedSet(archiveFileBuffer, bufSize(archiveFileBuffer));
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAdd(argList, strNew(STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -412,8 +412,8 @@ testRun(void)
TEST_TITLE("put encrypted backup.manifest");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -424,8 +424,8 @@ testRun(void)
TEST_TITLE("put encrypted backup.manifest.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -436,8 +436,8 @@ testRun(void)
TEST_TITLE("put encrypted backup.history manifest");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -448,8 +448,8 @@ testRun(void)
TEST_TITLE("put encrypted backup_label");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom2");
strLstAdd(argList, strNew(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
harnessCfgLoad(cfgCmdRepoPut, argList);
@ -460,7 +460,7 @@ testRun(void)
TEST_TITLE("error when missing source");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
harnessCfgLoad(cfgCmdRepoGet, argList);
TEST_ERROR(storageGetProcess(ioBufferWriteNew(bufNew(0))), ParamRequiredError, "source file required");
@ -479,7 +479,7 @@ testRun(void)
TEST_TITLE("get a file with / repo");
argList = strLstNew();
strLstAdd(argList, strNew("--" CFGOPT_REPO1_PATH "=/"));
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/");
strLstAdd(argList, strNewFmt("%s/repo/%s", testPath(), strZ(fileName)));
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -491,8 +491,8 @@ testRun(void)
TEST_TITLE("get an encrypted file with custom key");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
strLstAdd(argList, fileEncCustomName);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -505,8 +505,8 @@ testRun(void)
TEST_TITLE("get a raw file");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "--raw");
strLstAdd(argList, fileRawName);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -532,7 +532,7 @@ testRun(void)
TEST_TITLE("ignore missing file");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
strLstAddZ(argList, "--" CFGOPT_IGNORE_MISSING);
strLstAddZ(argList, BOGUS_STR);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -544,8 +544,8 @@ testRun(void)
TEST_TITLE("get file outside of the repo error");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, "/somewhere/" INFO_ARCHIVE_FILE);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -558,8 +558,8 @@ testRun(void)
TEST_TITLE("get file in repo root directory error");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAdd(argList, fileEncCustomName);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -572,9 +572,9 @@ testRun(void)
TEST_TITLE("get encrypted archive.info - stanza mismatch");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -586,8 +586,8 @@ testRun(void)
TEST_TITLE("get encrypted archive.info");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -599,9 +599,9 @@ testRun(void)
TEST_TITLE("get encrypted archive.info.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -613,8 +613,8 @@ testRun(void)
TEST_TITLE("get encrypted backup.info");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -626,8 +626,8 @@ testRun(void)
TEST_TITLE("get encrypted backup.info.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -642,8 +642,8 @@ testRun(void)
TEST_TITLE("get encrypted WAL archive file");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAdd(argList, strNewFmt(
"%s/repo/" STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",testPath()));
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -656,8 +656,8 @@ testRun(void)
TEST_TITLE("get encrypted backup.manifest");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -669,8 +669,8 @@ testRun(void)
TEST_TITLE("get encrypted backup.manifest.copy");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -682,8 +682,8 @@ testRun(void)
TEST_TITLE("get encrypted backup.history manifest");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
harnessCfgLoad(cfgCmdRepoGet, argList);
@ -695,8 +695,8 @@ testRun(void)
TEST_TITLE("get encrypted backup_label");
argList = strLstNew();
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
strLstAddZ(argList, "--" CFGOPT_REPO1_CIPHER_TYPE "=" CIPHER_TYPE_AES_256_CBC);
hrnCfgArgRawFmt(argList, cfgOptRepoPath, "%s/repo", testPath());
hrnCfgArgRawZ(argList, cfgOptRepoCipherType, CIPHER_TYPE_AES_256_CBC);
strLstAdd(argList, strNew(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
harnessCfgLoad(cfgCmdRepoGet, argList);

View File

@ -1945,8 +1945,8 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(repoPath)));
strLstAdd(argList, strNewFmt("--" CFGOPT_PG1_PATH "=%s", strZ(pgPath)));
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
hrnCfgArgRaw(argList, cfgOptPgPath, pgPath);
strLstAddZ(argList, "--" CFGOPT_TYPE "=" RECOVERY_TYPE_PRESERVE);
strLstAddZ(argList, "--" CFGOPT_SET "=20161219-212741F");
strLstAddZ(argList, "--" CFGOPT_FORCE);

View File

@ -237,7 +237,7 @@ testRun(void)
// Invalid bucket name with verification enabled fails
argList = strLstNew();
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew("--repo1-type=s3"));
strLstAdd(argList, strNew("--repo1-s3-bucket=bogus.bucket"));
strLstAdd(argList, strNew("--repo1-s3-region=region"));
@ -254,7 +254,7 @@ testRun(void)
// Invalid bucket name with verification disabled succeeds
argList = strLstNew();
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew("--repo1-type=s3"));
strLstAdd(argList, strNew("--repo1-s3-bucket=bogus.bucket"));
strLstAdd(argList, strNew("--repo1-s3-region=region"));
@ -268,7 +268,7 @@ testRun(void)
// Valid bucket name
argList = strLstNew();
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew("--repo1-type=s3"));
strLstAdd(argList, strNew("--repo1-s3-bucket=cool-bucket"));
strLstAdd(argList, strNew("--repo1-s3-region=region"));
@ -390,7 +390,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew("--log-level-console=off"));
strLstAdd(argList, strNew("--log-level-stderr=off"));
strLstAdd(argList, strNew("--log-level-file=off"));
@ -407,7 +407,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew("--no-neutral-umask"));
strLstAdd(argList, strNew("--log-level-console=off"));
strLstAdd(argList, strNew("--log-level-stderr=off"));
@ -489,7 +489,7 @@ testRun(void)
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
strLstAdd(argList, strNew("--process=1"));
strLstAdd(argList, strNew("--host-id=1"));
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
@ -520,7 +520,7 @@ testRun(void)
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
@ -558,7 +558,7 @@ testRun(void)
strLstAdd(argList, strNewFmt("--" CFGOPT_LOG_PATH "=%s", testPath()));
strLstAdd(argList, strNewFmt("--lock-path=%s/lock", testDataPath()));
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_ASYNC);
TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "open log file");

View File

@ -4,6 +4,8 @@ Test Configuration Parse
#include "protocol/helper.h"
#include "storage/storage.intern.h"
#include "common/harnessConfig.h"
#define TEST_BACKREST_EXE "pgbackrest"
#define TEST_COMMAND_ARCHIVE_GET "archive-get"
@ -780,7 +782,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNew("--host-id=1"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
strLstAdd(argList, strNew("--process=1"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
@ -795,7 +797,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew("pgbackrest"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
strLstAdd(argList, strNew("--process=1"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
@ -1133,7 +1135,7 @@ testRun(void)
argList = strLstNew();
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
strLstAdd(argList, strNew("--stanza=db"));
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNew(TEST_COMMAND_ARCHIVE_GET));
strLstAdd(argList, strNew("000000010000000200000003"));
strLstAdd(argList, strNew("/path/to/wal/RECOVERYWAL"));
@ -1185,7 +1187,7 @@ testRun(void)
strLstAdd(argList, strNew("--stanza=db"));
strLstAdd(argList, strNewFmt("--config=%s", strZ(configFile)));
strLstAdd(argList, strNew("--no-online"));
strLstAddZ(argList, "--" CFGOPT_PG2_LOCAL);
hrnCfgArgKeyRawBool(argList, cfgOptPgLocal, 2, true);
strLstAdd(argList, strNew("--reset-pg1-host"));
strLstAdd(argList, strNew("--reset-backup-standby"));
strLstAdd(argList, strNew(TEST_COMMAND_BACKUP));
@ -1202,34 +1204,36 @@ testRun(void)
storagePutP(
storageNewWriteP(storageLocalWrite(), configFile),
BUFSTRDEF(
"[global]\n"
"compress-level=3\n"
"spool-path=/path/to/spool\n"
"lock-path=/\n"
"\n"
"[global:backup]\n"
"repo1-hardlink=y\n"
"bogus=bogus\n"
"no-delta=y\n"
"reset-delta=y\n"
"archive-copy=y\n"
"start-fast=y\n"
"online=y\n"
"pg1-path=/not/path/to/db\n"
"backup-standby=y\n"
"buffer-size=65536\n"
"\n"
"[db:backup]\n"
"delta=n\n"
"recovery-option=a=b\n"
"\n"
"[db]\n"
"pg1-host=db\n"
"pg1-path=/path/to/db\n"
CFGOPT_PG2_HOST "=ignore\n"
CFGOPT_PG2_PATH "=/path/to/db2\n"
"recovery-option=c=d\n"));
BUFSTR(
strNewFmt(
"[global]\n"
"compress-level=3\n"
"spool-path=/path/to/spool\n"
"lock-path=/\n"
"\n"
"[global:backup]\n"
"repo1-hardlink=y\n"
"bogus=bogus\n"
"no-delta=y\n"
"reset-delta=y\n"
"archive-copy=y\n"
"start-fast=y\n"
"online=y\n"
"pg1-path=/not/path/to/db\n"
"backup-standby=y\n"
"buffer-size=65536\n"
"\n"
"[db:backup]\n"
"delta=n\n"
"recovery-option=a=b\n"
"\n"
"[db]\n"
"pg1-host=db\n"
"pg1-path=/path/to/db\n"
"%s=ignore\n"
"%s=/path/to/db2\n"
"recovery-option=c=d\n",
cfgOptionName(cfgOptPgHost + 1), cfgOptionName(cfgOptPgPath + 1))));
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList), false), TEST_COMMAND_BACKUP " command");
harnessLogResult(

View File

@ -31,7 +31,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--repo1-host=repo-host");
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -447,7 +447,7 @@ testRun(void)
// Load configuration to set repo-path and stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNewFmt("--repo-path=%s", testPath()));
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -129,7 +129,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "archive-get");
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -140,7 +140,7 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--repo1-host=remote-host");
strLstAddZ(argList, "archive-get");
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -168,7 +168,7 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_HOST "=test1");
hrnCfgArgRawZ(argList, cfgOptPgHost, "test1");
strLstAddZ(argList, "--pg1-path=/path/to");
strLstAddZ(argList, "restore");
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -182,13 +182,13 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/bogus");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/bogus");
strLstAddZ(argList, "--pg7-path=/path/to");
strLstAddZ(argList, "--pg7-host=test1");
strLstAddZ(argList, "--host-id=7");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
strLstAddZ(argList, "--process=0");
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -222,7 +222,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "archive-get");
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -257,7 +257,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--repo1-host=repo-host");
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
// Local config settings should never be passed to the remote
@ -279,8 +279,8 @@ testRun(void)
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--log-subprocess");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/unused"); // Will be passed to remote (required)
strLstAddZ(argList, "--" CFGOPT_PG1_PORT "=777"); // Not be passed to remote (required but has default)
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused"); // Will be passed to remote (required)
hrnCfgArgRawZ(argList, cfgOptPgPort, "777"); // Not be passed to remote (required but has default)
strLstAddZ(argList, "--repo1-host=repo-host");
strLstAddZ(argList, "--repo1-host-port=444");
strLstAddZ(argList, "--repo1-host-config=/path/pgbackrest.conf");
@ -302,7 +302,7 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--process=3");
strLstAddZ(argList, "--host-id=1");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
@ -346,7 +346,7 @@ testRun(void)
strLstAddZ(argList, "--pg2-path=/path/to/2");
strLstAddZ(argList, "--pg2-host=pg2-host");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -369,7 +369,7 @@ testRun(void)
strLstAddZ(argList, "--pg3-socket-path=/socket3");
strLstAddZ(argList, "--pg3-port=3333");
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
strLstAddZ(argList, "--" CFGOPT_REPO1_RETENTION_FULL "=1");
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
@ -970,7 +970,7 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--protocol-timeout=10");
strLstAdd(argList, strNewFmt("--config=%s/pgbackrest.conf", testPath()));
strLstAddZ(argList, "--repo1-host=localhost");
@ -1029,7 +1029,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--protocol-timeout=10");
strLstAddZ(argList, "--process-max=2");
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -182,11 +182,11 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_REPO1_TYPE "=" STORAGE_AZURE_TYPE);
strLstAddZ(argList, "--" CFGOPT_REPO1_PATH "=/repo");
strLstAddZ(argList, "--" CFGOPT_REPO1_AZURE_CONTAINER "=" TEST_CONTAINER);
setenv("PGBACKREST_" CFGOPT_REPO1_AZURE_ACCOUNT, TEST_ACCOUNT, true);
setenv("PGBACKREST_" CFGOPT_REPO1_AZURE_KEY, TEST_KEY_SHARED, true);
hrnCfgArgRawZ(argList, cfgOptRepoType, STORAGE_AZURE_TYPE);
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/repo");
hrnCfgArgRawZ(argList, cfgOptRepoAzureContainer, TEST_CONTAINER);
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
harnessCfgLoad(cfgCmdArchivePush, argList);
Storage *storage = NULL;
@ -288,14 +288,14 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
strLstAddZ(argList, "--" CFGOPT_REPO1_TYPE "=" STORAGE_AZURE_TYPE);
strLstAddZ(argList, "--" CFGOPT_REPO1_PATH "=/");
strLstAddZ(argList, "--" CFGOPT_REPO1_AZURE_CONTAINER "=" TEST_CONTAINER);
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_AZURE_HOST "=%s", strZ(hrnServerHost())));
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_AZURE_PORT "=%u", hrnServerPort(0)));
strLstAdd(argList, strNewFmt("--%s" CFGOPT_REPO1_AZURE_VERIFY_TLS, testContainer() ? "" : "no-"));
setenv("PGBACKREST_" CFGOPT_REPO1_AZURE_ACCOUNT, TEST_ACCOUNT, true);
setenv("PGBACKREST_" CFGOPT_REPO1_AZURE_KEY, TEST_KEY_SHARED, true);
hrnCfgArgRawZ(argList, cfgOptRepoType, STORAGE_AZURE_TYPE);
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/");
hrnCfgArgRawZ(argList, cfgOptRepoAzureContainer, TEST_CONTAINER);
hrnCfgArgRaw(argList, cfgOptRepoAzureHost, hrnServerHost());
hrnCfgArgRawFmt(argList, cfgOptRepoAzurePort, "%u", hrnServerPort(0));
hrnCfgArgRawBool(argList, cfgOptRepoAzureVerifyTls, testContainer());
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
harnessCfgLoad(cfgCmdArchivePush, argList);
Storage *storage = NULL;
@ -727,8 +727,8 @@ testRun(void)
hrnServerScriptClose(service);
strLstAddZ(argList, "--" CFGOPT_REPO1_AZURE_KEY_TYPE "=" STORAGE_AZURE_KEY_TYPE_SAS);
setenv("PGBACKREST_" CFGOPT_REPO1_AZURE_KEY, TEST_KEY_SAS, true);
hrnCfgArgRawZ(argList, cfgOptRepoAzureKeyType, STORAGE_AZURE_KEY_TYPE_SAS);
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SAS);
harnessCfgLoad(cfgCmdArchivePush, argList);
TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_AZURE_TYPE), true), "get repo storage");

View File

@ -17,7 +17,7 @@ testRun(void)
// Load configuration
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAddZ(argList, "--repo1-type=cifs");
strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath()));
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -1159,7 +1159,7 @@ testRun(void)
// Load configuration to set repo-path and stanza
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=db");
strLstAddZ(argList, "--" CFGOPT_PG1_PATH "=/path/to/pg");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
strLstAdd(argList, strNewFmt("--repo-path=%s", testPath()));
harnessCfgLoad(cfgCmdArchiveGet, argList);

View File

@ -229,18 +229,22 @@ testRun(void)
// Config settings that are required for every test (without endpoint for special tests)
StringList *commonArgWithoutEndpointList = strLstNew();
strLstAddZ(commonArgWithoutEndpointList, "--" CFGOPT_STANZA "=db");
strLstAddZ(commonArgWithoutEndpointList, "--" CFGOPT_REPO1_TYPE "=s3");
strLstAdd(commonArgWithoutEndpointList, strNewFmt("--" CFGOPT_REPO1_PATH "=%s", strZ(path)));
strLstAdd(commonArgWithoutEndpointList, strNewFmt("--" CFGOPT_REPO1_S3_BUCKET "=%s", strZ(bucket)));
strLstAdd(commonArgWithoutEndpointList, strNewFmt("--" CFGOPT_REPO1_S3_REGION "=%s", strZ(region)));
hrnCfgArgRawZ(commonArgWithoutEndpointList, cfgOptRepoType, "s3");
hrnCfgArgRaw(commonArgWithoutEndpointList, cfgOptRepoPath, path);
hrnCfgArgRaw(commonArgWithoutEndpointList, cfgOptRepoS3Bucket, bucket);
hrnCfgArgRaw(commonArgWithoutEndpointList, cfgOptRepoS3Region, region);
// TLS can only be verified in a container
if (!testContainer())
strLstAddZ(commonArgWithoutEndpointList, "--no-" CFGOPT_REPO1_S3_VERIFY_TLS);
hrnCfgArgRawBool(commonArgWithoutEndpointList, cfgOptRepoS3VerifyTls, false);
// Config settings that are required for every test (with endpoint)
StringList *commonArgList = strLstDup(commonArgWithoutEndpointList);
strLstAdd(commonArgList, strNewFmt("--" CFGOPT_REPO1_S3_ENDPOINT "=%s", strZ(endPoint)));
hrnCfgArgRaw(commonArgList, cfgOptRepoS3Endpoint, endPoint);
// Secure options must be loaded into environment variables
hrnCfgEnvRaw(cfgOptRepoS3Key, accessKey);
hrnCfgEnvRaw(cfgOptRepoS3KeySecret, secretAccessKey);
// *****************************************************************************************************************************
if (testBegin("storageS3DateTime() and storageS3Auth()"))
@ -251,8 +255,6 @@ testRun(void)
TEST_TITLE("config without token");
StringList *argList = strLstDup(commonArgList);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY, strZ(accessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY_SECRET, strZ(secretAccessKey), true);
harnessCfgLoad(cfgCmdArchivePush, argList);
StorageS3 *driver = (StorageS3 *)storageDriver(storageRepoGet(STORAGE_S3_TYPE_STR, false));
@ -320,12 +322,10 @@ testRun(void)
TEST_TITLE("config with token, endpoint with custom port, and ca-file/path");
argList = strLstDup(commonArgWithoutEndpointList);
strLstAddZ(argList, "--" CFGOPT_REPO1_S3_ENDPOINT "=custom.endpoint:333");
strLstAddZ(argList, "--" CFGOPT_REPO1_S3_CA_PATH "=/path/to/cert");
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_CA_FILE "=%s/" HRN_SERVER_CERT_PREFIX ".crt", testRepoPath()));
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY, strZ(accessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY_SECRET, strZ(secretAccessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_TOKEN, strZ(securityToken), true);
hrnCfgArgRawZ(argList, cfgOptRepoS3Endpoint, "custom.endpoint:333");
hrnCfgArgRawZ(argList, cfgOptRepoS3CaPath, "/path/to/cert");
hrnCfgArgRawFmt(argList, cfgOptRepoS3CaFile, "%s/" HRN_SERVER_CERT_PREFIX ".crt", testRepoPath());
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
harnessCfgLoad(cfgCmdArchivePush, argList);
driver = (StorageS3 *)storageDriver(storageRepoGet(STORAGE_S3_TYPE_STR, false));
@ -388,10 +388,8 @@ testRun(void)
TEST_TITLE("config with keys, token, and host with custom port");
StringList *argList = strLstDup(commonArgList);
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_HOST "=%s:%u", strZ(host), port));
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY, strZ(accessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY_SECRET, strZ(secretAccessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_TOKEN, strZ(securityToken), true);
hrnCfgArgRawFmt(argList, cfgOptRepoS3Host, "%s:%u", strZ(host), port);
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
harnessCfgLoad(cfgCmdArchivePush, argList);
Storage *s3 = storageRepoGet(STORAGE_S3_TYPE_STR, true);
@ -447,9 +445,9 @@ testRun(void)
hrnServerScriptClose(service);
argList = strLstDup(commonArgList);
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_HOST "=%s:%u", strZ(host), port));
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_ROLE "=%s", strZ(credRole)));
strLstAddZ(argList, "--" CFGOPT_REPO1_S3_KEY_TYPE "=" STORAGE_S3_KEY_TYPE_AUTO);
hrnCfgArgRawFmt(argList, cfgOptRepoS3Host, "%s:%u", strZ(host), port);
hrnCfgArgRaw(argList, cfgOptRepoS3Role, credRole);
hrnCfgArgRawZ(argList, cfgOptRepoS3KeyType, STORAGE_S3_KEY_TYPE_AUTO);
harnessCfgLoad(cfgCmdArchivePush, argList);
s3 = storageRepoGet(STORAGE_S3_TYPE_STR, true);
@ -1015,12 +1013,10 @@ testRun(void)
hrnServerScriptClose(service);
argList = strLstDup(commonArgList);
strLstAddZ(argList, "--" CFGOPT_REPO1_S3_URI_STYLE "=" STORAGE_S3_URI_STYLE_PATH);
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_HOST "=%s", strZ(host)));
strLstAdd(argList, strNewFmt("--" CFGOPT_REPO1_S3_PORT "=%u", port));
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY, strZ(accessKey), true);
setenv("PGBACKREST_" CFGOPT_REPO1_S3_KEY_SECRET, strZ(secretAccessKey), true);
unsetenv("PGBACKREST_" CFGOPT_REPO1_S3_TOKEN);
hrnCfgArgRawZ(argList, cfgOptRepoS3UriStyle, STORAGE_S3_URI_STYLE_PATH);
hrnCfgArgRaw(argList, cfgOptRepoS3Host, host);
hrnCfgArgRawFmt(argList, cfgOptRepoS3Port, "%u", port);
hrnCfgEnvRemoveRaw(cfgOptRepoS3Token);
harnessCfgLoad(cfgCmdArchivePush, argList);
s3 = storageRepoGet(STORAGE_S3_TYPE_STR, true);