You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Convert ProtocolStorageType enum to StringId.
Allows removal of protocolStorageTypeEnum()/protocolStorageTypeStr() and improves debug logging of the enum.
This commit is contained in:
@ -94,6 +94,7 @@
|
|||||||
<github-pull-request id="1384"/>
|
<github-pull-request id="1384"/>
|
||||||
</commit>
|
</commit>
|
||||||
<commit subject="Convert ProtocolParallelJobState enum to StringId."/>
|
<commit subject="Convert ProtocolParallelJobState enum to StringId."/>
|
||||||
|
<commit subject="Convert ProtocolStorageType enum to StringId."/>
|
||||||
|
|
||||||
<release-item-contributor-list>
|
<release-item-contributor-list>
|
||||||
<release-item-reviewer id="cynthia.shang"/>
|
<release-item-reviewer id="cynthia.shang"/>
|
||||||
|
@ -23,9 +23,6 @@ Constants
|
|||||||
STRING_EXTERN(PROTOCOL_SERVICE_LOCAL_STR, PROTOCOL_SERVICE_LOCAL);
|
STRING_EXTERN(PROTOCOL_SERVICE_LOCAL_STR, PROTOCOL_SERVICE_LOCAL);
|
||||||
STRING_EXTERN(PROTOCOL_SERVICE_REMOTE_STR, PROTOCOL_SERVICE_REMOTE);
|
STRING_EXTERN(PROTOCOL_SERVICE_REMOTE_STR, PROTOCOL_SERVICE_REMOTE);
|
||||||
|
|
||||||
STRING_STATIC(PROTOCOL_REMOTE_TYPE_PG_STR, PROTOCOL_REMOTE_TYPE_PG);
|
|
||||||
STRING_STATIC(PROTOCOL_REMOTE_TYPE_REPO_STR, PROTOCOL_REMOTE_TYPE_REPO);
|
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Local variables
|
Local variables
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
@ -132,7 +129,7 @@ static StringList *
|
|||||||
protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx, unsigned int processId)
|
protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx, unsigned int processId)
|
||||||
{
|
{
|
||||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_LOG_PARAM(ENUM, protocolStorageType);
|
FUNCTION_LOG_PARAM(STRING_ID, protocolStorageType);
|
||||||
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
||||||
FUNCTION_LOG_PARAM(UINT, processId);
|
FUNCTION_LOG_PARAM(UINT, processId);
|
||||||
FUNCTION_LOG_END();
|
FUNCTION_LOG_END();
|
||||||
@ -153,7 +150,7 @@ protocolLocalParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx
|
|||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_PG), VARUINT(cfgOptionGroupIdxToKey(cfgOptGrpPg, hostIdx)));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_PG), VARUINT(cfgOptionGroupIdxToKey(cfgOptGrpPg, hostIdx)));
|
||||||
|
|
||||||
// Add the remote type
|
// Add the remote type
|
||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_REMOTE_TYPE), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_REMOTE_TYPE), VARSTR(strIdToStr(protocolStorageType)));
|
||||||
|
|
||||||
// Only enable file logging on the local when requested
|
// Only enable file logging on the local when requested
|
||||||
kvPut(
|
kvPut(
|
||||||
@ -178,7 +175,7 @@ ProtocolClient *
|
|||||||
protocolLocalGet(ProtocolStorageType protocolStorageType, unsigned int hostIdx, unsigned int processId)
|
protocolLocalGet(ProtocolStorageType protocolStorageType, unsigned int hostIdx, unsigned int processId)
|
||||||
{
|
{
|
||||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_LOG_PARAM(ENUM, protocolStorageType);
|
FUNCTION_LOG_PARAM(STRING_ID, protocolStorageType);
|
||||||
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
||||||
FUNCTION_LOG_PARAM(UINT, processId);
|
FUNCTION_LOG_PARAM(UINT, processId);
|
||||||
FUNCTION_LOG_END();
|
FUNCTION_LOG_END();
|
||||||
@ -293,7 +290,7 @@ static StringList *
|
|||||||
protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx)
|
protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostIdx)
|
||||||
{
|
{
|
||||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_LOG_PARAM(ENUM, protocolStorageType);
|
FUNCTION_LOG_PARAM(STRING_ID, protocolStorageType);
|
||||||
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
||||||
FUNCTION_LOG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
@ -426,7 +423,7 @@ protocolRemoteParam(ProtocolStorageType protocolStorageType, unsigned int hostId
|
|||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_CONSOLE), VARSTRDEF("off"));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_LEVEL_CONSOLE), VARSTRDEF("off"));
|
||||||
|
|
||||||
// Add the remote type
|
// Add the remote type
|
||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_REMOTE_TYPE), VARSTR(protocolStorageTypeStr(protocolStorageType)));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_REMOTE_TYPE), VARSTR(strIdToStr(protocolStorageType)));
|
||||||
|
|
||||||
StringList *commandExec = cfgExecParam(cfgCommand(), cfgCmdRoleRemote, optionReplace, false, true);
|
StringList *commandExec = cfgExecParam(cfgCommand(), cfgCmdRoleRemote, optionReplace, false, true);
|
||||||
strLstInsert(commandExec, 0, cfgOptionIdxStr(isRepo ? cfgOptRepoHostCmd : cfgOptPgHostCmd, hostIdx));
|
strLstInsert(commandExec, 0, cfgOptionIdxStr(isRepo ? cfgOptRepoHostCmd : cfgOptPgHostCmd, hostIdx));
|
||||||
@ -440,7 +437,7 @@ ProtocolClient *
|
|||||||
protocolRemoteGet(ProtocolStorageType protocolStorageType, unsigned int hostIdx)
|
protocolRemoteGet(ProtocolStorageType protocolStorageType, unsigned int hostIdx)
|
||||||
{
|
{
|
||||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||||
FUNCTION_LOG_PARAM(ENUM, protocolStorageType);
|
FUNCTION_LOG_PARAM(STRING_ID, protocolStorageType);
|
||||||
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
FUNCTION_LOG_PARAM(UINT, hostIdx);
|
||||||
FUNCTION_LOG_END();
|
FUNCTION_LOG_END();
|
||||||
|
|
||||||
@ -551,45 +548,6 @@ protocolKeepAlive(void)
|
|||||||
FUNCTION_LOG_RETURN_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
|
||||||
Getters/Setters
|
|
||||||
***********************************************************************************************************************************/
|
|
||||||
ProtocolStorageType
|
|
||||||
protocolStorageTypeEnum(const String *type)
|
|
||||||
{
|
|
||||||
FUNCTION_TEST_BEGIN();
|
|
||||||
FUNCTION_TEST_PARAM(STRING, type);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
ASSERT(type != NULL);
|
|
||||||
|
|
||||||
if (strEq(type, PROTOCOL_REMOTE_TYPE_PG_STR))
|
|
||||||
FUNCTION_TEST_RETURN(protocolStorageTypePg);
|
|
||||||
else if (strEq(type, PROTOCOL_REMOTE_TYPE_REPO_STR))
|
|
||||||
FUNCTION_TEST_RETURN(protocolStorageTypeRepo);
|
|
||||||
|
|
||||||
THROW_FMT(AssertError, "invalid protocol storage type '%s'", strZ(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
const String *
|
|
||||||
protocolStorageTypeStr(ProtocolStorageType type)
|
|
||||||
{
|
|
||||||
FUNCTION_TEST_BEGIN();
|
|
||||||
FUNCTION_TEST_PARAM(ENUM, type);
|
|
||||||
FUNCTION_TEST_END();
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case protocolStorageTypePg:
|
|
||||||
FUNCTION_TEST_RETURN(PROTOCOL_REMOTE_TYPE_PG_STR);
|
|
||||||
|
|
||||||
case protocolStorageTypeRepo:
|
|
||||||
FUNCTION_TEST_RETURN(PROTOCOL_REMOTE_TYPE_REPO_STR);
|
|
||||||
}
|
|
||||||
|
|
||||||
THROW_FMT(AssertError, "invalid protocol storage type %u", type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
/**********************************************************************************************************************************/
|
||||||
void
|
void
|
||||||
protocolFree(void)
|
protocolFree(void)
|
||||||
|
@ -9,8 +9,8 @@ Protocol storage type enum
|
|||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
protocolStorageTypeRepo,
|
protocolStorageTypePg = STRID5("pg", 0xf00),
|
||||||
protocolStorageTypePg,
|
protocolStorageTypeRepo = STRID5("repo", 0x7c0b20),
|
||||||
} ProtocolStorageType;
|
} ProtocolStorageType;
|
||||||
|
|
||||||
#include "protocol/client.h"
|
#include "protocol/client.h"
|
||||||
@ -23,9 +23,6 @@ Constants
|
|||||||
#define PROTOCOL_SERVICE_REMOTE "remote"
|
#define PROTOCOL_SERVICE_REMOTE "remote"
|
||||||
STRING_DECLARE(PROTOCOL_SERVICE_REMOTE_STR);
|
STRING_DECLARE(PROTOCOL_SERVICE_REMOTE_STR);
|
||||||
|
|
||||||
#define PROTOCOL_REMOTE_TYPE_PG "pg"
|
|
||||||
#define PROTOCOL_REMOTE_TYPE_REPO "repo"
|
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Getters/Setters
|
Getters/Setters
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
@ -42,10 +39,6 @@ bool repoIsLocal(unsigned int repoIdx);
|
|||||||
void repoIsLocalVerify(void);
|
void repoIsLocalVerify(void);
|
||||||
void repoIsLocalVerifyIdx(unsigned int repoIdx);
|
void repoIsLocalVerifyIdx(unsigned int repoIdx);
|
||||||
|
|
||||||
// Get enum/string for protocol storage type
|
|
||||||
ProtocolStorageType protocolStorageTypeEnum(const String *type);
|
|
||||||
const String *protocolStorageTypeStr(ProtocolStorageType type);
|
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Functions
|
Functions
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -140,8 +140,7 @@ storageRemoteFeatureProtocol(const VariantList *paramList, ProtocolServer *serve
|
|||||||
{
|
{
|
||||||
// Get storage based on remote type
|
// Get storage based on remote type
|
||||||
const Storage *storage =
|
const Storage *storage =
|
||||||
protocolStorageTypeEnum(cfgOptionStr(cfgOptRemoteType)) == protocolStorageTypeRepo ?
|
cfgOptionStrId(cfgOptRemoteType) == protocolStorageTypeRepo ? storageRepoWrite() : storagePgWrite();
|
||||||
storageRepoWrite() : storagePgWrite();
|
|
||||||
|
|
||||||
// Store local variables in the server context
|
// Store local variables in the server context
|
||||||
if (storageRemoteProtocolLocal.memContext == NULL)
|
if (storageRemoteProtocolLocal.memContext == NULL)
|
||||||
|
@ -575,7 +575,7 @@ unit:
|
|||||||
test:
|
test:
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------
|
||||||
- name: protocol
|
- name: protocol
|
||||||
total: 10
|
total: 9
|
||||||
containerReq: true
|
containerReq: true
|
||||||
binReq: true
|
binReq: true
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--process=1");
|
strLstAddZ(argList, "--process=1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
||||||
|
|
||||||
cmdLocal(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdLocal(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
|
@ -34,7 +34,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--process=1");
|
strLstAddZ(argList, "--process=1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdInfo, cfgCmdRoleRemote, argList);
|
harnessCfgLoadRole(cfgCmdInfo, cfgCmdRoleRemote, argList);
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
@ -66,7 +66,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, testProjectExe());
|
strLstAddZ(argList, testProjectExe());
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--lock-path=/bogus");
|
strLstAddZ(argList, "--lock-path=/bogus");
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
@ -104,7 +104,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, testProjectExe());
|
strLstAddZ(argList, testProjectExe());
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--lock-path=/bogus");
|
strLstAddZ(argList, "--lock-path=/bogus");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH ":" CONFIG_COMMAND_ROLE_REMOTE);
|
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH ":" CONFIG_COMMAND_ROLE_REMOTE);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
@ -138,7 +138,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
|
@ -630,7 +630,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
|
||||||
strLstAdd(argList, strNew("--process=1"));
|
strLstAdd(argList, strNew("--process=1"));
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAdd(argList, strNew("--log-level-file=warn"));
|
strLstAdd(argList, strNew("--log-level-file=warn"));
|
||||||
hrnCfgArgRawZ(argList, cfgOptExecId, "1111-fe70d611");
|
hrnCfgArgRawZ(argList, cfgOptExecId, "1111-fe70d611");
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
@ -644,7 +644,7 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAdd(argList, strNew("pgbackrest"));
|
strLstAdd(argList, strNew("pgbackrest"));
|
||||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
||||||
strLstAdd(argList, strNew("--process=0"));
|
strLstAdd(argList, strNew("--process=0"));
|
||||||
@ -661,7 +661,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
||||||
strLstAdd(argList, strNew("--process=1"));
|
strLstAdd(argList, strNew("--process=1"));
|
||||||
@ -678,7 +678,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNew("pgbackrest"));
|
strLstAdd(argList, strNew("pgbackrest"));
|
||||||
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
strLstAdd(argList, strNewFmt("--log-path=%s", testPath()));
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
strLstAddZ(argList, "--" CFGOPT_LOG_LEVEL_FILE "=info");
|
||||||
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
strLstAddZ(argList, "--" CFGOPT_LOG_SUBPROCESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
|
@ -786,7 +786,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/path/to/2");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/path/to/2");
|
||||||
strLstAdd(argList, strNew("--process=1"));
|
strLstAdd(argList, strNew("--process=1"));
|
||||||
strLstAdd(argList, strNew("--stanza=db"));
|
strLstAdd(argList, strNew("--stanza=db"));
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
|
|
||||||
@ -805,7 +805,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to");
|
||||||
strLstAdd(argList, strNew("--process=1"));
|
strLstAdd(argList, strNew("--process=1"));
|
||||||
strLstAdd(argList, strNew("--stanza=db"));
|
strLstAdd(argList, strNew("--stanza=db"));
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
strLstAdd(argList, strNew("--log-level-stderr=info"));
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_REMOTE);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_REMOTE);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
||||||
strLstAddZ(argList, "--pg1-database=testdb");
|
strLstAddZ(argList, "--pg1-database=testdb");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
harnessCfgLoadRole(cfgCmdBackup, cfgCmdRoleRemote, argList);
|
harnessCfgLoadRole(cfgCmdBackup, cfgCmdRoleRemote, argList);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
strLstAddZ(argList, "--" CFGOPT_PROCESS "=0");
|
strLstAddZ(argList, "--" CFGOPT_PROCESS "=0");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
||||||
|
|
||||||
// Create a driver to test remote performance of storageInfoList() and inject it into storageRepo()
|
// Create a driver to test remote performance of storageInfoList() and inject it into storageRepo()
|
||||||
|
@ -151,18 +151,6 @@ testRun(void)
|
|||||||
|
|
||||||
Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true);
|
Storage *storageTest = storagePosixNewP(strNew(testPath()), .write = true);
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
|
||||||
if (testBegin("protocolStorageTypeEnum() and protocolStorageTypeEnum()"))
|
|
||||||
{
|
|
||||||
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_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");
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
if (testBegin("repoIsLocal() and pgIsLocal()"))
|
if (testBegin("repoIsLocal() and pgIsLocal()"))
|
||||||
{
|
{
|
||||||
@ -234,7 +222,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg7-path=/path/to");
|
strLstAddZ(argList, "--pg7-path=/path/to");
|
||||||
strLstAddZ(argList, "--pg7-host=test1");
|
strLstAddZ(argList, "--pg7-host=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPg, "7");
|
hrnCfgArgRawZ(argList, cfgOptPg, "7");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
@ -352,7 +340,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--process=3");
|
strLstAddZ(argList, "--process=3");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_REPO);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--repo1-host=repo-host");
|
strLstAddZ(argList, "--repo1-host=repo-host");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
@ -392,7 +380,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-port=1111");
|
strLstAddZ(argList, "--pg1-port=1111");
|
||||||
strLstAddZ(argList, "--pg2-path=/path/to/2");
|
strLstAddZ(argList, "--pg2-path=/path/to/2");
|
||||||
strLstAddZ(argList, "--pg2-host=pg2-host");
|
strLstAddZ(argList, "--pg2-host=pg2-host");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
@ -414,7 +402,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg3-host=pg3-host");
|
strLstAddZ(argList, "--pg3-host=pg3-host");
|
||||||
strLstAddZ(argList, "--pg3-socket-path=/socket3");
|
strLstAddZ(argList, "--pg3-socket-path=/socket3");
|
||||||
strLstAddZ(argList, "--pg3-port=3333");
|
strLstAddZ(argList, "--pg3-port=3333");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
@ -1037,7 +1025,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser()));
|
strLstAdd(argList, strNewFmt("--repo1-host-user=%s", testUser()));
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath()));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", testPath()));
|
||||||
strLstAddZ(argList, "--process=999");
|
strLstAddZ(argList, "--process=999");
|
||||||
strLstAddZ(argList, "--" CFGOPT_REMOTE_TYPE "=" PROTOCOL_REMOTE_TYPE_PG);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoCipherPass), "acbd", "check cipher pass before");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoCipherPass), "acbd", "check cipher pass before");
|
||||||
|
Reference in New Issue
Block a user