1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Replace hrnLogResult() with TEST_RESULT_LOG/_FMT().

The macros provide more information when there is an error and may be updated in the future without changing the test code.
This commit is contained in:
David Steele 2021-05-22 14:09:45 -04:00
parent 6baad5cdd1
commit 73885f8c2e
19 changed files with 370 additions and 439 deletions

View File

@ -415,52 +415,6 @@ harnessLogResult(const char *expected)
FUNCTION_HARNESS_RETURN_VOID();
}
/***********************************************************************************************************************************
Compare log to a regexp
After the comparison the log is cleared so the next result can be compared.
***********************************************************************************************************************************/
void
harnessLogResultRegExp(const char *expression)
{
FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(STRINGZ, expression);
FUNCTION_HARNESS_ASSERT(expression != NULL);
FUNCTION_HARNESS_END();
regex_t regExp;
TRY_BEGIN()
{
harnessLogLoad(logFile);
// Compile the regexp and process errors
int result = 0;
if ((result = regcomp(&regExp, expression, REG_NOSUB | REG_EXTENDED)) != 0)
{
char buffer[4096];
regerror(result, NULL, buffer, sizeof(buffer));
THROW(FormatError, buffer);
}
// Do the match
if (regexec(&regExp, harnessLogBuffer, 0, NULL, 0) != 0)
THROW_FMT(AssertError, "\n\nexpected log regexp:\n\n%s\n\nbut actual log was:\n\n%s\n\n", expression, harnessLogBuffer);
close(logFdFile);
logFdFile = harnessLogOpen(logFile, O_WRONLY | O_CREAT | O_TRUNC, 0640);
}
FINALLY()
{
regfree(&regExp);
}
TRY_END();
FUNCTION_HARNESS_RETURN_VOID();
}
/***********************************************************************************************************************************
Make sure nothing is left in the log after all tests have completed
***********************************************************************************************************************************/

View File

@ -18,7 +18,6 @@ void hrnLogReplaceAdd(const char *expression, const char *expressionSub, const c
void hrnLogReplaceClear(void);
void harnessLogResult(const char *expected);
void harnessLogResultRegExp(const char *expression);
/***********************************************************************************************************************************
Getters/Setters

View File

@ -87,7 +87,7 @@ testRun(void)
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_OUT "/%s.ok", strZ(segment))),
BUFSTRDEF("0\nwarning"));
TEST_RESULT_BOOL(archiveAsyncStatus(archiveModePush, segment, false, true), true, "ok file with warning");
harnessLogResult("P00 WARN: warning");
TEST_RESULT_LOG("P00 WARN: warning");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("ignore ok file warning");
@ -101,7 +101,7 @@ testRun(void)
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_OUT "/%s.ok", strZ(segment))),
BUFSTRDEF("25\nerror"));
TEST_RESULT_BOOL(archiveAsyncStatus(archiveModePush, segment, false, true), true, "error status renamed to ok");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: WAL segment '000000010000000100000001' was not pushed due to error [25] and was manually skipped: error");
TEST_RESULT_VOID(
storageRemoveP(

View File

@ -162,7 +162,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "get async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P00 DETAIL: unable to find 000000010000000100000001 in the archive");
@ -176,7 +176,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "get async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P00 WARN: repo1: [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "/archive/test2/10-1"
"/0000000100000001': [13] Permission denied\n"
@ -201,7 +201,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "get async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P01 WARN: [FileReadError] raised from local-1 protocol: unable to get 000000010000000100000001:\n"
" repo1: 10-1/0000000100000001/000000010000000100000001-abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.gz"
@ -230,7 +230,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P01 DETAIL: found 000000010000000100000001 in the repo1: 10-1 archive");
@ -256,7 +256,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P01 WARN: repo1: 10-2/0000000100000001/000000010000000100000001-abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.gz"
" [FormatError] unexpected eof in compressed data\n"
@ -293,7 +293,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000100000001\n"
"P01 WARN: repo1: 10-2/0000000100000001/000000010000000100000001-abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.gz"
" [FormatError] unexpected eof in compressed data\n"
@ -345,7 +345,7 @@ testRun(void)
"repo2: [ArchiveMismatchError] unable to retrieve the archive id for database version '10' and system-id" \
" '18072658121562454734'"
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 3 WAL file(s) from archive: 0000000100000001000000FE...000000010000000200000000\n"
"P00 WARN: " TEST_WARN "\n"
"P01 DETAIL: found 0000000100000001000000FE in the repo1: 10-1 archive\n"
@ -386,7 +386,7 @@ testRun(void)
"repo2: [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "2/archive/test2/10-1" \
"/0000000100000002': [13] Permission denied"
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 3 WAL file(s) from archive: 0000000100000001000000FE...000000010000000200000000\n"
"P00 WARN: " TEST_WARN1 "\n"
"P00 WARN: " TEST_WARN2 "\n"
@ -428,7 +428,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000200000000\n"
"P00 WARN: [ArchiveDuplicateError] duplicates found for WAL segment 000000010000000200000000:\n"
" repo1: 10-1/0000000100000002/000000010000000200000000-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
@ -484,7 +484,7 @@ testRun(void)
"repo1: 10-1/0000000100000002/000000010000000200000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz" \
" [FormatError] unexpected eof in compressed data"
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000200000000\n"
"P00 WARN: " TEST_WARN1 "\n"
"P01 WARN: " TEST_WARN2 "\n"
@ -512,7 +512,7 @@ testRun(void)
"repo2: 10-1/0000000100000002/000000010000000200000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz" \
" [FormatError] unexpected eof in compressed data"
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 1 WAL file(s) from archive: 000000010000000200000000\n"
"P00 WARN: " TEST_WARN1 "\n"
"P01 WARN: [FileReadError] raised from local-1 protocol: unable to get 000000010000000200000000:\n"
@ -550,7 +550,7 @@ testRun(void)
cmdArchiveGetAsync(), ExecuteError,
"local-1 process terminated unexpectedly [102]: unable to execute 'pgbackrest-bogus': [2] No such file or directory");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: get 3 WAL file(s) from archive: 0000000100000001000000FE...000000010000000200000000");
TEST_RESULT_STR_Z(
@ -611,7 +611,7 @@ testRun(void)
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
TEST_PATH_REPO "/archive/test1/archive.info.copy':\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/archive/test1/archive.info' for read\n"
@ -632,7 +632,7 @@ testRun(void)
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
TEST_PATH_REPO "/archive/test1/archive.info.copy':\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/archive/test1/archive.info' for read\n"
@ -677,8 +677,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
TEST_RESULT_VOID(
harnessLogResult("P00 INFO: found 000000010000000100000001 in the archive asynchronously"), "check log");
TEST_RESULT_LOG("P00 INFO: found 000000010000000100000001 in the archive asynchronously");
TEST_STORAGE_LIST_EMPTY(storageSpool(), STORAGE_SPOOL_ARCHIVE_IN);
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYXLOG\n", .remove = true);
@ -694,11 +693,9 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
TEST_RESULT_VOID(
harnessLogResult(
"P00 WARN: warning about x\n"
"P00 INFO: found 000000010000000100000001 in the archive asynchronously"),
"check log");
TEST_RESULT_LOG(
"P00 WARN: warning about x\n"
"P00 INFO: found 000000010000000100000001 in the archive asynchronously");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYXLOG\n", .remove = true);
@ -783,7 +780,7 @@ testRun(void)
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [ArchiveMismatchError] unable to retrieve the archive id for database version '11' and system-id"
" '18072658121562454734'");
@ -796,7 +793,7 @@ testRun(void)
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [ArchiveMismatchError] unable to retrieve the archive id for database version '10' and system-id"
" '9838263505978427528'");
@ -809,7 +806,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 1, "get");
harnessLogResult("P00 INFO: unable to find 01ABCDEF01ABCDEF01ABCDEF in the archive");
TEST_RESULT_LOG("P00 INFO: unable to find 01ABCDEF01ABCDEF01ABCDEF in the archive");
TEST_STORAGE_LIST_EMPTY(storageTest, TEST_PATH_PG "/pg_wal");
@ -826,7 +823,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-1 archive");
TEST_RESULT_LOG("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-1 archive");
TEST_RESULT_UINT(
storageInfoP(storageTest, STRDEF(TEST_PATH_PG "/pg_wal/RECOVERYXLOG")).size, 16 * 1024 * 1024, "check size");
@ -865,7 +862,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-1 archive");
TEST_RESULT_LOG("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-1 archive");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYXLOG\n", .remove = true);
@ -877,7 +874,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-4 archive");
TEST_RESULT_LOG("P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo1: 10-4 archive");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYXLOG\n", .remove = true);
TEST_STORAGE_REMOVE(
@ -904,7 +901,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult("P00 INFO: found 000000010000000100000001.partial in the repo1: 10-4 archive");
TEST_RESULT_LOG("P00 INFO: found 000000010000000100000001.partial in the repo1: 10-4 archive");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYXLOG\n", .remove = true);
TEST_STORAGE_REMOVE(
@ -921,7 +918,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 1, "get");
harnessLogResult("P00 INFO: unable to find 00000001.history in the archive");
TEST_RESULT_LOG("P00 INFO: unable to find 00000001.history in the archive");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", NULL);
@ -932,7 +929,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult("P00 INFO: found 00000001.history in the repo1: 10-1 archive");
TEST_RESULT_LOG("P00 INFO: found 00000001.history in the repo1: 10-1 archive");
TEST_RESULT_UINT(storageInfoP(storageTest, STRDEF(TEST_PATH_PG "/pg_wal/RECOVERYHISTORY")).size, 7, "check size");
TEST_STORAGE_LIST(storageTest, TEST_PATH_PG "/pg_wal", "RECOVERYHISTORY\n", .remove = true);
@ -971,7 +968,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "-bogus/archive/test1/archive.info'"
" or '" TEST_PATH_REPO "-bogus/archive/test1/archive.info.copy':\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "-bogus/archive/test1/archive.info'"
@ -1004,7 +1001,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "-bogus/archive/test1/10-2"
"/01ABCDEF01ABCDEF': [13] Permission denied\n"
"P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo2: 10-1 archive");
@ -1018,7 +1015,7 @@ testRun(void)
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "-bogus/archive/test1/10-2"
"/01ABCDEF01ABCDEF': [13] Permission denied\n"
"P00 WARN: repo2: [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "/archive/test1/10-1"
@ -1036,7 +1033,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: 10-2/01ABCDEF01ABCDEF/01ABCDEF01ABCDEF01ABCDEF-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz"
" [FormatError] unexpected eof in compressed data\n"
"P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo2: 10-1 archive");
@ -1071,7 +1068,7 @@ testRun(void)
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: found 01ABCDEF01ABCDEF01ABCDEF in the repo2: 10-1 archive");
// -------------------------------------------------------------------------------------------------------------------------
@ -1138,7 +1135,7 @@ testRun(void)
TEST_RESULT_VOID(cmdArchiveGet(), "get async");
harnessLogResult("P00 INFO: unable to find 000000010000000100000001 in the archive asynchronously");
TEST_RESULT_LOG("P00 INFO: unable to find 000000010000000100000001 in the archive asynchronously");
// Check that the ok file is missing since it should have been removed on the first loop and removed again on a subsequent
// loop once the async process discovered that the file was missing and wrote the ok file again.

View File

@ -346,7 +346,7 @@ testRun(void)
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
TEST_RESULT_BOOL(
storageExistsP(
@ -374,7 +374,7 @@ testRun(void)
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_wal/000000010000000100000001")), walBuffer1);
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
TEST_RESULT_BOOL(
storageExistsP(
@ -382,7 +382,7 @@ testRun(void)
true, "check repo for WAL file");
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment again");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: WAL file '000000010000000100000001' already exists in the repo1 archive with the same checksum\n"
" HINT: this is valid in some recovery scenarios but may also indicate a problem.\n"
"P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
@ -423,7 +423,7 @@ testRun(void)
"write WAL tmp file");
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
TEST_RESULT_BOOL(
storageExistsP(
@ -444,7 +444,7 @@ testRun(void)
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_wal/00000001.history")), BUFSTRDEF("FAKEHISTORY"));
TEST_RESULT_VOID(cmdArchivePush(), "push a history file");
harnessLogResult("P00 INFO: pushed WAL file '00000001.history' to the archive");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '00000001.history' to the archive");
TEST_RESULT_BOOL(
storageExistsP(storageTest, STRDEF("repo/archive/test/11-1/00000001.history")), true, "check repo for history file");
@ -460,7 +460,7 @@ testRun(void)
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
TEST_RESULT_VOID(cmdArchivePush(), "drop WAL file");
harnessLogResult("P00 WARN: dropped WAL file '000000010000000100000002' because archive queue exceeded 16MB");
TEST_RESULT_LOG("P00 WARN: dropped WAL file '000000010000000100000002' because archive queue exceeded 16MB");
argListTemp = strLstDup(argList);
strLstAddZ(argListTemp, "--archive-push-queue-max=1GB");
@ -468,7 +468,7 @@ testRun(void)
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
TEST_RESULT_VOID(cmdArchivePush(), "push WAL file again");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: WAL file '000000010000000100000002' already exists in the repo1 archive with the same checksum\n"
" HINT: this is valid in some recovery scenarios but may also indicate a problem.\n"
"P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
@ -548,7 +548,7 @@ testRun(void)
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
TEST_RESULT_BOOL(
storageExistsP(
@ -595,7 +595,7 @@ testRun(void)
TEST_TITLE("push WAL to one repo");
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: WAL file '000000010000000100000002' already exists in the repo3 archive with the same checksum\n"
" HINT: this is valid in some recovery scenarios but may also indicate a problem.\n"
"P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
@ -609,7 +609,7 @@ testRun(void)
TEST_TITLE("WAL already exists in both repos");
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: WAL file '000000010000000100000002' already exists in the repo2 archive with the same checksum\n"
" HINT: this is valid in some recovery scenarios but may also indicate a problem.\n"
"P00 WARN: WAL file '000000010000000100000002' already exists in the repo3 archive with the same checksum\n"
@ -822,7 +822,7 @@ testRun(void)
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_xlog/000000010000000100000001")), walBuffer1);
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000001' to the archive asynchronously");
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive asynchronously");
TEST_RESULT_BOOL(
storageExistsP(
@ -933,7 +933,7 @@ testRun(void)
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListTemp);
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: push 1 WAL file(s) to archive: 000000010000000100000002\n"
"P01 DETAIL: pushed WAL file '000000010000000100000002' to the archive");
@ -957,7 +957,7 @@ testRun(void)
storageRemoveP(storageSpoolWrite(), STRDEF(STORAGE_SPOOL_ARCHIVE_OUT "/000000010000000100000002.ok"));
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: push 1 WAL file(s) to archive: 000000010000000100000002\n"
"P01 WARN: WAL file '000000010000000100000002' already exists in the repo1 archive with the same checksum\n"
" HINT: this is valid in some recovery scenarios but may also indicate a problem.\n"
@ -981,7 +981,7 @@ testRun(void)
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_xlog/archive_status/000000010000000100000003.ready")), NULL);
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segment");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: push 1 WAL file(s) to archive: 000000010000000100000003\n"
"P01 DETAIL: pushed WAL file '000000010000000100000003' to the archive");
@ -1008,7 +1008,7 @@ testRun(void)
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListTemp);
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: push 2 WAL file(s) to archive: 000000010000000100000001...000000010000000100000002\n"
"P00 WARN: dropped WAL file '000000010000000100000001' because archive queue exceeded 16MB\n"
"P00 WARN: dropped WAL file '000000010000000100000002' because archive queue exceeded 16MB");

View File

@ -1370,7 +1370,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaCreate, argList);
cmdStanzaCreate();
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error when pg appears to be running");
@ -1514,7 +1514,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaCreate, argList);
cmdStanzaCreate();
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo2");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo2");
// Set log level to warn
harnessLogLevelReset();
@ -1622,7 +1622,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaCreate, argList);
cmdStanzaCreate();
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
// Load options
argList = strLstNew();
@ -2090,7 +2090,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
cmdStanzaUpgrade();
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
// Load options
argList = strLstNew();
@ -2239,7 +2239,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
cmdStanzaUpgrade();
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
// Load options
argList = strLstNew();

View File

@ -59,7 +59,7 @@ testRun(void)
});
TEST_ERROR(cmdCheck(), ConfigError, "no database found\nHINT: check indexed pg-path/pg-host configurations");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432': error");
// Standby only, repo local
@ -139,9 +139,7 @@ testRun(void)
TEST_ERROR_FMT(
cmdCheck(), FileMissingError, "unable to open missing file '%s' for read",
strZ(strNewFmt("%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, strZ(pg1Path))));
harnessLogResult(
strZ(strNewFmt("P00 WARN: option '%s' is enabled but standby is not properly configured",
cfgOptionName(cfgOptBackupStandby))));
TEST_RESULT_LOG("P00 WARN: option '" CFGOPT_BACKUP_STANDBY "' is enabled but standby is not properly configured");
// Standby and primary database
// -------------------------------------------------------------------------------------------------------------------------
@ -226,7 +224,7 @@ testRun(void)
// Error on primary but standby check ok
TEST_ERROR(cmdCheck(), ArchiveDisabledError, "archive_mode must be enabled");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: check repo1 (standby)\n"
"P00 INFO: switch wal not performed because this is a standby");
@ -258,7 +256,9 @@ testRun(void)
"HINT: has a stanza-create been performed?\n"
"HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.",
TEST_PATH "/repo2/archive/test1/archive.info", TEST_PATH "/repo2/archive/test1/archive.info.copy");
harnessLogResult("P00 INFO: check repo1 (standby)\nP00 INFO: check repo2 (standby)");
TEST_RESULT_LOG(
"P00 INFO: check repo1 (standby)\n"
"P00 INFO: check repo2 (standby)");
// Single primary
// -------------------------------------------------------------------------------------------------------------------------
@ -291,7 +291,7 @@ testRun(void)
"HINT: check the archive_command to ensure that all options are correct (especially --stanza).\n"
"HINT: check the PostgreSQL server log for errors.\n"
"HINT: run the 'start' command if the stanza was previously stopped.");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: check repo1 configuration (primary)\n"
"P00 INFO: check repo2 configuration (primary)\n"
"P00 INFO: check repo1 archive for WAL (primary)");
@ -324,18 +324,15 @@ testRun(void)
buffer);
TEST_RESULT_VOID(cmdCheck(), "check primary, WAL archived");
harnessLogResult(
strZ(
strNewFmt(
"P00 INFO: check repo1 configuration (primary)\n"
"P00 INFO: check repo2 configuration (primary)\n"
"P00 INFO: check repo1 archive for WAL (primary)\n"
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '%s/repo/archive/test1/9.2-1/"
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo1\n"
"P00 INFO: check repo2 archive for WAL (primary)\n"
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '%s/repo2/archive/test1/9.2-1/"
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo2",
TEST_PATH, TEST_PATH)));
TEST_RESULT_LOG(
"P00 INFO: check repo1 configuration (primary)\n"
"P00 INFO: check repo2 configuration (primary)\n"
"P00 INFO: check repo1 archive for WAL (primary)\n"
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo/archive/test1/9.2-1/"
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo1\n"
"P00 INFO: check repo2 archive for WAL (primary)\n"
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo2/archive/test1/9.2-1/"
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo2");
// Primary == NULL (for test coverage)
// -------------------------------------------------------------------------------------------------------------------------
@ -551,7 +548,7 @@ testRun(void)
// Create info files
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - encryption");
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
// Version mismatch
TEST_ERROR(

View File

@ -36,7 +36,7 @@ testRun(void)
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameter");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": [param1] --archive-async --archive-timeout=10"
" --exec-id=1-test --pg1-path=/pg1 --stanza=test");
@ -54,7 +54,7 @@ testRun(void)
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameters");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": [param1, \"param 2\"] --archive-async --exec-id=1-test"
" --pg1-path=/pg1 --stanza=test");
@ -85,7 +85,7 @@ testRun(void)
" --recovery-option=standby_mode=on --recovery-option=primary_conninfo=blah --repo1-cipher-pass=<redacted>" \
" --repo1-cipher-type=aes-256-cbc --reset-repo1-host --repo1-path=\"/path/to the/repo\" --stanza=test"
harnessLogResult("P00 INFO: restore command begin " PROJECT_VERSION ":" RESULT_OPTION);
TEST_RESULT_LOG("P00 INFO: restore command begin " PROJECT_VERSION ":" RESULT_OPTION);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check options in cache");
@ -108,7 +108,7 @@ testRun(void)
TEST_TITLE("command end with error");
TEST_RESULT_VOID(cmdEnd(25, STRDEF("aborted with exception [025]")), "command end");
harnessLogResult("P00 INFO: restore command end: aborted with exception [025]");
TEST_RESULT_LOG("P00 INFO: restore command end: aborted with exception [025]");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("command end with time");
@ -137,7 +137,7 @@ testRun(void)
cfgCommandSet(cfgCmdArchiveGet, cfgCmdRoleMain);
TEST_RESULT_VOID(cmdBegin(), "command begin");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": --no-config --exec-id=1-test --log-timestamp"
" --pg1-path=/pg1 --pg2-path=/pg2 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --reset-repo1-host"
" --repo1-path=\"/path/to the/repo\" --stanza=test");

View File

@ -39,7 +39,7 @@ testRun(void)
TEST_RESULT_VOID(lockStopTest(), "no stop files without stanza");
TEST_RESULT_VOID(cmdStart(), " cmdStart - no stanza, no stop files");
harnessLogResult("P00 WARN: stop file does not exist");
TEST_RESULT_LOG("P00 WARN: stop file does not exist");
TEST_RESULT_VOID(storagePutP(storageNewWriteP(hrnStorage, STRDEF("lock/all" STOP_FILE_EXT)), NULL), "create stop file");
TEST_RESULT_VOID(cmdStart(), " cmdStart - no stanza, stop file exists");
@ -52,7 +52,7 @@ testRun(void)
TEST_RESULT_VOID(lockStopTest(), "no stop files with stanza");
TEST_RESULT_VOID(cmdStart(), " cmdStart - stanza, no stop files");
harnessLogResult("P00 WARN: stop file does not exist for stanza db");
TEST_RESULT_LOG("P00 WARN: stop file does not exist for stanza db");
storagePutP(storageNewWriteP(hrnStorage, STRDEF("lock/all" STOP_FILE_EXT)), NULL);
TEST_ERROR(lockStopTest(), StopError, "stop file exists for all stanzas");
@ -83,7 +83,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_VOID(cmdStop(), "no stanza, stop file already exists");
harnessLogResult("P00 WARN: stop file already exists for all stanzas");
TEST_RESULT_LOG("P00 WARN: stop file already exists for all stanzas");
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_VOID(storageRemoveP(hrnStorage, STRDEF("lockpath/all" STOP_FILE_EXT)), "remove stop file");
@ -109,7 +109,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_VOID(cmdStop(), "stanza, stop file already exists");
harnessLogResult("P00 WARN: stop file already exists for stanza db");
TEST_RESULT_LOG("P00 WARN: stop file already exists for stanza db");
TEST_RESULT_VOID(storageRemoveP(hrnStorage, stanzaStopFile), " remove stop file");
// -------------------------------------------------------------------------------------------------------------------------
@ -123,7 +123,7 @@ testRun(void)
storagePutP(storageNewWriteP(hrnStorage, strNewFmt("%s/bad" LOCK_FILE_EXT, strZ(lockPath)), .modeFile = 0222), NULL),
"create a lock file that cannot be opened");
TEST_RESULT_VOID(cmdStop(), " stanza, create stop file but unable to open lock file");
harnessLogResult(strZ(strNewFmt("P00 WARN: unable to open lock file %s/bad" LOCK_FILE_EXT, strZ(lockPath))));
TEST_RESULT_LOG_FMT("P00 WARN: unable to open lock file %s/bad" LOCK_FILE_EXT, strZ(lockPath));
TEST_RESULT_VOID(
storagePathRemoveP(hrnStorage, lockPath, .recurse = true, .errorOnMissing = true), " remove the lock path");
@ -289,7 +289,7 @@ testRun(void)
cmdStop(),
" stanza, create stop file, force - lock file with another process lock, processId is valid");
harnessLogResult(strZ(strNewFmt("P00 INFO: sent term signal to process %d", HARNESS_FORK_PROCESS_ID(0))));
TEST_RESULT_LOG_FMT("P00 INFO: sent term signal to process %d", HARNESS_FORK_PROCESS_ID(0));
}
HARNESS_FORK_PARENT_END();
}
@ -340,7 +340,7 @@ testRun(void)
TEST_RESULT_VOID(
cmdStop(), " stanza, create stop file, force - lock file with another process lock, processId is invalid");
harnessLogResult("P00 WARN: unable to send term signal to process -32768");
TEST_RESULT_LOG("P00 WARN: unable to send term signal to process -32768");
TEST_RESULT_BOOL(storageExistsP(hrnStorage, stanzaStopFile), true, " stanza stop file not removed");
// Notify the child to release the lock

View File

@ -219,11 +219,11 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 0, "retention-full not set");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
" maximum.");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-full set - full backup no dependencies expired");
@ -238,7 +238,7 @@ testRun(void)
"20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n20181119-152900F\n"
"20181119-152900F_20181119-152600D\n",
"remaining backups correct");
harnessLogResult("P00 INFO: repo1: expire full backup 20181119-152138F");
TEST_RESULT_LOG("P00 INFO: repo1: expire full backup 20181119-152138F");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-full set - full backup with dependencies expired");
@ -252,9 +252,9 @@ testRun(void)
TEST_RESULT_STRLST_Z(
infoBackupDataLabelList(infoBackup, NULL), "20181119-152900F\n20181119-152900F_20181119-152600D\n",
"remaining backups correct");
harnessLogResult(
"P00 INFO: repo1: expire full backup set 20181119-152800F, 20181119-152800F_20181119-152152D, "
"20181119-152800F_20181119-152155I");
TEST_RESULT_LOG(
"P00 INFO: repo1: expire full backup set 20181119-152800F, 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-full set - no backups expired");
@ -305,7 +305,7 @@ testRun(void)
infoBackupDataLabelList(infoBackup, NULL),
"20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n",
"remaining backups correct");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire diff backup set 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 0, "retention-diff=2 but no more to expire");
@ -322,7 +322,7 @@ testRun(void)
infoBackupDataLabelList(infoBackup, NULL),
"20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n",
" remaining backups correct");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire diff backup set 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
//--------------------------------------------------------------------------------------------------------------------------
@ -381,8 +381,7 @@ testRun(void)
TEST_RESULT_STRLST_Z(
infoBackupDataLabelList(infoBackup, NULL), "20181119-152800F\n20181119-152800F_20181119-152155D\n",
"remaining backups correct");
harnessLogResult(
"P00 INFO: repo1: expire diff backup 20181119-152800F_20181119-152152D");
TEST_RESULT_LOG("P00 INFO: repo1: expire diff backup 20181119-152800F_20181119-152152D");
}
// *****************************************************************************************************************************
@ -445,7 +444,7 @@ testRun(void)
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL, 0), "remove backups not in backup.info current");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: remove expired backup 20181119-152100F_20181119-152152D\n"
"P00 INFO: repo1: remove expired backup 20181119-152100F");
@ -476,7 +475,7 @@ testRun(void)
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL, 0), "remove backups - backup.info current empty");
harnessLogResult("P00 INFO: repo1: remove expired backup 20181119-152138F");
TEST_RESULT_LOG("P00 INFO: repo1: remove expired backup 20181119-152138F");
TEST_RESULT_STRLST_Z(
strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc),
"20181118-152100F_20181119-152152D.save\nbackup.info\nbogus\n", "remaining file/directories correct");
@ -537,15 +536,15 @@ testRun(void)
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoContent)), "get backup.info");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false, 0), "archive retention not set");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
" maximum.\n"
"P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired");
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, true, 0), "archive retention not set - retention-full-type=time");
harnessLogResult("P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired");
TEST_RESULT_LOG("P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-archive set - no current backups");
@ -556,11 +555,11 @@ testRun(void)
TEST_RESULT_VOID(
removeExpiredArchive(infoBackup, false, 0), "archive retention set, retention type default, no current backups");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
" maximum.");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("retention-archive set - no archive on disk");
@ -845,7 +844,7 @@ testRun(void)
TEST_RESULT_BOOL(
storageExistsP(storageTest, strNewFmt("%s/20181119-152138F/" BACKUP_MANIFEST_FILE, strZ(backupStanzaPath))), true,
"backup not removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: [DRY-RUN] repo1: expire full backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F");
@ -889,7 +888,7 @@ testRun(void)
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info repo1");
TEST_RESULT_BOOL(strLstExists(infoBackupDataLabelList(infoBackup, NULL), backupLabel), true, "backup exists repo1");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo2: expire full backup 20181119-152138F\n"
"P00 INFO: repo2: remove expired backup 20181119-152138F");
@ -904,7 +903,7 @@ testRun(void)
TEST_RESULT_BOOL(
storagePathExistsP(storageTest, strNewFmt("%s/%s", strZ(archiveStanzaPath), "9.4-1/0000000100000000")), false,
"archive sub path removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire full backup 20181119-152138F\n"
"P00 INFO: repo1: remove expired backup 20181119-152138F");
@ -947,30 +946,28 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 2 error(s), check the log file for details");
harnessLogResult(
strZ(strNewFmt(
"P00 ERROR: [055]: [DRY-RUN] repo1: unable to load info file '%s/%s' or '%s/%s':\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
"P00 INFO: [DRY-RUN] repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
TEST_RESULT_LOG_FMT(
"P00 ERROR: [055]: [DRY-RUN] repo1: unable to load info file '" TEST_PATH "/%s' or '" TEST_PATH "/%s':\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
"P00 INFO: [DRY-RUN] repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 ERROR: [055]: [DRY-RUN] repo2: unable to load info file '%s/%s' or '%s/%s':\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
" HINT: is archive_command configured correctly in postgresql.conf?\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use --no-archive-check to disable archive checks during backup if you have an alternate"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 ERROR: [055]: [DRY-RUN] repo2: unable to load info file '" TEST_PATH "/%s' or '" TEST_PATH "/%s':\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
" HINT: is archive_command configured correctly in postgresql.conf?\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use --no-archive-check to disable archive checks during backup if you have an alternate"
" archiving scheme.",
TEST_PATH, strZ(backupInfoFileName), TEST_PATH, strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))),
TEST_PATH, strZ(backupInfoFileName), TEST_PATH, strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))),
TEST_PATH, strZ(archiveInfoFileNameRepo2), TEST_PATH,
strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileNameRepo2))), TEST_PATH, strZ(archiveInfoFileNameRepo2),
TEST_PATH, strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileNameRepo2))))));
strZ(backupInfoFileName), strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))), strZ(backupInfoFileName),
strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))), strZ(archiveInfoFileNameRepo2),
strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileNameRepo2))), strZ(archiveInfoFileNameRepo2),
strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileNameRepo2))));
// Restore saved archive.info file
TEST_RESULT_VOID(
@ -984,27 +981,26 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
strZ(strNewFmt(
"P00 ERROR: [055]: [DRY-RUN] repo1: unable to load info file '%s/%s' or '%s/%s':\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" FileMissingError: unable to open missing file '%s/%s' for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
"P00 INFO: [DRY-RUN] repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
TEST_RESULT_LOG_FMT(
"P00 ERROR: [055]: [DRY-RUN] repo1: unable to load info file '" TEST_PATH "/%s' or '" TEST_PATH "/%s':\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH "/%s' for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
"P00 INFO: [DRY-RUN] repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002,"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002,"
" stop = 000000020000000000000002\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F_20181119-152252D,"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F_20181119-152252D,"
" start = 000000020000000000000009\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 remove archive, start = 000000020000000000000004,"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 remove archive, start = 000000020000000000000004,"
" stop = 000000020000000000000007\n"
"P00 DETAIL: [DRY-RUN] repo2: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo2: 10-2 no archive to remove",
TEST_PATH, strZ(backupInfoFileName), TEST_PATH, strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))),
TEST_PATH, strZ(backupInfoFileName), TEST_PATH, strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))))));
"P00 DETAIL: [DRY-RUN] repo2: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo2: 10-2 no archive to remove",
strZ(backupInfoFileName), strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))), strZ(backupInfoFileName),
strZ(strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName))));
// Restore saved backup.info files
TEST_RESULT_VOID(
@ -1035,28 +1031,29 @@ testRun(void)
storageTest, strNewFmt("%s/20181119-152800F_20181119-152252D/" BACKUP_MANIFEST_FILE, strZ(backupStanzaPath)))),
true, "backup not removed");
harnessLogResult(strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 INFO: [DRY-RUN] repo1: expire full backup set 20181119-152800F, 20181119-152800F_20181119-152152D, "
"20181119-152800F_20181119-152155I, 20181119-152800F_20181119-152252D\n"
"20181119-152800F_20181119-152155I, 20181119-152800F_20181119-152252D\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152800F_20181119-152252D\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152800F\n"
"P00 INFO: [DRY-RUN] repo1: remove archive path %s/%s/9.4-1\n"
"P00 INFO: [DRY-RUN] repo1: remove archive path " TEST_PATH "/%s/9.4-1\n"
"P00 DETAIL: [DRY-RUN] repo1: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo1: 10-2 no archive to remove\n"
"P00 INFO: [DRY-RUN] repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: [DRY-RUN] repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002,"
" stop = 000000020000000000000002\n"
" stop = 000000020000000000000002\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 archive retention on backup 20181119-152800F_20181119-152252D,"
" start = 000000020000000000000009\n"
" start = 000000020000000000000009\n"
"P00 DETAIL: [DRY-RUN] repo2: 9.4-1 remove archive, start = 000000020000000000000004,"
" stop = 000000020000000000000007\n"
" stop = 000000020000000000000007\n"
"P00 DETAIL: [DRY-RUN] repo2: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo2: 10-2 no archive to remove", TEST_PATH, strZ(archiveStanzaPath))));
"P00 DETAIL: [DRY-RUN] repo2: 10-2 no archive to remove",
strZ(archiveStanzaPath));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("expire command - multi-repo, archive and backups removed");
@ -1069,27 +1066,28 @@ testRun(void)
storagePathExistsP(storageTest, strNewFmt("%s/%s", strZ(archiveStanzaPath), "9.4-1")),
false, "archive path removed");
harnessLogResult(strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 INFO: repo1: expire full backup set 20181119-152800F, 20181119-152800F_20181119-152152D, "
"20181119-152800F_20181119-152155I, 20181119-152800F_20181119-152252D\n"
"20181119-152800F_20181119-152155I, 20181119-152800F_20181119-152252D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152252D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F\n"
"P00 INFO: repo1: remove archive path %s/%s/9.4-1\n"
"P00 INFO: repo1: remove archive path " TEST_PATH "/%s/9.4-1\n"
"P00 DETAIL: repo1: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: repo1: 10-2 no archive to remove\n"
"P00 INFO: repo2: expire diff backup set 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo2: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo2: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 DETAIL: repo2: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002,"
" stop = 000000020000000000000002\n"
" stop = 000000020000000000000002\n"
"P00 DETAIL: repo2: 9.4-1 archive retention on backup 20181119-152800F_20181119-152252D,"
" start = 000000020000000000000009\n"
" start = 000000020000000000000009\n"
"P00 DETAIL: repo2: 9.4-1 remove archive, start = 000000020000000000000004, stop = 000000020000000000000007\n"
"P00 DETAIL: repo2: 10-2 archive retention on backup 20181119-152900F, start = 000000010000000000000003\n"
"P00 DETAIL: repo2: 10-2 no archive to remove", TEST_PATH, strZ(archiveStanzaPath))));
"P00 DETAIL: repo2: 10-2 no archive to remove",
strZ(archiveStanzaPath));
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "backup.info updated on disk");
@ -1108,7 +1106,7 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList2);
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on any repo");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup 20201119-123456F_20201119-234567I does not exist\n"
" HINT: run the info command and confirm the backup is listed");
@ -1117,7 +1115,7 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList2);
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on requested repo");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup 20201119-123456F_20201119-234567I does not exist\n"
" HINT: run the info command and confirm the backup is listed");
@ -1128,11 +1126,11 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "label format OK and expired on specified repo");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: [DRY-RUN] repo1: expiring latest backup 20181119-152900F_20181119-152500I - the ability to perform"
" point-in-time-recovery (PITR) may be affected\n"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type' (even in prior"
" expires) can cause gaps in the WAL.\n"
" expires) can cause gaps in the WAL.\n"
"P00 INFO: [DRY-RUN] repo1: expire adhoc backup 20181119-152900F_20181119-152500I\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152900F_20181119-152500I");
@ -1153,8 +1151,7 @@ testRun(void)
harnessCfgLoad(cfgCmdBackup, argList);
TEST_RESULT_VOID(cmdExpire(), "expire remove archive path");
harnessLogResult(
strZ(strNewFmt("P00 INFO: repo1: remove archive path %s/%s/9.4-1", TEST_PATH, strZ(archiveStanzaPath))));
TEST_RESULT_LOG_FMT("P00 INFO: repo1: remove archive path " TEST_PATH "/%s/9.4-1", strZ(archiveStanzaPath));
//--------------------------------------------------------------------------------------------------------------------------
storagePutP(storageNewWriteP(storageTest, backupInfoFileName),
@ -1227,9 +1224,9 @@ testRun(void)
TEST_RESULT_VOID(
removeExpiredArchive(infoBackup, false, 0), "backup earlier than selected for retention does not have archive-start");
harnessLogResult(
TEST_RESULT_LOG(
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152138F, start = 000000010000000000000002,"
" stop = 000000010000000000000002\n"
" stop = 000000010000000000000002\n"
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152900F, start = 000000010000000000000004\n"
"P00 DETAIL: repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000001\n"
"P00 DETAIL: repo1: 9.4-1 remove archive, start = 000000010000000000000003, stop = 000000010000000000000003");
@ -1317,7 +1314,7 @@ testRun(void)
storageExistsP(storageTest, strNewFmt("%s/10-2/00000002.history", strZ(archiveStanzaPath))), true,
"history file not removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152138F, start = 000000010000000000000002\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 no archive to remove\n"
"P00 DETAIL: [DRY-RUN] repo1: 10-2 archive retention on backup 20181119-152900F, start = 000000030000000000000006\n"
@ -1340,7 +1337,7 @@ testRun(void)
storageExistsP(storageTest, strNewFmt("%s/10-2/00000003.history", strZ(archiveStanzaPath))), true,
"00000003.history file not removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152138F, start = 000000010000000000000002\n"
"P00 DETAIL: repo1: 9.4-1 no archive to remove\n"
"P00 DETAIL: repo1: 10-2 archive retention on backup 20181119-152900F, start = 000000030000000000000006\n"
@ -1367,7 +1364,7 @@ testRun(void)
storageExistsP(storageTest, strNewFmt("%s/10-2/00000003.history", strZ(archiveStanzaPath))), true,
"00000003.history file not removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152138F, start = 000000010000000000000002\n"
"P00 DETAIL: repo1: 9.4-1 no archive to remove\n"
"P00 DETAIL: repo1: 10-2 archive retention on backup 20181119-152900F, start = 000000030000000000000006\n"
@ -1459,11 +1456,10 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire full backup 20181119-152138F\n"
"P00 INFO: repo1: remove expired backup 20181119-152138F\n"
"P00 ERROR: [029]: repo1: archive expiration cannot continue - archive and backup history lists do not"
" match");
"P00 ERROR: [029]: repo1: archive expiration cannot continue - archive and backup history lists do not match");
TEST_RESULT_STRLST_STR(
strLstSort(storageListP(
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc),
@ -1490,7 +1486,7 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [029]: repo1: archive expiration cannot continue - archive and backup history lists do not match");
//--------------------------------------------------------------------------------------------------------------------------
@ -1510,7 +1506,7 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [029]: repo1: archive expiration cannot continue - archive and backup history lists do not match");
//--------------------------------------------------------------------------------------------------------------------------
@ -1589,7 +1585,7 @@ testRun(void)
// here we are testing that things on disk that we are not aware of are not touched.
TEST_RESULT_VOID(cmdExpire(), "Expire archive that archive.info is aware of");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire full backup 20181119-152138F\n"
"P00 INFO: repo1: expire full backup 20181119-152800F\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F\n"
@ -1816,16 +1812,16 @@ testRun(void)
true, "only adhoc and dependents removed - resumable and all other backups remain");
TEST_RESULT_STR(storageInfoP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")).linkDestination,
STRDEF("20181119-152900F"), "latest link not updated");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire adhoc backup set 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152138F, start = 000000020000000000000001,"
" stop = 000000020000000000000001\n"
" stop = 000000020000000000000001\n"
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002\n"
"P00 DETAIL: repo1: 9.4-1 no archive to remove\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152850F, start = 000000010000000000000002,"
" stop = 000000010000000000000004\n"
" stop = 000000010000000000000004\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152900F, start = 000000010000000000000006\n"
"P00 DETAIL: repo1: 12-2 remove archive, start = 000000010000000000000001, stop = 000000010000000000000001\n"
"P00 DETAIL: repo1: 12-2 remove archive, start = 000000010000000000000005, stop = 000000010000000000000005");
@ -1852,13 +1848,13 @@ testRun(void)
strZ(backupStanzaPath))) &&
!storageExistsP(storageTest, strNewFmt("%s/20181119-152138F/" BACKUP_MANIFEST_FILE, strZ(backupStanzaPath)))),
true, "only adhoc full removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire adhoc backup 20181119-152138F\n"
"P00 INFO: repo1: remove expired backup 20181119-152138F\n"
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000020000000000000002\n"
"P00 DETAIL: repo1: 9.4-1 remove archive, start = 000000020000000000000001, stop = 000000020000000000000001\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152850F, start = 000000010000000000000002,"
" stop = 000000010000000000000004\n"
" stop = 000000010000000000000004\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152900F, start = 000000010000000000000006\n"
"P00 DETAIL: repo1: 12-2 no archive to remove");
@ -1886,11 +1882,11 @@ testRun(void)
storageTest, strNewFmt("%s/20181119-152900F_20181119-153000I/" BACKUP_MANIFEST_FILE INFO_COPY_EXT,
strZ(backupStanzaPath)))),
true, "latest and resumable removed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: expiring latest backup 20181119-152900F - the ability to perform point-in-time-recovery (PITR) may"
" be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type'"
" (even in prior expires) can cause gaps in the WAL.\n"
" be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type' (even in prior"
" expires) can cause gaps in the WAL.\n"
"P00 INFO: repo1: expire adhoc backup 20181119-152900F\n"
"P00 INFO: repo1: remove expired backup 20181119-152900F_20181119-153000I\n"
"P00 INFO: repo1: remove expired backup 20181119-152900F\n"
@ -1915,9 +1911,9 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [075]: repo1: full backup 20181119-152850F cannot be expired until another full backup has been created on"
" this repo");
" this repo");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("allow adhoc expire on last full backup in prior db-id");
@ -1934,14 +1930,13 @@ testRun(void)
!storageExistsP(
storageTest, strNewFmt("%s/20181119-152800F_20181119-152252D/" BACKUP_MANIFEST_FILE, strZ(backupStanzaPath)))),
true, "only last prior backup removed");
harnessLogResult(
strZ(strNewFmt(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire adhoc backup set 20181119-152800F, 20181119-152800F_20181119-152252D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152252D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F\n"
"P00 INFO: repo1: remove archive path %s/repo/archive/db/9.4-1\n"
"P00 INFO: repo1: remove archive path " TEST_PATH "/repo/archive/db/9.4-1\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152850F, start = 000000010000000000000002\n"
"P00 DETAIL: repo1: 12-2 no archive to remove", TEST_PATH)));
"P00 DETAIL: repo1: 12-2 no archive to remove");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on expire last full backup on disk");
@ -1952,9 +1947,9 @@ testRun(void)
TEST_ERROR(
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [075]: repo1: full backup 20181119-152850F cannot be expired until another full backup has been created on"
" this repo");
" this repo");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("adhoc dry-run");
@ -2012,11 +2007,11 @@ testRun(void)
TEST_RESULT_UINT(expireAdhocBackup(infoBackup, adhocBackupLabel, 0), 1, "adhoc expire last dependent backup");
TEST_RESULT_VOID(
removeExpiredBackup(infoBackup, adhocBackupLabel, 0), "code coverage: removeExpireBackup with no manifests");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: [DRY-RUN] repo1: expiring latest backup 20181119-152850F_20181119-152252D - the ability to perform"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type'"
" (even in prior expires) can cause gaps in the WAL.\n"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type' (even in prior"
" expires) can cause gaps in the WAL.\n"
"P00 INFO: [DRY-RUN] repo1: expire adhoc backup 20181119-152850F_20181119-152252D\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152850F_20181119-152252D");
@ -2188,19 +2183,19 @@ testRun(void)
FileOpenError, "unable to create symlink '%s' to '%s'", strZ(latestLink), "20181119-152850F_20181200-152252D");
TEST_RESULT_VOID(cmdExpire(), "adhoc expire latest with resumable possibly based on it");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: repo1: expiring latest backup 20181119-152850F_20181119-152252D - the ability to perform"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type'"
" (even in prior expires) can cause gaps in the WAL.\n"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo1-retention-archive'/'repo1-retention-archive-type' (even in prior"
" expires) can cause gaps in the WAL.\n"
"P00 INFO: repo1: expire adhoc backup 20181119-152850F_20181119-152252D\n"
"P00 INFO: repo1: remove expired backup 20181119-152850F_20181119-152252D\n"
"P00 DETAIL: repo1: 12-2 archive retention on backup 20181119-152850F, start = 000000010000000000000002\n"
"P00 DETAIL: repo1: 12-2 no archive to remove\n"
"P00 WARN: repo2: expiring latest backup 20181119-152850F_20181119-152252D - the ability to perform"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo2-retention-archive'/'repo2-retention-archive-type'"
" (even in prior expires) can cause gaps in the WAL.\n"
" point-in-time-recovery (PITR) may be affected\n"
" HINT: non-default settings for 'repo2-retention-archive'/'repo2-retention-archive-type' (even in prior"
" expires) can cause gaps in the WAL.\n"
"P00 INFO: repo2: expire adhoc backup 20181119-152850F_20181119-152252D\n"
"P00 INFO: repo2: remove expired backup 20181119-152850F_20181119-152252D\n"
"P00 DETAIL: repo2: 12-2 archive retention on backup 20181119-152850F, start = 000000010000000000000002\n"
@ -2287,11 +2282,11 @@ testRun(void)
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
TEST_RESULT_VOID(cmdExpire(), "repo-retention-full not set for time-based");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=time', the repository may run out"
" of space\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
" maximum.\n"
"P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired");
// Stop time equals retention time
@ -2317,7 +2312,7 @@ testRun(void)
infoBackupDataLabelList(infoBackup, NULL),
"20181119-152138F\n20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n"
"20181119-152900F\n20181119-152900F_20181119-152600D\n", "no backups expired");
harnessLogResult("P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired");
TEST_RESULT_LOG("P00 INFO: repo1: time-based archive retention not met - archive logs will not be expired");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("oldest backup expired");
@ -2327,7 +2322,7 @@ testRun(void)
strLstAddZ(argList, "--dry-run");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000010000000000000004\n"
@ -2336,7 +2331,7 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive=9999999");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run, retention-archive set to max, no archives expired");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F");
@ -2346,15 +2341,15 @@ testRun(void)
strLstAddZ(argList, "--dry-run");
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired but retention archive set lower - dry-run");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000010000000000000004,"
" stop = 000000010000000000000004\n"
" stop = 000000010000000000000004\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F_20181119-152152D,"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F_20181119-152155I,"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152900F, start = 000000010000000000000009\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000005, stop = 000000010000000000000005\n"
@ -2371,22 +2366,22 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired, retention archive is DIFF - dry-run");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: [DRY-RUN] option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'\n"
" HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff'"
" to the maximum.\n"
" to the maximum.\n"
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
"P00 INFO: [DRY-RUN] repo1: remove expired backup 20181119-152138F\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000010000000000000004,"
" stop = 000000010000000000000004\n"
" stop = 000000010000000000000004\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F_20181119-152152D,"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
" start = 000000010000000000000006, stop = 000000010000000000000006\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152800F_20181119-152155I,"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
" start = 000000010000000000000007, stop = 000000010000000000000007\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152900F, start = 000000010000000000000009,"
" stop = 000000010000000000000009\n"
" stop = 000000010000000000000009\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 archive retention on backup 20181119-152900F_20181119-152600D,"
" start = 000000010000000000000011\n"
" start = 000000010000000000000011\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000003\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000005, stop = 000000010000000000000005\n"
"P00 DETAIL: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000008, stop = 000000010000000000000008\n"
@ -2404,9 +2399,9 @@ testRun(void)
TEST_RESULT_VOID(
infoBackupSaveFile(infoBackup, storageTest, backupInfoFileName, cipherTypeNone, NULL),
"save backup.info without oldest");
harnessLogResult("P00 INFO: repo1: expire time-based backup 20181119-152138F");
TEST_RESULT_LOG("P00 INFO: repo1: expire time-based backup 20181119-152138F");
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: remove expired backup 20181119-152138F\n"
"P00 DETAIL: repo1: 9.4-1 archive retention on backup 20181119-152800F, start = 000000010000000000000004\n"
"P00 DETAIL: repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000003");
@ -2419,9 +2414,9 @@ testRun(void)
harnessCfgLoad(cfgCmdExpire, argList);
TEST_RESULT_VOID(cmdExpire(), "expire all but newest");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: repo1: expire time-based backup set 20181119-152800F, 20181119-152800F_20181119-152152D,"
" 20181119-152800F_20181119-152155I\n"
" 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152155I\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F_20181119-152152D\n"
"P00 INFO: repo1: remove expired backup 20181119-152800F\n"

View File

@ -66,7 +66,7 @@ testRun(void)
hrnPgControlToBuffer((PgControl){.version = PG_VERSION_96, .systemId = 6569239123849665679}));
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - one repo, no files exist");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
const String *contentArchive = STRDEF
(
@ -133,7 +133,7 @@ testRun(void)
harnessCfgLoad(cfgCmdStanzaCreate, argList);
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - files already exist on repo1 and both are valid");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: stanza-create for stanza 'db' on repo1\n"
"P00 INFO: stanza 'db' already exists on repo1 and is valid\n"
"P00 INFO: stanza-create for stanza 'db' on repo2\n"
@ -205,7 +205,7 @@ testRun(void)
"backup.info.copy removed");
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - success with missing files");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: stanza-create for stanza 'db' on repo1\n"
"P00 INFO: stanza-create for stanza 'db' on repo2\n"
"P00 INFO: stanza-create for stanza 'db' on repo3\n"
@ -319,7 +319,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"archive.info exists but backup.info is missing on repo2\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: stanza-create for stanza 'db' on repo1\n"
"P00 INFO: stanza 'db' already exists on repo1 and is valid\n"
"P00 INFO: stanza-create for stanza 'db' on repo2");
@ -334,7 +334,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"backup.info exists but archive.info is missing on repo1\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Delete the last repo so only 1 remains
argListDelete = strLstDup(argListCmd);
@ -363,7 +363,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"backup.info exists but archive.info is missing on repo1\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Archive files removed - backup.info.copy exists
TEST_RESULT_VOID(
@ -375,7 +375,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"backup.info exists but archive.info is missing on repo1\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Backup files removed - archive.info file exists
TEST_RESULT_VOID(
@ -389,7 +389,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"archive.info exists but backup.info is missing on repo1\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Backup files removed - archive.info.copy file exists
TEST_RESULT_VOID(
@ -401,7 +401,7 @@ testRun(void)
cmdStanzaCreate(), FileMissingError,
"archive.info exists but backup.info is missing on repo1\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// checkStanzaInfo() - already checked in checkTest so just a sanity check here
//--------------------------------------------------------------------------------------------------------------------------
@ -430,7 +430,7 @@ testRun(void)
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
"backup : id = 2, version = 9.6, system-id = 6569239123849665679\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
//--------------------------------------------------------------------------------------------------------------------------
// Copy files may or may not exist - remove
@ -476,7 +476,7 @@ testRun(void)
"backup and archive info files exist but do not match the database\n"
"HINT: is this the correct stanza?\n"
"HINT: did an error occur during stanza-upgrade?");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Create archive.info and backup.info files that match but do not match the current database system-id
contentArchive = STRDEF
@ -517,7 +517,7 @@ testRun(void)
"backup and archive info files exist but do not match the database\n"
"HINT: is this the correct stanza?\n"
"HINT: did an error occur during stanza-upgrade?");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Remove the info files and add sub directory to backup
TEST_RESULT_VOID(storageRemoveP(storageTest, archiveInfoFileName, .errorOnMissing = true), "archive.info removed");
@ -527,7 +527,7 @@ testRun(void)
storagePathCreateP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))),
"create directory in backup");
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "backup directory not empty");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// File in archive, directory in backup
TEST_RESULT_VOID(
@ -535,20 +535,20 @@ testRun(void)
storageNewWriteP(storageTest, strNewFmt("%s/somefile", strZ(archiveStanzaPath))), BUFSTRDEF("some content")),
"create file in archive");
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "backup directory and/or archive directory not empty");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// File in archive, backup empty
TEST_RESULT_VOID(
storagePathRemoveP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))), "remove backup subdir");
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
// Repeat last test using --force (deprecated)
//--------------------------------------------------------------------------------------------------------------------------
strLstAddZ(argList, "--force");
harnessCfgLoad(cfgCmdStanzaCreate, argList);
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option --force is no longer supported\n"
"P00 INFO: stanza-create for stanza 'db' on repo1");
}
@ -580,7 +580,7 @@ testRun(void)
});
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - db online");
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
TEST_RESULT_BOOL(
storageExistsP(storageTest, strNewFmt("repo/archive/%s/archive.info", strZ(stanza))), true, " stanza created");
@ -592,7 +592,7 @@ testRun(void)
});
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - db online");
harnessLogResult(
TEST_RESULT_LOG(
"P00 INFO: stanza-upgrade for stanza 'db' on repo1\n"
"P00 INFO: stanza 'db' on repo1 is already up to date");
@ -761,7 +761,7 @@ testRun(void)
"archive: id = 2, version = 9.6, system-id = 6569239123849665679\n"
"backup : id = 1, version = 9.6, system-id = 6569239123849665679\n"
"HINT: this may be a symptom of repository corruption!");
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
// backup info up to date but archive info version is not
//--------------------------------------------------------------------------------------------------------------------------
@ -801,7 +801,7 @@ testRun(void)
"put archive info to file");
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - archive.info file upgraded - version");
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
contentArchive = STRDEF
(
"[db]\n"
@ -847,7 +847,7 @@ testRun(void)
"put backup info to file");
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - backup.info file upgraded - version");
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
contentBackup = STRDEF
(
"[db]\n"
@ -915,7 +915,7 @@ testRun(void)
"put archive info to file");
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - archive.info file upgraded - system-id");
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
contentArchive = STRDEF
(
"[db]\n"
@ -961,7 +961,7 @@ testRun(void)
"put backup info to file");
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - backup.info file upgraded - system-id");
harnessLogResult("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
contentBackup = STRDEF
(
"[db]\n"
@ -1015,7 +1015,7 @@ testRun(void)
hrnPgControlToBuffer((PgControl){.version = PG_VERSION_96, .systemId = 6569239123849665679}));
TEST_RESULT_VOID(cmdStanzaCreate(), "create a stanza that will not be deleted");
harnessLogResult("P00 INFO: stanza-create for stanza 'otherstanza' on repo1");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'otherstanza' on repo1");
argList = strLstDup(argListCmd);
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanza)));

View File

@ -280,12 +280,11 @@ testRun(void)
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, false, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg version mismatch");
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT "' for read\n"
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT "' for read\n"
"P00 ERROR: [028]: '%s' may not be recoverable - PG data (id 1, version 9.2, system-id 6625592122879095702) is not "
"in the backup.info history, skipping",
TEST_PATH, strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel))));
strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("rerun test with db-system-id invalid and no main");
@ -319,13 +318,12 @@ testRun(void)
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, false, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg system-id mismatch");
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
"P00 WARN: %s/backup.manifest is missing or unusable, using copy\n"
"P00 ERROR: [028]: '%s' may not be recoverable - PG data (id 1, version 9.4, system-id 0) is not "
"in the backup.info history, skipping",
TEST_PATH, strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel), strZ(backupLabel))));
strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel), strZ(backupLabel));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("rerun copy test with db-id invalid");
@ -358,13 +356,12 @@ testRun(void)
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, false, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg db-id mismatch");
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
"P00 WARN: %s/backup.manifest is missing or unusable, using copy\n"
"P00 ERROR: [028]: '%s' may not be recoverable - PG data (id 0, version 9.4, system-id 6625592122879095702) is not "
"in the backup.info history, skipping",
TEST_PATH, strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel), strZ(backupLabel))));
strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel), strZ(backupLabel));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("missing main manifest, errored copy");
@ -380,12 +377,11 @@ testRun(void)
storagePutP(storageNewWriteP(storageTest, manifestFileCopy), contentLoad), "write invalid manifest copy");
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, false, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/%s/" BACKUP_MANIFEST_FILE "' for read\n"
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT, TEST_PATH, strZ(backupStanzaPath), strZ(backupLabel),
strZ(backupLabel))));
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT,
strZ(backupStanzaPath), strZ(backupLabel), strZ(backupLabel));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("current backup true");
@ -396,12 +392,12 @@ testRun(void)
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, true, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_PTR(manifest, NULL, "manifest not set");
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
harnessLogResult(
strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE "\n"
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE "\n"
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT, strZ(backupLabel), strZ(backupLabel))));
STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT,
strZ(backupLabel), strZ(backupLabel));
// Write a valid manifest with a manifest copy that is invalid
contentLoad = harnessInfoChecksumZ
@ -426,7 +422,7 @@ testRun(void)
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, true, infoPg, &jobErrorTotal), "verify manifest");
TEST_RESULT_PTR_NE(manifest, NULL, "manifest set");
TEST_RESULT_UINT(backupResult.status, backupValid, "manifest usable");
harnessLogResult(strZ(strNewFmt("P00 WARN: backup '%s' manifest.copy does not match manifest", strZ(backupLabel))));
TEST_RESULT_LOG_FMT("P00 WARN: backup '%s' manifest.copy does not match manifest", strZ(backupLabel));
}
// *****************************************************************************************************************************
@ -474,7 +470,7 @@ testRun(void)
TEST_RESULT_UINT(errTotal, 1, "duplicate WAL error");
TEST_RESULT_UINT(strLstSize(walFileList), 0, "all WAL removed from WAL file list");
TEST_RESULT_UINT(lstSize(archiveIdResult->walRangeList), 0, "no range");
harnessLogResult("P00 ERROR: [028]: duplicate WAL '000000020000000200000000' for '9.4-1' exists, skipping");
TEST_RESULT_LOG("P00 ERROR: [028]: duplicate WAL '000000020000000200000000' for '9.4-1' exists, skipping");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("FF Wal not skipped > 9.2, duplicates at beginning and end of list are removed");
@ -500,7 +496,7 @@ testRun(void)
"get range");
TEST_RESULT_STR_Z(walRangeResult->start, "0000000200000001000000FD", "start range");
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000000", "stop range");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [028]: duplicate WAL '000000020000000100000000' for '9.4-1' exists, skipping\n"
"P00 ERROR: [028]: duplicate WAL '000000020000000200000001' for '9.4-1' exists, skipping");
@ -531,7 +527,7 @@ testRun(void)
TEST_RESULT_STR_Z(walRangeResult->start, "000000020000000200000002", "start range");
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000002", "stop range");
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [028]: invalid WAL '0000000200000001000000FF' for '9.2-1' exists, skipping\n"
"P00 ERROR: [028]: duplicate WAL '000000020000000200000001' for '9.2-1' exists, skipping");
@ -694,7 +690,7 @@ testRun(void)
verifySetBackupCheckArchive(backupList, backupInfo, archiveIdList, pgHistory, &errTotal),
"20181119-153000F", "current backup, missing archive");
TEST_RESULT_UINT(errTotal, 1, "error logged");
harnessLogResult("P00 ERROR: [044]: archiveIds '12-3' are not in the archive.info history list");
TEST_RESULT_LOG("P00 ERROR: [044]: archiveIds '12-3' are not in the archive.info history list");
errTotal = 0;
strLstAddZ(archiveIdList, "13-4");
@ -702,7 +698,7 @@ testRun(void)
verifySetBackupCheckArchive(backupList, backupInfo, archiveIdList, pgHistory, &errTotal),
"20181119-153000F", "test multiple archiveIds on disk not in archive.info");
TEST_RESULT_UINT(errTotal, 1, "error logged");
harnessLogResult("P00 ERROR: [044]: archiveIds '12-3, 13-4' are not in the archive.info history list");
TEST_RESULT_LOG("P00 ERROR: [044]: archiveIds '12-3, 13-4' are not in the archive.info history list");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("verifyLogInvalidResult() - missing file");
@ -710,7 +706,7 @@ testRun(void)
TEST_RESULT_UINT(
verifyLogInvalidResult(STORAGE_REPO_ARCHIVE_STR, verifyFileMissing, 0, STRDEF("missingfilename")),
0, "file missing message");
harnessLogResult("P00 WARN: file missing 'missingfilename'");
TEST_RESULT_LOG("P00 WARN: file missing 'missingfilename'");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("verifyRender() - missing file, empty invalidList");
@ -790,16 +786,15 @@ testRun(void)
TEST_RESULT_VOID(storagePutP(storageNewWriteP(storageTest, backupInfoFileName), contentLoad), "write invalid backup.info");
TEST_ERROR(cmdVerify(), RuntimeError, "2 fatal errors encountered, see log for details");
harnessLogResult(
strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
"<REPO:BACKUP>/backup.info\n"
"P00 WARN: unable to open missing file '%s/%s/backup.info.copy' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/backup.info.copy' for read\n"
"P00 ERROR: [029]: No usable backup.info file\n"
"P00 WARN: unable to open missing file '%s/%s/archive.info' for read\n"
"P00 WARN: unable to open missing file '%s/%s/archive.info.copy' for read\n"
"P00 ERROR: [029]: No usable archive.info file", TEST_PATH, strZ(backupStanzaPath), TEST_PATH,
strZ(archiveStanzaPath), TEST_PATH, strZ(archiveStanzaPath))));
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/archive.info' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/archive.info.copy' for read\n"
"P00 ERROR: [029]: No usable archive.info file",
strZ(backupStanzaPath), strZ(archiveStanzaPath), strZ(archiveStanzaPath));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("backup.info invalid checksum, backup.info.copy valid, archive.info not exist, archive copy checksum invalid");
@ -809,15 +804,14 @@ testRun(void)
TEST_RESULT_VOID(
storagePutP(storageNewWriteP(storageTest, backupInfoFileNameCopy), backupInfoBase), "write valid backup.info.copy");
TEST_ERROR(cmdVerify(), RuntimeError, "1 fatal errors encountered, see log for details");
harnessLogResult(
strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS'"
" <REPO:BACKUP>/backup.info\n"
"P00 WARN: unable to open missing file '%s/%s/archive.info' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/archive.info' for read\n"
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS'"
" <REPO:ARCHIVE>/archive.info.copy\n"
"P00 ERROR: [029]: No usable archive.info file", TEST_PATH, strZ(archiveStanzaPath))));
"P00 ERROR: [029]: No usable archive.info file",
strZ(archiveStanzaPath));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("backup.info and copy valid but checksum mismatch, archive.info checksum invalid, archive.info copy valid");
@ -829,7 +823,7 @@ testRun(void)
TEST_RESULT_VOID(
storagePutP(storageNewWriteP(storageTest, archiveInfoFileNameCopy), archiveInfoBase), "write valid archive.info.copy");
TEST_ERROR(cmdVerify(), RuntimeError, "1 fatal errors encountered, see log for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup.info.copy does not match backup.info\n"
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS'"
" <REPO:ARCHIVE>/archive.info\n"
@ -848,7 +842,7 @@ testRun(void)
storagePutP(storageNewWriteP(storageTest, archiveInfoFileName), archiveInfoMultiHistoryBase),
"write valid archive.info");
TEST_RESULT_VOID(cmdVerify(), "usable backup and archive info files");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: archive.info.copy does not match archive.info\n"
"P00 WARN: no archives or backups exist in the repo");
@ -858,12 +852,11 @@ testRun(void)
TEST_RESULT_VOID(storageRemoveP(storageTest, backupInfoFileNameCopy), "remove backup.info.copy");
TEST_RESULT_VOID(storageRemoveP(storageTest, archiveInfoFileNameCopy), "remove archive.info.copy");
TEST_RESULT_VOID(cmdVerify(), "usable backup and archive info files");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/backup.info.copy' for read\n"
"P00 WARN: unable to open missing file '%s/%s/archive.info.copy' for read\n"
"P00 WARN: no archives or backups exist in the repo", TEST_PATH, strZ(backupStanzaPath), TEST_PATH,
strZ(archiveStanzaPath))));
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/backup.info.copy' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/archive.info.copy' for read\n"
"P00 WARN: no archives or backups exist in the repo",
strZ(backupStanzaPath), strZ(archiveStanzaPath));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("backup.info and copy missing, archive.info and copy valid");
@ -873,12 +866,11 @@ testRun(void)
storagePutP(storageNewWriteP(storageTest, archiveInfoFileNameCopy), archiveInfoMultiHistoryBase),
"write valid and matching archive.info.copy");
TEST_ERROR(cmdVerify(), RuntimeError, "1 fatal errors encountered, see log for details");
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: unable to open missing file '%s/%s/backup.info' for read\n"
"P00 WARN: unable to open missing file '%s/%s/backup.info.copy' for read\n"
"P00 ERROR: [029]: No usable backup.info file", TEST_PATH, strZ(backupStanzaPath), TEST_PATH,
strZ(backupStanzaPath))));
TEST_RESULT_LOG_FMT(
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/backup.info' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/backup.info.copy' for read\n"
"P00 ERROR: [029]: No usable backup.info file",
strZ(backupStanzaPath), strZ(backupStanzaPath));
}
// *****************************************************************************************************************************
@ -978,7 +970,7 @@ testRun(void)
harnessLogLevelSet(logLevelDetail);
TEST_ERROR(cmdVerify(), RuntimeError, "1 fatal errors encountered, see log for details");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: no backups exist in the repo\n"
"P00 ERROR: [028]: duplicate WAL '000000020000000700000FFE' for '11-2' exists, skipping\n"
"P00 WARN: path '11-2/0000000200000007' does not contain any valid WAL to be processed\n"
@ -1040,7 +1032,7 @@ testRun(void)
" backup: none found",
"verifyProcess() results");
TEST_RESULT_UINT(errorTotal, 2, "errors");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: no backups exist in the repo\n"
"P00 WARN: archive path '9.4-1' is empty\n"
"P00 WARN: path '11-2/0000000100000000' does not contain any valid WAL to be processed\n"
@ -1083,7 +1075,7 @@ testRun(void)
harnessLogLevelSet(logLevelError);
TEST_ERROR(cmdVerify(), RuntimeError, "2 fatal errors encountered, see log for details");
harnessLogResult(
TEST_RESULT_LOG(
"P01 ERROR: [028]: invalid checksum "
"'11-2/0000000200000007/000000020000000700000FFD-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz'\n"
"P01 ERROR: [028]: invalid size "
@ -1242,8 +1234,7 @@ testRun(void)
harnessLogLevelSet(logLevelDetail);
TEST_ERROR(cmdVerify(), RuntimeError, "7 fatal errors encountered, see log for details");
harnessLogResult(
strZ(strNewFmt(
TEST_RESULT_LOG_FMT(
"P00 WARN: archive path '9.4-1' is empty\n"
"P00 WARN: path '11-2/0000000100000000' does not contain any valid WAL to be processed\n"
"P01 ERROR: [028]: invalid checksum "
@ -1252,20 +1243,20 @@ testRun(void)
"'11-2/0000000200000007/000000020000000700000FFF-ee161f898c9012dd0c28b3fd1e7140b9cf411306'\n"
"P01 ERROR: [039]: invalid result "
"11-2/0000000200000008/000000020000000800000003-656817043007aa2100c44c712bcb456db705dab9: [41] raised from "
"local-1 shim protocol: unable to open file "
"'%s/%s/11-2/0000000200000008/000000020000000800000003-656817043007aa2100c44c712bcb456db705dab9' for read: "
"[13] Permission denied\n"
"P00 WARN: unable to open missing file '%s/%s/20181119-152800F/backup.manifest' for read\n"
"P00 WARN: unable to open missing file '%s/%s/20181119-152800F/backup.manifest.copy' for read\n"
"local-1 shim protocol: unable to open file '" TEST_PATH
"/%s/11-2/0000000200000008/000000020000000800000003-656817043007aa2100c44c712bcb456db705dab9' for read:"
" [13] Permission denied\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/20181119-152800F/backup.manifest' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/20181119-152800F/backup.manifest.copy' for read\n"
"P00 WARN: manifest missing for '20181119-152800F' - backup may have expired\n"
"P00 WARN: unable to open missing file '%s/%s/20181119-152810F/backup.manifest.copy' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/20181119-152810F/backup.manifest.copy' for read\n"
"P00 ERROR: [028]: backup '20181119-152810F' manifest does not contain any target files to verify\n"
"P01 ERROR: [028]: invalid checksum '20181119-152900F/pg_data/PG_VERSION'\n"
"P01 ERROR: [028]: file missing '20181119-152900F_20181119-152909D/pg_data/testmissing'\n"
"P00 WARN: unable to open missing file '%s/%s/20181119-153000F/backup.manifest' for read\n"
"P00 WARN: unable to open missing file '" TEST_PATH "/%s/20181119-153000F/backup.manifest' for read\n"
"P00 INFO: backup '20181119-153000F' appears to be in progress, skipping\n"
"P01 ERROR: [039]: invalid result UNPROCESSEDBACKUP/pg_data/testother: [41] raised from local-1 shim protocol:"
" unable to open file '%s/%s/UNPROCESSEDBACKUP/pg_data/testother' for read: [13] Permission denied\n"
" unable to open file '" TEST_PATH "/%s/UNPROCESSEDBACKUP/pg_data/testother' for read: [13] Permission denied\n"
"P00 DETAIL: archiveId: 11-2, wal start: 000000020000000700000FFD, wal stop: 000000020000000800000000\n"
"P00 DETAIL: archiveId: 11-2, wal start: 000000020000000800000002, wal stop: 000000020000000800000003\n"
"P00 DETAIL: archiveId: 11-2, wal start: 000000030000000000000000, wal stop: 000000030000000000000001\n"
@ -1278,11 +1269,11 @@ testRun(void)
" backup: 20181119-152900F, status: invalid, total files checked: 3, total valid files: 2\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0\n"
" backup: 20181119-152900F_20181119-152909D, status: invalid, total files checked: 5, "
"total valid files: 2\n"
"total valid files: 2\n"
" missing: 1, checksum invalid: 1, size invalid: 0, other: 1\n"
" backup: 20181119-153000F, status: in-progress, total files checked: 0, total valid files: 0",
TEST_PATH, strZ(archiveStanzaPath), TEST_PATH, strZ(backupStanzaPath), TEST_PATH, strZ(backupStanzaPath),
TEST_PATH, strZ(backupStanzaPath), TEST_PATH, strZ(backupStanzaPath), TEST_PATH, strZ(backupStanzaPath))));
strZ(archiveStanzaPath), strZ(backupStanzaPath), strZ(backupStanzaPath), strZ(backupStanzaPath),
strZ(backupStanzaPath), strZ(backupStanzaPath));
harnessLogLevelReset();
}
@ -1407,18 +1398,17 @@ testRun(void)
// The error for the referenced file is logged twice because it is checked again by the second backup since the first backup
// verification had not yet completed before the second backup verification began
harnessLogResult(
strZ(strNewFmt(
"P00 WARN: no archives exist in the repo\n"
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P00 INFO: Results:\n"
" archiveId: none found\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0",
strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelDiff))));
TEST_RESULT_LOG_FMT(
"P00 WARN: no archives exist in the repo\n"
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P00 INFO: Results:\n"
" archiveId: none found\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0",
strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelDiff));
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("valid backup, prior backup verification complete - referenced file not checked");
@ -1527,22 +1517,21 @@ testRun(void)
TEST_ERROR(cmdVerify(), RuntimeError, "3 fatal errors encountered, see log for details");
harnessLogResult(
strZ(strNewFmt(
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P01 ERROR: [028]: invalid size '%s/pg_data/base/1/555_init'\n"
"P01 ERROR: [028]: file missing '%s/pg_data/base/1/555_init.1'\n"
"P00 INFO: Results:\n"
" archiveId: 11-2, total WAL checked: 1, total valid WAL: 1\n"
" missing: 0, checksum invalid: 0, size invalid: 0, other: 0\n"
" backup: %s, status: invalid, total files checked: 3, total valid files: 0\n"
" missing: 1, checksum invalid: 1, size invalid: 1, other: 0\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0\n"
" backup: %s, status: valid, total files checked: 1, total valid files: 1\n"
" missing: 0, checksum invalid: 0, size invalid: 0, other: 0",
strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull),
strZ(backupLabelDiff), strZ(backupLabelFullDb2))));
TEST_RESULT_LOG_FMT(
"P01 ERROR: [028]: invalid checksum '%s/pg_data/PG_VERSION'\n"
"P01 ERROR: [028]: invalid size '%s/pg_data/base/1/555_init'\n"
"P01 ERROR: [028]: file missing '%s/pg_data/base/1/555_init.1'\n"
"P00 INFO: Results:\n"
" archiveId: 11-2, total WAL checked: 1, total valid WAL: 1\n"
" missing: 0, checksum invalid: 0, size invalid: 0, other: 0\n"
" backup: %s, status: invalid, total files checked: 3, total valid files: 0\n"
" missing: 1, checksum invalid: 1, size invalid: 1, other: 0\n"
" backup: %s, status: invalid, total files checked: 1, total valid files: 0\n"
" missing: 0, checksum invalid: 1, size invalid: 0, other: 0\n"
" backup: %s, status: valid, total files checked: 1, total valid files: 1\n"
" missing: 0, checksum invalid: 0, size invalid: 0, other: 0",
strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull), strZ(backupLabelFull),
strZ(backupLabelDiff), strZ(backupLabelFullDb2));
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@ -112,7 +112,7 @@ testRun(void)
harnessLogLevelSet(logLevelTrace);
testFunction1(99, false, NULL, NULL, NULL, 1.17, 0755);
harnessLogResult(
TEST_RESULT_LOG(
"P00 DEBUG: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction1: (paramInt: 99, paramBool: false,"
" paramBoolP: null, paramBoolPP: null, paramVoidP: null, paramDouble: 1.17, paramMode: 0755)\n"
"P00 TRACE: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction2: (void)\n"
@ -127,7 +127,7 @@ testRun(void)
testFunction1(99, false, testBoolP, testBoolPP, testVoidP, 1.17, 0755);
harnessLogResult(
TEST_RESULT_LOG(
"P00 DEBUG: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction1: (paramInt: 99, paramBool: false,"
" paramBoolP: *true, paramBoolPP: **true, paramVoidP: null, paramDouble: 1.17, paramMode: 0755)\n"
"P00 TRACE: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction2: (void)\n"
@ -139,7 +139,7 @@ testRun(void)
testFunction1(99, false, testBoolP, testBoolPP, testVoidP, 1.17, 0755);
harnessLogResult(
TEST_RESULT_LOG(
"P00 DEBUG: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction1: (paramInt: 99, paramBool: false,"
" paramBoolP: null, paramBoolPP: *null, paramVoidP: *void, paramDouble: 1.17, paramMode: 0755)\n"
"P00 TRACE: " TEST_PGB_PATH "/test/src/module/common/debugOnTest::testFunction2: (void)\n"
@ -150,7 +150,7 @@ testRun(void)
harnessLogLevelReset();
testFunction1(55, true, NULL, NULL, NULL, 0.99, 0755);
harnessLogResult("");
TEST_RESULT_LOG("");
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@ -58,10 +58,10 @@ testRun(void)
harnessCfgLoad(cfgCmdArchivePush, argList);
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no error");
harnessLogResult("P00 INFO: archive-push command end: completed successfully");
TEST_RESULT_LOG("P00 INFO: archive-push command end: completed successfully");
TEST_RESULT_INT(exitSafe(1, false, signalTypeNone), 1, "exit with no error");
harnessLogResult("P00 INFO: archive-push command end: completed successfully");
TEST_RESULT_LOG("P00 INFO: archive-push command end: completed successfully");
// -------------------------------------------------------------------------------------------------------------------------
TRY_BEGIN()
@ -71,7 +71,7 @@ testRun(void)
CATCH_ANY()
{
exitSafe(0, true, signalTypeNone);
harnessLogResult(
TEST_RESULT_LOG(
"P00 ERROR: [122]: test error message\n"
"P00 INFO: archive-push command end: aborted with exception [122]");
}
@ -94,7 +94,7 @@ testRun(void)
CATCH_ANY()
{
exitSafe(0, true, signalTypeNone);
harnessLogResult(
TEST_RESULT_LOG(
"P00 DEBUG: " TEST_PGB_PATH "/src/common/exit::exitSafe: (result: 0, error: true, signalType: 0)\n"
"P00 ERROR: [122]: test debug error message\n"
" --------------------------------------------------------------------\n"
@ -125,7 +125,7 @@ testRun(void)
CATCH_ANY()
{
exitSafe(0, true, signalTypeNone);
harnessLogResult(
TEST_RESULT_LOG(
"P00 ASSERT: [025]: test assert message\n"
" --------------------------------------------------------------------\n"
" If SUBMITTING AN ISSUE please provide the following information:\n"
@ -145,12 +145,12 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_INT(
exitSafe(errorTypeCode(&TermError), false, signalTypeNone), errorTypeCode(&TermError), "exit on term with no signal");
harnessLogResult("P00 INFO: archive-push:async command end: terminated on signal from child process");
TEST_RESULT_LOG("P00 INFO: archive-push:async command end: terminated on signal from child process");
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_INT(
exitSafe(errorTypeCode(&TermError), false, signalTypeTerm), errorTypeCode(&TermError), "exit on term with SIGTERM");
harnessLogResult("P00 INFO: archive-push:async command end: terminated on signal [SIGTERM]");
TEST_RESULT_LOG("P00 INFO: archive-push:async command end: terminated on signal [SIGTERM]");
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@ -273,11 +273,11 @@ testRun(void)
harnessLogLevelSet(logLevelWarn);
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.");
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
strLstAddZ(argList, "--repo1-retention-full=1");
@ -295,11 +295,11 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full'"
" to the maximum.\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
"P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=incr' but option"
" 'repo1-retention-archive' is not set");
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
@ -310,11 +310,11 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.\n"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.\n"
"P00 WARN: WAL segments will not be expired: option 'repo1-retention-archive-type=diff' but neither option"
" 'repo1-retention-archive' nor option 'repo1-retention-diff' is set");
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
@ -322,11 +322,11 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-diff=2");
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option"
" 'repo1-retention-full' to the maximum.");
" of space\n"
" HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the"
" maximum.");
TEST_RESULT_INT(cfgOptionInt(cfgOptRepoRetentionArchive), 2, " repo1-retention-archive set to retention-diff");
argList = strLstNew();
@ -337,7 +337,7 @@ testRun(void)
strLstAddZ(argList, "--repo1-retention-full=1");
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'\n"
" HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff'"
" to the maximum.");
@ -458,7 +458,7 @@ testRun(void)
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 6, " compress-level=6");
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: 'compress' and 'compress-type' options should not both be set\n"
" HINT: 'compress-type' is preferred and 'compress' is deprecated.");
}

View File

@ -130,7 +130,7 @@ testRun(void)
TEST_RESULT_VOID(
configParse(storageTest, strLstSize(argList), strLstPtr(argList), false),
TEST_COMMAND_BACKUP " command with config-include");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: configuration file contains option 'recovery-option' invalid for section 'db:backup'\n"
"P00 WARN: configuration file contains invalid option 'bogus'\n"
"P00 WARN: configuration file contains negate option 'no-delta'\n"
@ -1354,7 +1354,7 @@ testRun(void)
cfgParseOptionKeyIdxName(cfgOptPgHost, 1), cfgParseOptionKeyIdxName(cfgOptPgPath, 1))));
TEST_RESULT_VOID(configParse(storageTest, strLstSize(argList), strLstPtr(argList), false), TEST_COMMAND_BACKUP " command");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: environment contains invalid option 'bogus'\n"
"P00 WARN: environment contains invalid option 'onlin'\n"
"P00 WARN: environment contains invalid negate option 'no-delta'\n"

View File

@ -516,7 +516,7 @@ testRun(void)
});
TEST_ERROR(dbGet(true, true, false), DbConnectError, "unable to find primary cluster - cannot proceed");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432 user='bob'':"
" error");

View File

@ -720,7 +720,7 @@ testRun(void)
TEST_RESULT_STR_Z(
backupData.backupLabel, "20190923-164324F", "backups not on disk removed, dependent backup removed and not added back, "
"valid backup on disk added, manifest copy-only ignored");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup '20190818-084502F_20190820-084502I' missing manifest removed from backup.info\n"
"P00 WARN: backup '20190818-084502F' missing manifest removed from backup.info\n"
"P00 WARN: invalid backup '20190818-084502F_20190820-084502I' cannot be added to current backups\n"
@ -736,7 +736,7 @@ testRun(void)
TEST_ASSIGN(
infoBackup, infoBackupLoadFileReconstruct(storageRepo(), INFO_BACKUP_PATH_FILE_STR, cipherTypeNone, NULL),
"reconstruct does not attempt to add back dependent backup");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup '20190818-084502F_20190820-084502I' missing manifest removed from backup.info\n"
"P00 WARN: backup '20190818-084502F' missing manifest removed from backup.info\n"
"P00 WARN: invalid backup '20190818-084555F' cannot be added to current backups\n"
@ -809,7 +809,7 @@ testRun(void)
infoBackupDataLabelList(infoBackup, NULL),
"20190818-084444F\n20190818-084444F_20190924-084502D\n20190923-164324F\n",
"previously ignored pgId=1 manifest copy-only now added before existing, and add dependent found");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: backup '20190818-084444F' found in repository added to backup.info\n"
"P00 WARN: backup '20190818-084444F_20190924-084502D' found in repository added to backup.info\n"
"P00 WARN: invalid backup '20190818-084555F' cannot be added to current backups\n"

View File

@ -246,7 +246,7 @@ testRun(void)
TEST_RESULT_VOID(protocolHelperClientFree(&protocolHelperClient), "free");
harnessLogResult(
TEST_RESULT_LOG(
"P00 WARN: cannot free inactive context\n"
"P00 WARN: cannot free inactive context");
}