mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Add internal remote-type option.
This option was overloaded on the general type option but it makes sense to split this out since the meaning is pretty different. Rename the values to conform to current standards, i.e. pg and repo, now that the Perl code won't care anymore.
This commit is contained in:
parent
7a1871c341
commit
7de5ce23ad
@ -157,6 +157,8 @@ use constant CFGOPT_PROCESS => 'process'
|
||||
push @EXPORT, qw(CFGOPT_PROCESS);
|
||||
use constant CFGOPT_HOST_ID => 'host-id';
|
||||
push @EXPORT, qw(CFGOPT_HOST_ID);
|
||||
use constant CFGOPT_REMOTE_TYPE => 'remote-type';
|
||||
push @EXPORT, qw(CFGOPT_REMOTE_TYPE);
|
||||
|
||||
# Command-line only storage options
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -367,16 +369,12 @@ use constant CFGOPT_PG_USER => CFGDEF_PR
|
||||
# Option values - for options that have a specific list of allowed values
|
||||
####################################################################################################################################
|
||||
|
||||
# Local/remote types
|
||||
# Storage types
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
use constant CFGOPTVAL_LOCAL_TYPE_DB => 'db';
|
||||
push @EXPORT, qw(CFGOPTVAL_LOCAL_TYPE_DB);
|
||||
use constant CFGOPTVAL_LOCAL_TYPE_BACKUP => 'backup';
|
||||
push @EXPORT, qw(CFGOPTVAL_LOCAL_TYPE_BACKUP);
|
||||
use constant CFGOPTVAL_REMOTE_TYPE_DB => CFGOPTVAL_LOCAL_TYPE_DB;
|
||||
push @EXPORT, qw(CFGOPTVAL_REMOTE_TYPE_DB);
|
||||
use constant CFGOPTVAL_REMOTE_TYPE_BACKUP => CFGOPTVAL_LOCAL_TYPE_BACKUP;
|
||||
push @EXPORT, qw(CFGOPTVAL_REMOTE_TYPE_BACKUP);
|
||||
use constant CFGOPTVAL_STORAGE_TYPE_PG => 'pg';
|
||||
push @EXPORT, qw(CFGOPTVAL_STORAGE_TYPE_DB);
|
||||
use constant CFGOPTVAL_STORAGE_TYPE_REPO => 'repo';
|
||||
push @EXPORT, qw(CFGOPTVAL_STORAGE_TYPE_BACKUP);
|
||||
|
||||
# Backup type
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -973,24 +971,6 @@ my %hConfigDefine =
|
||||
]
|
||||
},
|
||||
|
||||
&CFGCMD_LOCAL =>
|
||||
{
|
||||
&CFGDEF_ALLOW_LIST =>
|
||||
[
|
||||
&CFGOPTVAL_LOCAL_TYPE_DB,
|
||||
&CFGOPTVAL_LOCAL_TYPE_BACKUP,
|
||||
],
|
||||
},
|
||||
|
||||
&CFGCMD_REMOTE =>
|
||||
{
|
||||
&CFGDEF_ALLOW_LIST =>
|
||||
[
|
||||
&CFGOPTVAL_REMOTE_TYPE_DB,
|
||||
&CFGOPTVAL_REMOTE_TYPE_BACKUP,
|
||||
],
|
||||
},
|
||||
|
||||
&CFGCMD_RESTORE =>
|
||||
{
|
||||
&CFGDEF_DEFAULT => CFGOPTVAL_RESTORE_TYPE_DEFAULT,
|
||||
@ -1075,6 +1055,23 @@ my %hConfigDefine =
|
||||
},
|
||||
},
|
||||
|
||||
&CFGOPT_REMOTE_TYPE =>
|
||||
{
|
||||
&CFGDEF_TYPE => CFGDEF_TYPE_STRING,
|
||||
&CFGDEF_REQUIRED => false,
|
||||
&CFGDEF_INTERNAL => true,
|
||||
&CFGDEF_ALLOW_LIST =>
|
||||
[
|
||||
&CFGOPTVAL_STORAGE_TYPE_PG,
|
||||
&CFGOPTVAL_STORAGE_TYPE_REPO,
|
||||
],
|
||||
&CFGDEF_COMMAND =>
|
||||
{
|
||||
&CFGCMD_LOCAL => {},
|
||||
&CFGCMD_REMOTE => {},
|
||||
}
|
||||
},
|
||||
|
||||
# Command-line only storage options
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
&CFGOPT_FILTER =>
|
||||
|
@ -17,6 +17,9 @@ sub libcAutoConstant
|
||||
CFGOPTVAL_LS_OUTPUT_TEXT => 'text',
|
||||
CFGOPTVAL_LS_OUTPUT_JSON => 'json',
|
||||
|
||||
CFGOPTVAL_REMOTE_TYPE_PG => 'pg',
|
||||
CFGOPTVAL_REMOTE_TYPE_REPO => 'repo',
|
||||
|
||||
CFGOPTVAL_REPO_CIPHER_TYPE_NONE => 'none',
|
||||
CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC => 'aes-256-cbc',
|
||||
|
||||
@ -40,12 +43,6 @@ sub libcAutoConstant
|
||||
CFGOPTVAL_BACKUP_TYPE_DIFF => 'diff',
|
||||
CFGOPTVAL_BACKUP_TYPE_INCR => 'incr',
|
||||
|
||||
CFGOPTVAL_LOCAL_TYPE_DB => 'db',
|
||||
CFGOPTVAL_LOCAL_TYPE_BACKUP => 'backup',
|
||||
|
||||
CFGOPTVAL_REMOTE_TYPE_DB => 'db',
|
||||
CFGOPTVAL_REMOTE_TYPE_BACKUP => 'backup',
|
||||
|
||||
CFGOPTVAL_RESTORE_TYPE_NAME => 'name',
|
||||
CFGOPTVAL_RESTORE_TYPE_TIME => 'time',
|
||||
CFGOPTVAL_RESTORE_TYPE_XID => 'xid',
|
||||
@ -87,6 +84,8 @@ sub libcAutoExportTag
|
||||
'CFGOPTVAL_INFO_OUTPUT_JSON',
|
||||
'CFGOPTVAL_LS_OUTPUT_TEXT',
|
||||
'CFGOPTVAL_LS_OUTPUT_JSON',
|
||||
'CFGOPTVAL_REMOTE_TYPE_PG',
|
||||
'CFGOPTVAL_REMOTE_TYPE_REPO',
|
||||
'CFGOPTVAL_REPO_CIPHER_TYPE_NONE',
|
||||
'CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC',
|
||||
'CFGOPTVAL_REPO_RETENTION_ARCHIVE_TYPE_FULL',
|
||||
@ -104,10 +103,6 @@ sub libcAutoExportTag
|
||||
'CFGOPTVAL_BACKUP_TYPE_FULL',
|
||||
'CFGOPTVAL_BACKUP_TYPE_DIFF',
|
||||
'CFGOPTVAL_BACKUP_TYPE_INCR',
|
||||
'CFGOPTVAL_LOCAL_TYPE_DB',
|
||||
'CFGOPTVAL_LOCAL_TYPE_BACKUP',
|
||||
'CFGOPTVAL_REMOTE_TYPE_DB',
|
||||
'CFGOPTVAL_REMOTE_TYPE_BACKUP',
|
||||
'CFGOPTVAL_RESTORE_TYPE_NAME',
|
||||
'CFGOPTVAL_RESTORE_TYPE_TIME',
|
||||
'CFGOPTVAL_RESTORE_TYPE_XID',
|
||||
@ -265,6 +260,7 @@ sub libcAutoExportTag
|
||||
'CFGOPT_PROTOCOL_TIMEOUT',
|
||||
'CFGOPT_RECOVERY_OPTION',
|
||||
'CFGOPT_RECURSE',
|
||||
'CFGOPT_REMOTE_TYPE',
|
||||
'CFGOPT_REPO_CIPHER_PASS',
|
||||
'CFGOPT_REPO_CIPHER_TYPE',
|
||||
'CFGOPT_REPO_HARDLINK',
|
||||
|
@ -432,6 +432,7 @@ STRING_EXTERN(CFGOPT_PROCESS_MAX_STR, CFGOPT_PROCE
|
||||
STRING_EXTERN(CFGOPT_PROTOCOL_TIMEOUT_STR, CFGOPT_PROTOCOL_TIMEOUT);
|
||||
STRING_EXTERN(CFGOPT_RECOVERY_OPTION_STR, CFGOPT_RECOVERY_OPTION);
|
||||
STRING_EXTERN(CFGOPT_RECURSE_STR, CFGOPT_RECURSE);
|
||||
STRING_EXTERN(CFGOPT_REMOTE_TYPE_STR, CFGOPT_REMOTE_TYPE);
|
||||
STRING_EXTERN(CFGOPT_REPO1_CIPHER_PASS_STR, CFGOPT_REPO1_CIPHER_PASS);
|
||||
STRING_EXTERN(CFGOPT_REPO1_CIPHER_TYPE_STR, CFGOPT_REPO1_CIPHER_TYPE);
|
||||
STRING_EXTERN(CFGOPT_REPO1_HARDLINK_STR, CFGOPT_REPO1_HARDLINK);
|
||||
@ -1519,6 +1520,14 @@ static ConfigOptionData configOptionData[CFG_OPTION_TOTAL] = CONFIG_OPTION_LIST
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptRecurse)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
CONFIG_OPTION_NAME(CFGOPT_REMOTE_TYPE)
|
||||
CONFIG_OPTION_INDEX(0)
|
||||
CONFIG_OPTION_DEFINE_ID(cfgDefOptRemoteType)
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
CONFIG_OPTION
|
||||
(
|
||||
|
@ -313,6 +313,8 @@ Option constants
|
||||
STRING_DECLARE(CFGOPT_RECOVERY_OPTION_STR);
|
||||
#define CFGOPT_RECURSE "recurse"
|
||||
STRING_DECLARE(CFGOPT_RECURSE_STR);
|
||||
#define CFGOPT_REMOTE_TYPE "remote-type"
|
||||
STRING_DECLARE(CFGOPT_REMOTE_TYPE_STR);
|
||||
#define CFGOPT_REPO1_CIPHER_PASS "repo1-cipher-pass"
|
||||
STRING_DECLARE(CFGOPT_REPO1_CIPHER_PASS_STR);
|
||||
#define CFGOPT_REPO1_CIPHER_TYPE "repo1-cipher-type"
|
||||
@ -396,7 +398,7 @@ Option constants
|
||||
#define CFGOPT_TYPE "type"
|
||||
STRING_DECLARE(CFGOPT_TYPE_STR);
|
||||
|
||||
#define CFG_OPTION_TOTAL 171
|
||||
#define CFG_OPTION_TOTAL 172
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Command enum
|
||||
@ -560,6 +562,7 @@ typedef enum
|
||||
cfgOptProtocolTimeout,
|
||||
cfgOptRecoveryOption,
|
||||
cfgOptRecurse,
|
||||
cfgOptRemoteType,
|
||||
cfgOptRepoCipherPass,
|
||||
cfgOptRepoCipherType,
|
||||
cfgOptRepoHardlink,
|
||||
|
@ -2658,6 +2658,34 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
|
||||
)
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
CFGDEFDATA_OPTION
|
||||
(
|
||||
CFGDEFDATA_OPTION_NAME("remote-type")
|
||||
CFGDEFDATA_OPTION_REQUIRED(false)
|
||||
CFGDEFDATA_OPTION_SECTION(cfgDefSectionCommandLine)
|
||||
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString)
|
||||
CFGDEFDATA_OPTION_INTERNAL(true)
|
||||
|
||||
CFGDEFDATA_OPTION_INDEX_TOTAL(1)
|
||||
CFGDEFDATA_OPTION_SECURE(false)
|
||||
|
||||
CFGDEFDATA_OPTION_COMMAND_LIST
|
||||
(
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRemote)
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_LIST
|
||||
(
|
||||
CFGDEFDATA_OPTION_OPTIONAL_ALLOW_LIST
|
||||
(
|
||||
"pg",
|
||||
"repo"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
CFGDEFDATA_OPTION
|
||||
(
|
||||
@ -4634,8 +4662,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
|
||||
CFGDEFDATA_OPTION_COMMAND_LIST
|
||||
(
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRemote)
|
||||
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRestore)
|
||||
)
|
||||
|
||||
@ -4665,28 +4691,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
|
||||
)
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRIDE
|
||||
(
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdLocal)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_ALLOW_LIST
|
||||
(
|
||||
"db",
|
||||
"backup"
|
||||
)
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRIDE
|
||||
(
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdRemote)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_ALLOW_LIST
|
||||
(
|
||||
"db",
|
||||
"backup"
|
||||
)
|
||||
)
|
||||
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRIDE
|
||||
(
|
||||
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdRestore)
|
||||
|
@ -105,6 +105,7 @@ typedef enum
|
||||
cfgDefOptProtocolTimeout,
|
||||
cfgDefOptRecoveryOption,
|
||||
cfgDefOptRecurse,
|
||||
cfgDefOptRemoteType,
|
||||
cfgDefOptRepoCipherPass,
|
||||
cfgDefOptRepoCipherType,
|
||||
cfgDefOptRepoHardlink,
|
||||
|
@ -1701,6 +1701,14 @@ static const struct option optionList[] =
|
||||
.val = PARSE_OPTION_FLAG | cfgOptRecurse,
|
||||
},
|
||||
|
||||
// remote-type option
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
.name = CFGOPT_REMOTE_TYPE,
|
||||
.has_arg = required_argument,
|
||||
.val = PARSE_OPTION_FLAG | cfgOptRemoteType,
|
||||
},
|
||||
|
||||
// repo-cipher-pass option and deprecations
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
@ -2441,6 +2449,7 @@ static const ConfigOption optionResolveOrder[] =
|
||||
cfgOptProcessMax,
|
||||
cfgOptProtocolTimeout,
|
||||
cfgOptRecurse,
|
||||
cfgOptRemoteType,
|
||||
cfgOptRepoCipherType,
|
||||
cfgOptRepoHardlink,
|
||||
cfgOptRepoHost,
|
||||
|
@ -20,8 +20,8 @@ Constants
|
||||
STRING_EXTERN(PROTOCOL_SERVICE_LOCAL_STR, PROTOCOL_SERVICE_LOCAL);
|
||||
STRING_EXTERN(PROTOCOL_SERVICE_REMOTE_STR, PROTOCOL_SERVICE_REMOTE);
|
||||
|
||||
STRING_STATIC(PROTOCOL_STORAGE_TYPE_PG_STR, "db");
|
||||
STRING_STATIC(PROTOCOL_STORAGE_TYPE_REPO_STR, "backup");
|
||||
STRING_STATIC(PROTOCOL_REMOTE_TYPE_PG_STR, PROTOCOL_REMOTE_TYPE_PG);
|
||||
STRING_STATIC(PROTOCOL_REMOTE_TYPE_REPO_STR, PROTOCOL_REMOTE_TYPE_REPO);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Local variables
|
||||
@ -131,7 +131,7 @@ protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostId,
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_HOST_ID_STR), VARUINT(hostId));
|
||||
|
||||
// Add the storage type
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_TYPE_STR), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_REMOTE_TYPE_STR), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
||||
|
||||
// Only enable file logging on the local when requested
|
||||
kvPut(
|
||||
@ -306,7 +306,7 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int protoc
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_LOG_LEVEL_STDERR_STR), VARSTRDEF("error"));
|
||||
|
||||
// Add the type
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_TYPE_STR), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
||||
kvPut(optionReplace, VARSTR(CFGOPT_REMOTE_TYPE_STR), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
||||
|
||||
StringList *commandExec = cfgExecParam(cfgCmdRemote, optionReplace, false);
|
||||
strLstInsert(commandExec, 0, cfgOptionStr(isRepo ? cfgOptRepoHostCmd : cfgOptPgHostCmd + hostIdx));
|
||||
@ -468,9 +468,9 @@ protocolStorageTypeEnum(const String *type)
|
||||
|
||||
ASSERT(type != NULL);
|
||||
|
||||
if (strEq(type, PROTOCOL_STORAGE_TYPE_PG_STR))
|
||||
if (strEq(type, PROTOCOL_REMOTE_TYPE_PG_STR))
|
||||
FUNCTION_TEST_RETURN(protocolStorageTypePg);
|
||||
else if (strEq(type, PROTOCOL_STORAGE_TYPE_REPO_STR))
|
||||
else if (strEq(type, PROTOCOL_REMOTE_TYPE_REPO_STR))
|
||||
FUNCTION_TEST_RETURN(protocolStorageTypeRepo);
|
||||
|
||||
THROW_FMT(AssertError, "invalid protocol storage type '%s'", strPtr(type));
|
||||
@ -486,10 +486,10 @@ protocolStorageTypeStr(ProtocolStorageType type)
|
||||
switch (type)
|
||||
{
|
||||
case protocolStorageTypePg:
|
||||
FUNCTION_TEST_RETURN(PROTOCOL_STORAGE_TYPE_PG_STR);
|
||||
FUNCTION_TEST_RETURN(PROTOCOL_REMOTE_TYPE_PG_STR);
|
||||
|
||||
case protocolStorageTypeRepo:
|
||||
FUNCTION_TEST_RETURN(PROTOCOL_STORAGE_TYPE_REPO_STR);
|
||||
FUNCTION_TEST_RETURN(PROTOCOL_REMOTE_TYPE_REPO_STR);
|
||||
}
|
||||
|
||||
THROW_FMT(AssertError, "invalid protocol storage type %u", type);
|
||||
|
@ -23,6 +23,9 @@ Constants
|
||||
#define PROTOCOL_SERVICE_REMOTE "remote"
|
||||
STRING_DECLARE(PROTOCOL_SERVICE_REMOTE_STR);
|
||||
|
||||
#define PROTOCOL_REMOTE_TYPE_PG "pg"
|
||||
#define PROTOCOL_REMOTE_TYPE_REPO "repo"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -193,7 +193,7 @@ storageRemoteProtocol(const String *command, const VariantList *paramList, Proto
|
||||
|
||||
// Determine which storage should be used
|
||||
const Storage *storage = protocolStorageTypeEnum(
|
||||
cfgOptionStr(cfgOptType)) == protocolStorageTypeRepo ? storageRepo() : storagePg();
|
||||
cfgOptionStr(cfgOptRemoteType)) == protocolStorageTypeRepo ? storageRepo() : storagePg();
|
||||
StorageInterface interface = storageInterface(storage);
|
||||
void *driver = storageDriver(storage);
|
||||
|
||||
|
@ -34,7 +34,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
strLstAddZ(argList, "--command=archive-get-async");
|
||||
strLstAddZ(argList, "--process=1");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAddZ(argList, "--host-id=1");
|
||||
harnessCfgLoad(cfgCmdLocal, argList);
|
||||
|
||||
|
@ -35,7 +35,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
strLstAddZ(argList, "--command=info");
|
||||
strLstAddZ(argList, "--process=1");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
harnessCfgLoad(cfgCmdRemote, argList);
|
||||
|
||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||
@ -67,7 +67,7 @@ testRun(void)
|
||||
strLstAddZ(argList, testProjectExe());
|
||||
strLstAddZ(argList, "--command=archive-get-async");
|
||||
strLstAddZ(argList, "--process=0");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAddZ(argList, "--lock-path=/bogus");
|
||||
strLstAddZ(argList, "remote");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
@ -103,7 +103,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test");
|
||||
strLstAddZ(argList, "--command=archive-push-async");
|
||||
strLstAddZ(argList, "--process=0");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAddZ(argList, "--lock-path=/bogus");
|
||||
strLstAddZ(argList, "remote");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
@ -137,7 +137,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test");
|
||||
strLstAddZ(argList, "--command=archive-push-async");
|
||||
strLstAddZ(argList, "--process=0");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
harnessCfgLoad(cfgCmdRemote, argList);
|
||||
|
||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||
@ -178,7 +178,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test");
|
||||
strLstAddZ(argList, "--command=archive-push-async");
|
||||
strLstAddZ(argList, "--process=0");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
harnessCfgLoad(cfgCmdRemote, argList);
|
||||
|
||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||
|
@ -3,6 +3,7 @@ Test Configuration Load
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/io/io.h"
|
||||
#include "common/log.h"
|
||||
#include "protocol/helper.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
@ -416,7 +417,7 @@ testRun(void)
|
||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||
strLstAdd(argList, strNew("--process=1"));
|
||||
strLstAdd(argList, strNew("--host-id=1"));
|
||||
strLstAdd(argList, strNew("--type=backup"));
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAdd(argList, strNew("--log-level-file=warn"));
|
||||
strLstAdd(argList, strNew("local"));
|
||||
|
||||
@ -430,7 +431,7 @@ testRun(void)
|
||||
strLstAdd(argList, strNew("pgbackrest"));
|
||||
strLstAdd(argList, strNew("--command=backup"));
|
||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||
strLstAdd(argList, strNew("--type=backup"));
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAdd(argList, strNew("--log-level-file=warn"));
|
||||
strLstAdd(argList, strNew("--process=0"));
|
||||
strLstAdd(argList, strNew("remote"));
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Configuration Parse
|
||||
***********************************************************************************************************************************/
|
||||
#include "protocol/helper.h"
|
||||
#include "storage/storage.intern.h"
|
||||
|
||||
#define TEST_BACKREST_EXE "pgbackrest"
|
||||
@ -781,7 +782,7 @@ testRun(void)
|
||||
strLstAdd(argList, strNew("--process=1"));
|
||||
strLstAdd(argList, strNew("--command=backup"));
|
||||
strLstAdd(argList, strNew("--stanza=db"));
|
||||
strLstAdd(argList, strNew("--type=backup"));
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
||||
strLstAdd(argList, strNew("local"));
|
||||
|
||||
@ -796,7 +797,7 @@ testRun(void)
|
||||
strLstAdd(argList, strNew("--process=1"));
|
||||
strLstAdd(argList, strNew("--command=backup"));
|
||||
strLstAdd(argList, strNew("--stanza=db"));
|
||||
strLstAdd(argList, strNew("--type=backup"));
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
||||
strLstAdd(argList, strNew("remote"));
|
||||
|
||||
|
@ -73,7 +73,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
||||
strLstAddZ(argList, "--command=backup");
|
||||
strLstAddZ(argList, "--type=db");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
||||
strLstAddZ(argList, "--process=0");
|
||||
harnessCfgLoad(cfgCmdRemote, argList);
|
||||
|
||||
|
@ -103,12 +103,12 @@ testRun(void)
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("protocolStorageTypeEnum() and protocolStorageTypeEnum()"))
|
||||
{
|
||||
TEST_RESULT_UINT(protocolStorageTypeEnum(PROTOCOL_STORAGE_TYPE_PG_STR), protocolStorageTypePg, "pg enum");
|
||||
TEST_RESULT_UINT(protocolStorageTypeEnum(PROTOCOL_STORAGE_TYPE_REPO_STR), protocolStorageTypeRepo, "repo enum");
|
||||
TEST_RESULT_UINT(protocolStorageTypeEnum(PROTOCOL_REMOTE_TYPE_PG_STR), protocolStorageTypePg, "pg enum");
|
||||
TEST_RESULT_UINT(protocolStorageTypeEnum(PROTOCOL_REMOTE_TYPE_REPO_STR), protocolStorageTypeRepo, "repo enum");
|
||||
TEST_ERROR(protocolStorageTypeEnum(STRDEF(BOGUS_STR)), AssertError, "invalid protocol storage type 'BOGUS'");
|
||||
|
||||
TEST_RESULT_STR(protocolStorageTypeStr(protocolStorageTypePg), PROTOCOL_STORAGE_TYPE_PG_STR, "pg str");
|
||||
TEST_RESULT_STR(protocolStorageTypeStr(protocolStorageTypeRepo), PROTOCOL_STORAGE_TYPE_REPO_STR, "repo str");
|
||||
TEST_RESULT_STR(protocolStorageTypeStr(protocolStorageTypePg), PROTOCOL_REMOTE_TYPE_PG_STR, "pg str");
|
||||
TEST_RESULT_STR(protocolStorageTypeStr(protocolStorageTypeRepo), PROTOCOL_REMOTE_TYPE_REPO_STR, "repo str");
|
||||
TEST_ERROR(protocolStorageTypeStr((ProtocolStorageType)999), AssertError, "invalid protocol storage type 999");
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--pg7-host=test1");
|
||||
strLstAddZ(argList, "--host-id=7");
|
||||
strLstAddZ(argList, "--command=backup");
|
||||
strLstAddZ(argList, "--type=db");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
||||
strLstAddZ(argList, "--process=0");
|
||||
strLstAddZ(argList, "local");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
@ -173,8 +173,8 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
strLstJoin(protocolLocalParam(protocolStorageTypeRepo, 1, 0), "|"),
|
||||
"--command=archive-get|--host-id=1|--log-level-file=off|--log-level-stderr=error|--process=0|--stanza=test1"
|
||||
"|--type=backup|local",
|
||||
"--command=archive-get|--host-id=1|--log-level-file=off|--log-level-stderr=error|--process=0|--remote-type=repo"
|
||||
"|--stanza=test1|local",
|
||||
"local repo protocol params");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -190,7 +190,7 @@ testRun(void)
|
||||
TEST_RESULT_STR_Z(
|
||||
strLstJoin(protocolLocalParam(protocolStorageTypePg, 2, 1), "|"),
|
||||
"--command=backup|--host-id=2|--log-level-file=info|--log-level-stderr=error|--log-subprocess|--pg1-path=/pg"
|
||||
"|--process=1|--stanza=test1|--type=db|local",
|
||||
"|--process=1|--remote-type=pg|--stanza=test1|local",
|
||||
"local pg protocol params");
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ testRun(void)
|
||||
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0, 0), "|"),
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host"
|
||||
"|pgbackrest --command=archive-get --log-level-file=off --log-level-stderr=error --process=0"
|
||||
" --stanza=test1 --type=backup remote",
|
||||
" --remote-type=repo --stanza=test1 remote",
|
||||
"remote protocol params");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -237,7 +237,7 @@ testRun(void)
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host"
|
||||
"|pgbackrest --command=archive-get --config=/path/pgbackrest.conf --config-include-path=/path/include"
|
||||
" --config-path=/path/config --log-level-file=info --log-level-stderr=error --log-subprocess --process=1"
|
||||
" --stanza=test1 --type=backup remote",
|
||||
" --remote-type=repo --stanza=test1 remote",
|
||||
"remote protocol params with replacements");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -247,7 +247,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--command=archive-get");
|
||||
strLstAddZ(argList, "--process=3");
|
||||
strLstAddZ(argList, "--host-id=1");
|
||||
strLstAddZ(argList, "--type=backup");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
||||
strLstAddZ(argList, "--repo1-host=repo-host");
|
||||
strLstAddZ(argList, "local");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
@ -256,7 +256,7 @@ testRun(void)
|
||||
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 66, 0), "|"),
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host"
|
||||
"|pgbackrest --command=archive-get --log-level-file=off --log-level-stderr=error --process=3"
|
||||
" --stanza=test1 --type=backup remote",
|
||||
" --remote-type=repo --stanza=test1 remote",
|
||||
"remote protocol params for backup local");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -273,7 +273,7 @@ testRun(void)
|
||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1, 0), "|"),
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg1-host"
|
||||
"|pgbackrest --command=backup --log-level-file=off --log-level-stderr=error --pg1-path=/path/to/1"
|
||||
" --process=1 --stanza=test1 --type=db remote",
|
||||
" --process=1 --remote-type=pg --stanza=test1 remote",
|
||||
"remote protocol params for db backup");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -288,7 +288,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--pg1-port=1111");
|
||||
strLstAddZ(argList, "--pg2-path=/path/to/2");
|
||||
strLstAddZ(argList, "--pg2-host=pg2-host");
|
||||
strLstAddZ(argList, "--type=db");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
||||
strLstAddZ(argList, "local");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
|
||||
@ -296,7 +296,7 @@ testRun(void)
|
||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1, 1), "|"),
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg2-host"
|
||||
"|pgbackrest --command=backup --log-level-file=off --log-level-stderr=error --pg1-path=/path/to/2"
|
||||
" --process=4 --stanza=test1 --type=db remote",
|
||||
" --process=4 --remote-type=pg --stanza=test1 remote",
|
||||
"remote protocol params for db local");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -311,7 +311,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--pg3-host=pg3-host");
|
||||
strLstAddZ(argList, "--pg3-socket-path=/socket3");
|
||||
strLstAddZ(argList, "--pg3-port=3333");
|
||||
strLstAddZ(argList, "--type=db");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
||||
strLstAddZ(argList, "local");
|
||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||
|
||||
@ -319,7 +319,7 @@ testRun(void)
|
||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1, 2), "|"),
|
||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg3-host"
|
||||
"|pgbackrest --command=backup --log-level-file=off --log-level-stderr=error --pg1-path=/path/to/3"
|
||||
" --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --stanza=test1 --type=db remote",
|
||||
" --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1 remote",
|
||||
"remote protocol params for db local");
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ testRun(void)
|
||||
strLstAddZ(argList, "--process=999");
|
||||
strLstAddZ(argList, "--command=archive-get");
|
||||
strLstAddZ(argList, "--host-id=1");
|
||||
strLstAddZ(argList, "--type=db");
|
||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
||||
harnessCfgLoad(cfgCmdLocal, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoCipherPass), "acbd", "check cipher pass before");
|
||||
|
@ -33,11 +33,11 @@ testRun(void)
|
||||
strLstAddZ(argList, "--repo1-host=localhost");
|
||||
strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser()));
|
||||
strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath()));
|
||||
harnessCfgLoad(cfgCmdInfo, argList);
|
||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
||||
|
||||
// Set type since we'll be running local and remote tests here
|
||||
cfgOptionSet(cfgOptType, cfgSourceParam, VARSTRDEF("backup"));
|
||||
cfgOptionValidSet(cfgOptType, true);
|
||||
cfgOptionSet(cfgOptRemoteType, cfgSourceParam, VARSTRDEF("repo"));
|
||||
cfgOptionValidSet(cfgOptRemoteType, true);
|
||||
|
||||
// Set pg settings so we can run both db and backup remotes
|
||||
cfgOptionSet(cfgOptPgHost, cfgSourceParam, VARSTRDEF("localhost"));
|
||||
@ -83,7 +83,7 @@ testRun(void)
|
||||
TEST_RESULT_BOOL(storageRemoteProtocol(strNew(BOGUS_STR), varLstNew(), server), false, "invalid function");
|
||||
}
|
||||
|
||||
// Do these tests against a db remote for coverage
|
||||
// Do these tests against a pg remote for coverage
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageExists()"))
|
||||
{
|
||||
@ -98,8 +98,8 @@ testRun(void)
|
||||
|
||||
// Check protocol function directly
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
cfgOptionSet(cfgOptType, cfgSourceParam, VARSTRDEF("db"));
|
||||
cfgOptionValidSet(cfgOptType, true);
|
||||
cfgOptionSet(cfgOptRemoteType, cfgSourceParam, VARSTRDEF("pg"));
|
||||
cfgOptionValidSet(cfgOptRemoteType, true);
|
||||
|
||||
VariantList *paramList = varLstNew();
|
||||
varLstAdd(paramList, varNewStr(strNewFmt("%s/repo/test.txt", testPath())));
|
||||
@ -109,9 +109,6 @@ testRun(void)
|
||||
TEST_RESULT_STR_Z(strNewBuf(serverWrite), "{\"out\":true}\n", "check result");
|
||||
|
||||
bufUsedSet(serverWrite, 0);
|
||||
|
||||
cfgOptionSet(cfgOptType, cfgSourceParam, VARSTRDEF("db"));
|
||||
cfgOptionValidSet(cfgOptType, true);
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user