1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +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:
David Steele
2020-01-08 18:59:02 -07:00
parent 7a1871c341
commit 7de5ce23ad
17 changed files with 130 additions and 109 deletions

View File

@ -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");