1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +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

@ -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.