You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
Add TEST_RESULT_STRLST_*() unit test macros.
This avoids the need for strLstJoin() when testing lists. Lists are \n delimited (rather than command or pipe) so that non-trivial lists can be more easily diff'd.
This commit is contained in:
@ -650,6 +650,19 @@ void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResul
|
|||||||
hrnTestResultEnd();
|
hrnTestResultEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hrnTestResultStringList(const StringList *actual, const void *expected, HarnessTestResultOperation operation)
|
||||||
|
{
|
||||||
|
// Return NULL if list is empty
|
||||||
|
if (strLstSize(actual) == 0)
|
||||||
|
{
|
||||||
|
hrnTestResultZ(NULL, expected, operation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hrnTestResultZ(strZ(strCatZ(strLstJoin(actual, "\n"), "\n")), expected, operation);
|
||||||
|
}
|
||||||
|
|
||||||
void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation)
|
void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation)
|
||||||
{
|
{
|
||||||
ASSERT(harnessTestLocal.result.running);
|
ASSERT(harnessTestLocal.result.running);
|
||||||
|
@ -247,6 +247,19 @@ Macros to compare results of common data types
|
|||||||
#define TEST_RESULT_Z_STR(statement, resultExpected, ...) \
|
#define TEST_RESULT_Z_STR(statement, resultExpected, ...) \
|
||||||
TEST_RESULT_Z(statement, strZNull(resultExpected), __VA_ARGS__);
|
TEST_RESULT_Z(statement, strZNull(resultExpected), __VA_ARGS__);
|
||||||
|
|
||||||
|
// Compare a string list to a \n delimited string
|
||||||
|
#define TEST_RESULT_STRLST_Z(statement, resultExpected, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
TEST_RESULT_INFO(__VA_ARGS__); \
|
||||||
|
hrnTestResultBegin(#statement, __LINE__, true); \
|
||||||
|
hrnTestResultStringList(statement, resultExpected, harnessTestResultOperationEq); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
#define TEST_RESULT_STRLST_STR(statement, resultExpected, ...) \
|
||||||
|
TEST_RESULT_STRLST_Z(statement, strZNull(resultExpected), __VA_ARGS__);
|
||||||
|
|
||||||
#define TEST_RESULT_UINT_PARAM(statement, expected, operation, ...) \
|
#define TEST_RESULT_UINT_PARAM(statement, expected, operation, ...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
@ -6,6 +6,8 @@ C Test Harness Internal
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "common/type/stringList.h"
|
||||||
|
|
||||||
#include "common/harnessTest.h"
|
#include "common/harnessTest.h"
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -42,6 +44,7 @@ void hrnTestResultBool(int actual, int expected);
|
|||||||
void hrnTestResultDouble(double actual, double expected);
|
void hrnTestResultDouble(double actual, double expected);
|
||||||
void hrnTestResultInt64(int64_t actual, int64_t expected, HarnessTestResultOperation operation);
|
void hrnTestResultInt64(int64_t actual, int64_t expected, HarnessTestResultOperation operation);
|
||||||
void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResultOperation operation);
|
void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResultOperation operation);
|
||||||
|
void hrnTestResultStringList(const StringList *actual, const void *expected, HarnessTestResultOperation operation);
|
||||||
void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation);
|
void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation);
|
||||||
void hrnTestResultUInt64Int64(uint64_t actual, int64_t expected, HarnessTestResultOperation operation);
|
void hrnTestResultUInt64Int64(uint64_t actual, int64_t expected, HarnessTestResultOperation operation);
|
||||||
void hrnTestResultZ(const char *actual, const char *expected, HarnessTestResultOperation operation);
|
void hrnTestResultZ(const char *actual, const char *expected, HarnessTestResultOperation operation);
|
||||||
|
@ -313,25 +313,25 @@ testRun(void)
|
|||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
if (testBegin("walSegmentRange()"))
|
if (testBegin("walSegmentRange()"))
|
||||||
{
|
{
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walSegmentRange(strNew("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "|"),
|
walSegmentRange(strNew("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "000000010000000100000000\n",
|
||||||
"000000010000000100000000", "get single");
|
"get single");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4), "|"),
|
walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4),
|
||||||
"0000000100000001000000FD|0000000100000001000000FE|000000010000000200000000|000000010000000200000001",
|
"0000000100000001000000FD\n0000000100000001000000FE\n000000010000000200000000\n000000010000000200000001\n",
|
||||||
"get range < 9.3");
|
"get range < 9.3");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4), "|"),
|
walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4),
|
||||||
"0000000100000001000000FD|0000000100000001000000FE|0000000100000001000000FF|000000010000000200000000",
|
"0000000100000001000000FD\n0000000100000001000000FE\n0000000100000001000000FF\n000000010000000200000000\n",
|
||||||
"get range >= 9.3");
|
"get range >= 9.3");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walSegmentRange(strNew("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8), "|"),
|
walSegmentRange(strNew("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8),
|
||||||
"000000080000000A00000000|000000080000000A00000001|000000080000000A00000002|000000080000000A00000003|"
|
"000000080000000A00000000\n000000080000000A00000001\n000000080000000A00000002\n000000080000000A00000003\n"
|
||||||
"000000080000000B00000000|000000080000000B00000001|000000080000000B00000002|000000080000000B00000003",
|
"000000080000000B00000000\n000000080000000B00000001\n000000080000000B00000002\n000000080000000B00000003\n",
|
||||||
"get range >= 11/1GB");
|
"get range >= 11/1GB");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walSegmentRange(strNew("000000070000000700000FFE"), 1024 * 1024, PG_VERSION_11, 4), "|"),
|
walSegmentRange(strNew("000000070000000700000FFE"), 1024 * 1024, PG_VERSION_11, 4),
|
||||||
"000000070000000700000FFE|000000070000000700000FFF|000000070000000800000000|000000070000000800000001",
|
"000000070000000700000FFE\n000000070000000700000FFF\n000000070000000800000000\n000000070000000800000001\n",
|
||||||
"get range >= 11/1MB");
|
"get range >= 11/1MB");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,10 +347,10 @@ testRun(void)
|
|||||||
strLstAddZ(list, "11-10");
|
strLstAddZ(list, "11-10");
|
||||||
strLstAddZ(list, "9.6-1");
|
strLstAddZ(list, "9.6-1");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(strLstJoin(strLstSort(list, sortOrderAsc), ", "), "9.6-1, 10-4, 11-10", "sort ascending");
|
TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderAsc), "9.6-1\n10-4\n11-10\n", "sort ascending");
|
||||||
|
|
||||||
strLstAddZ(list, "9.4-2");
|
strLstAddZ(list, "9.4-2");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(strLstSort(list, sortOrderDesc), ", "), "11-10, 10-4, 9.4-2, 9.6-1", "sort descending");
|
TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderDesc), "11-10\n10-4\n9.4-2\n9.6-1\n", "sort descending");
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_HARNESS_RESULT_VOID();
|
FUNCTION_HARNESS_RESULT_VOID();
|
||||||
|
@ -263,16 +263,16 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
storagePathCreateP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN));
|
storagePathCreateP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"),
|
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||||
"000000010000000100000001|000000010000000100000002", "queue size smaller than min");
|
"000000010000000100000001\n000000010000000100000002\n", "queue size smaller than min");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
queueSize = (16 * 1024 * 1024) * 3;
|
queueSize = (16 * 1024 * 1024) * 3;
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"),
|
queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||||
"000000010000000100000001|000000010000000100000002|000000010000000100000003", "empty queue");
|
"000000010000000100000001\n000000010000000100000002\n000000010000000100000003\n", "empty queue");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
Buffer *walSegmentBuffer = bufNew(walSegmentSize);
|
Buffer *walSegmentBuffer = bufNew(walSegmentSize);
|
||||||
@ -285,13 +285,12 @@ testRun(void)
|
|||||||
storageNewWriteP(
|
storageNewWriteP(
|
||||||
storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/0000000100000001000000FF")), walSegmentBuffer);
|
storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/0000000100000001000000FF")), walSegmentBuffer);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(queueNeed(strNew("0000000100000001000000FE"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"),
|
queueNeed(strNew("0000000100000001000000FE"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||||
"000000010000000200000000|000000010000000200000001", "queue has wal < 9.3");
|
"000000010000000200000000\n000000010000000200000001\n", "queue has wal < 9.3");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(storageListP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), "|"), "0000000100000001000000FE",
|
storageListP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), "0000000100000001000000FE\n", "check queue");
|
||||||
"check queue");
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
walSegmentSize = 1024 * 1024;
|
walSegmentSize = 1024 * 1024;
|
||||||
@ -305,13 +304,13 @@ testRun(void)
|
|||||||
storageNewWriteP(
|
storageNewWriteP(
|
||||||
storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000A00000FFF")), walSegmentBuffer);
|
storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000A00000FFF")), walSegmentBuffer);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(queueNeed(strNew("000000010000000A00000FFD"), true, queueSize, walSegmentSize, PG_VERSION_11), "|"),
|
queueNeed(strNew("000000010000000A00000FFD"), true, queueSize, walSegmentSize, PG_VERSION_11),
|
||||||
"000000010000000B00000000|000000010000000B00000001|000000010000000B00000002", "queue has wal >= 9.3");
|
"000000010000000B00000000\n000000010000000B00000001\n000000010000000B00000002\n", "queue has wal >= 9.3");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), sortOrderAsc),
|
||||||
"000000010000000A00000FFE|000000010000000A00000FFF", "check queue");
|
"000000010000000A00000FFE\n000000010000000A00000FFF\n", "check queue");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,13 +67,13 @@ testRun(void)
|
|||||||
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000005.ready")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000005.ready")), NULL);
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000006.ready")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000006.ready")), NULL);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(archivePushProcessList(strNewFmt("%s/db/pg_wal", testPath())), "|"),
|
archivePushProcessList(strNewFmt("%s/db/pg_wal", testPath())),
|
||||||
"000000010000000100000002|000000010000000100000005|000000010000000100000006", "ready list");
|
"000000010000000100000002\n000000010000000100000005\n000000010000000100000006\n", "ready list");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc),
|
||||||
"000000010000000100000003.ok", "remaining status list");
|
"000000010000000100000003.ok\n", "remaining status list");
|
||||||
|
|
||||||
// Test drop
|
// Test drop
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -633,9 +633,9 @@ testRun(void)
|
|||||||
strNewBuf(storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/global.error")))),
|
strNewBuf(storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/global.error")))),
|
||||||
"25\nno WAL files to process", "check global.error");
|
"25\nno WAL files to process", "check global.error");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc),
|
||||||
"global.error", "check status files");
|
"global.error\n", "check status files");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("push already pushed WAL and error on missing WAL");
|
TEST_TITLE("push already pushed WAL and error on missing WAL");
|
||||||
@ -663,9 +663,9 @@ testRun(void)
|
|||||||
storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1)),
|
storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1)),
|
||||||
true, "check repo for WAL 1 file");
|
true, "check repo for WAL 1 file");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc),
|
||||||
"000000010000000100000001.ok|000000010000000100000002.error", "check status files");
|
"000000010000000100000001.ok\n000000010000000100000002.error\n", "check status files");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("create and push previously missing WAL");
|
TEST_TITLE("create and push previously missing WAL");
|
||||||
@ -693,9 +693,9 @@ testRun(void)
|
|||||||
storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1)),
|
storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1)),
|
||||||
true, "check repo for WAL 2 file");
|
true, "check repo for WAL 2 file");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc),
|
||||||
"000000010000000100000001.ok|000000010000000100000002.ok", "check status files");
|
"000000010000000100000001.ok\n000000010000000100000002.ok\n", "check status files");
|
||||||
|
|
||||||
// Check that drop functionality works
|
// Check that drop functionality works
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -723,9 +723,9 @@ testRun(void)
|
|||||||
storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/000000010000000100000002.ok")))),
|
storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/000000010000000100000002.ok")))),
|
||||||
"0\ndropped WAL file '000000010000000100000002' because archive queue exceeded 16MB", "check WAL 2 warning");
|
"0\ndropped WAL file '000000010000000100000002' because archive queue exceeded 16MB", "check WAL 2 warning");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"),
|
strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc),
|
||||||
"000000010000000100000001.ok|000000010000000100000002.ok", "check status files");
|
"000000010000000100000001.ok\n000000010000000100000002.ok\n", "check status files");
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCTION_HARNESS_RESULT_VOID();
|
FUNCTION_HARNESS_RESULT_VOID();
|
||||||
|
@ -54,10 +54,7 @@ archiveExpectList(const unsigned int start, unsigned int end, const char *majorW
|
|||||||
else
|
else
|
||||||
wal = strNewFmt("%s000000%u-9baedd24b61aa15305732ac678c4e2c102435a09", majorWal, i);
|
wal = strNewFmt("%s000000%u-9baedd24b61aa15305732ac678c4e2c102435a09", majorWal, i);
|
||||||
|
|
||||||
if (strSize(result) == 0)
|
strCatFmt(result, "%s\n", strZ(wal));
|
||||||
strCat(result, wal);
|
|
||||||
else
|
|
||||||
strCatFmt(result, ", %s", strZ(wal));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -201,9 +198,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(expireBackup(infoBackup, full2), "expire backup with no manifest - does not error");
|
TEST_RESULT_VOID(expireBackup(infoBackup, full2), "expire backup with no manifest - does not error");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152900F, 20181119-152900F_20181119-152600D",
|
"20181119-152900F\n20181119-152900F_20181119-152600D\n",
|
||||||
"only backups in set passed to expireBackup are removed from backup:current (result is sorted)");
|
"only backups in set passed to expireBackup are removed from backup:current (result is sorted)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,10 +233,10 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup), 1, "retention-full=2 - one full backup expired");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup), 1, "retention-full=2 - one full backup expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 5, "current backups reduced by 1 full - no dependencies");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 5, "current backups reduced by 1 full - no dependencies");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I"
|
"20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n20181119-152900F\n"
|
||||||
", 20181119-152900F, 20181119-152900F_20181119-152600D",
|
"20181119-152900F_20181119-152600D\n",
|
||||||
"remaining backups correct");
|
"remaining backups correct");
|
||||||
harnessLogResult("P00 INFO: expire full backup 20181119-152138F");
|
harnessLogResult("P00 INFO: expire full backup 20181119-152138F");
|
||||||
|
|
||||||
@ -252,8 +249,8 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup), 3, "retention-full=1 - one full backup and dependencies expired");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup), 3, "retention-full=1 - one full backup and dependencies expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by 1 full and dependencies");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by 1 full and dependencies");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152900F, 20181119-152900F_20181119-152600D",
|
infoBackupDataLabelList(infoBackup, NULL), "20181119-152900F\n20181119-152900F_20181119-152600D\n",
|
||||||
"remaining backups correct");
|
"remaining backups correct");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: expire full backup set: 20181119-152800F, 20181119-152800F_20181119-152152D, "
|
"P00 INFO: expire full backup set: 20181119-152800F, 20181119-152800F_20181119-152152D, "
|
||||||
@ -263,8 +260,8 @@ testRun(void)
|
|||||||
TEST_TITLE("retention-full set - no backups expired");
|
TEST_TITLE("retention-full set - no backups expired");
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup), 0, "retention-full=1 - not enough backups to expire any");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup), 0, "retention-full=1 - not enough backups to expire any");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152900F, 20181119-152900F_20181119-152600D",
|
infoBackupDataLabelList(infoBackup, NULL), "20181119-152900F\n20181119-152900F_20181119-152600D\n",
|
||||||
" remaining backups correct");
|
" remaining backups correct");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,9 +301,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff=2 - full considered in diff");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff=2 - full considered in diff");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 4, "current backups reduced by 1 diff and dependent increment");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 4, "current backups reduced by 1 diff and dependent increment");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152138F, 20181119-152800F, 20181119-152900F, 20181119-152900F_20181119-152600D",
|
"20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n",
|
||||||
"remaining backups correct");
|
"remaining backups correct");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
|
"P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
|
||||||
@ -321,9 +318,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff set to 1 - full considered in diff");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff set to 1 - full considered in diff");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152138F, 20181119-152800F, 20181119-152900F, 20181119-152900F_20181119-152600D",
|
"20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n",
|
||||||
" remaining backups correct");
|
" remaining backups correct");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
|
"P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I");
|
||||||
@ -381,8 +378,8 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 1, "retention-diff set - only oldest diff expired");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup), 1, "retention-diff set - only oldest diff expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by one");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by one");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152800F, 20181119-152800F_20181119-152155D",
|
infoBackupDataLabelList(infoBackup, NULL), "20181119-152800F\n20181119-152800F_20181119-152155D\n",
|
||||||
"remaining backups correct");
|
"remaining backups correct");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: expire diff backup 20181119-152800F_20181119-152152D");
|
"P00 INFO: expire diff backup 20181119-152800F_20181119-152152D");
|
||||||
@ -452,9 +449,9 @@ testRun(void)
|
|||||||
"P00 INFO: remove expired backup 20181119-152100F_20181119-152152D\n"
|
"P00 INFO: remove expired backup 20181119-152100F_20181119-152152D\n"
|
||||||
"P00 INFO: remove expired backup 20181119-152100F");
|
"P00 INFO: remove expired backup 20181119-152100F");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), ", "),
|
strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc),
|
||||||
"20181118-152100F_20181119-152152D.save, 20181119-152138F, backup.info, bogus",
|
"20181118-152100F_20181119-152152D.save\n20181119-152138F\nbackup.info\nbogus\n",
|
||||||
"remaining file/directories correct");
|
"remaining file/directories correct");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -480,9 +477,9 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL), "remove backups - backup.info current empty");
|
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL), "remove backups - backup.info current empty");
|
||||||
|
|
||||||
harnessLogResult("P00 INFO: remove expired backup 20181119-152138F");
|
harnessLogResult("P00 INFO: remove expired backup 20181119-152138F");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), ", "),
|
strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc),
|
||||||
"20181118-152100F_20181119-152152D.save, backup.info, bogus", "remaining file/directories correct");
|
"20181118-152100F_20181119-152152D.save\nbackup.info\nbogus\n", "remaining file/directories correct");
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
@ -672,18 +669,18 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=3");
|
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=3");
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 10, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000001 removed");
|
archiveExpectList(2, 10, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000001 removed");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 10, "0000000200000000"),
|
archiveExpectList(1, 10, "0000000200000000"),
|
||||||
"none removed from 9.4-1/0000000200000000 - crossing timelines to play through PITR");
|
"none removed from 9.4-1/0000000200000000 - crossing timelines to play through PITR");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(3, 10, "0000000100000000"),
|
archiveExpectList(3, 10, "0000000100000000"),
|
||||||
"000000010000000000000001 and 000000010000000000000002 removed from 10-2/0000000100000000");
|
"000000010000000000000001 and 000000010000000000000002 removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
@ -696,19 +693,19 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=2");
|
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=2");
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 2, "0000000100000000"),
|
archiveExpectList(2, 2, "0000000100000000"),
|
||||||
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 10, "0000000200000000"),
|
archiveExpectList(2, 10, "0000000200000000"),
|
||||||
"only 9.4-1/0000000200000000/000000010000000000000001 removed from major wal 2");
|
"only 9.4-1/0000000200000000/000000010000000000000001 removed from major wal 2");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(3, 10, "0000000100000000"),
|
archiveExpectList(3, 10, "0000000100000000"),
|
||||||
"none removed from 10-2/0000000100000000");
|
"none removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
@ -721,19 +718,19 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=1");
|
TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=1");
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 2, "0000000100000000"),
|
archiveExpectList(2, 2, "0000000100000000"),
|
||||||
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 10, "0000000200000000"),
|
archiveExpectList(2, 10, "0000000200000000"),
|
||||||
"nothing removed from 9.4-1/0000000200000000 major wal 2 - each archiveId must have one backup to play through PITR");
|
"nothing removed from 9.4-1/0000000200000000 major wal 2 - each archiveId must have one backup to play through PITR");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -752,22 +749,22 @@ testRun(void)
|
|||||||
String *result = strNew("");
|
String *result = strNew("");
|
||||||
strCatFmt(
|
strCatFmt(
|
||||||
result,
|
result,
|
||||||
"%s, %s, %s, %s",
|
"%s%s%s%s",
|
||||||
strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")),
|
strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")),
|
||||||
strZ(archiveExpectList(7, 7, "0000000200000000")), strZ(archiveExpectList(9, 10, "0000000200000000")));
|
strZ(archiveExpectList(7, 7, "0000000200000000")), strZ(archiveExpectList(9, 10, "0000000200000000")));
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 2, "0000000100000000"),
|
archiveExpectList(2, 2, "0000000100000000"),
|
||||||
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc),
|
||||||
result, "all in-between removed from 9.4-1/0000000200000000 major wal 2 - last backup able to play through PITR");
|
result, "all in-between removed from 9.4-1/0000000200000000 major wal 2 - last backup able to play through PITR");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -786,22 +783,22 @@ testRun(void)
|
|||||||
result = strNew("");
|
result = strNew("");
|
||||||
strCatFmt(
|
strCatFmt(
|
||||||
result,
|
result,
|
||||||
"%s, %s, %s",
|
"%s%s%s",
|
||||||
strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")),
|
strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")),
|
||||||
strZ(archiveExpectList(7, 10, "0000000200000000")));
|
strZ(archiveExpectList(7, 10, "0000000200000000")));
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(2, 2, "0000000100000000"),
|
archiveExpectList(2, 2, "0000000100000000"),
|
||||||
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
"only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc),
|
||||||
result, "incremental and after remain in 9.4-1/0000000200000000 major wal 2");
|
result, "incremental and after remain in 9.4-1/0000000200000000 major wal 2");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -962,9 +959,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
|
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "backup.info updated on disk");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "backup.info updated on disk");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "),
|
strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc),
|
||||||
"20181119-152900F, 20181119-152900F_20181119-152500I", "remaining current backups correct");
|
"20181119-152900F\n20181119-152900F_20181119-152500I\n", "remaining current backups correct");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("expire command - archive removed");
|
TEST_TITLE("expire command - archive removed");
|
||||||
@ -1032,9 +1029,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false), "backup selected for retention does not have archive-start so do nothing");
|
removeExpiredArchive(infoBackup, false), "backup selected for retention does not have archive-start so do nothing");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 5, "0000000100000000"), "nothing removed from 9.4-1/0000000100000000");
|
archiveExpectList(1, 5, "0000000100000000"), "nothing removed from 9.4-1/0000000100000000");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1284,13 +1281,13 @@ testRun(void)
|
|||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: expire full backup 20181119-152138F\n"
|
"P00 INFO: expire full backup 20181119-152138F\n"
|
||||||
"P00 INFO: remove expired backup 20181119-152138F");
|
"P00 INFO: remove expired backup 20181119-152138F");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000");
|
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-2/0000000100000000");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1408,13 +1405,13 @@ testRun(void)
|
|||||||
"P00 INFO: expire full backup 20181119-152800F\n"
|
"P00 INFO: expire full backup 20181119-152800F\n"
|
||||||
"P00 INFO: remove expired backup 20181119-152800F\n"
|
"P00 INFO: remove expired backup 20181119-152800F\n"
|
||||||
"P00 INFO: remove expired backup 20181119-152138F");
|
"P00 INFO: remove expired backup 20181119-152138F");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000");
|
archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(6, 7, "0000000100000000"),
|
archiveExpectList(6, 7, "0000000100000000"),
|
||||||
"all prior to 000000010000000000000006 removed from 10-2/0000000100000000");
|
"all prior to 000000010000000000000006 removed from 10-2/0000000100000000");
|
||||||
}
|
}
|
||||||
@ -1700,7 +1697,7 @@ testRun(void)
|
|||||||
|
|
||||||
String *archiveRemaining = strNew("");
|
String *archiveRemaining = strNew("");
|
||||||
strCatFmt(
|
strCatFmt(
|
||||||
archiveRemaining, "%s, %s", strZ(archiveExpectList(2, 4, "0000000100000000")),
|
archiveRemaining, "%s%s", strZ(archiveExpectList(2, 4, "0000000100000000")),
|
||||||
strZ(archiveExpectList(6, 10, "0000000100000000")));
|
strZ(archiveExpectList(6, 10, "0000000100000000")));
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "adhoc expire latest backup");
|
TEST_RESULT_VOID(cmdExpire(), "adhoc expire latest backup");
|
||||||
@ -1728,9 +1725,9 @@ testRun(void)
|
|||||||
"P00 DETAIL: no archive to remove, archiveId = 12-2");
|
"P00 DETAIL: no archive to remove, archiveId = 12-2");
|
||||||
TEST_RESULT_STR(storageInfoP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")).linkDestination,
|
TEST_RESULT_STR(storageInfoP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")).linkDestination,
|
||||||
STRDEF("20181119-152850F"), "latest link updated");
|
STRDEF("20181119-152850F"), "latest link updated");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "12-2", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "12-2", "0000000100000000")), sortOrderAsc),
|
||||||
archiveRemaining,
|
archiveRemaining,
|
||||||
"no archives removed from latest except what was already removed");
|
"no archives removed from latest except what was already removed");
|
||||||
|
|
||||||
@ -2040,25 +2037,25 @@ testRun(void)
|
|||||||
TEST_RESULT_UINT(
|
TEST_RESULT_UINT(
|
||||||
expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (40 * SEC_PER_DAY))), 0,
|
expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (40 * SEC_PER_DAY))), 0,
|
||||||
"oldest backup stop time equals retention time");
|
"oldest backup stop time equals retention time");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, "
|
"20181119-152138F\n20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n"
|
||||||
"20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired");
|
"20181119-152900F\n20181119-152900F_20181119-152600D\n", "no backups expired");
|
||||||
|
|
||||||
// Add a time period
|
// Add a time period
|
||||||
strLstAddZ(argList, "--repo1-retention-full=35");
|
strLstAddZ(argList, "--repo1-retention-full=35");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
harnessCfgLoad(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young");
|
TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young");
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
strLstJoin(strLstSort(storageListP(
|
strLstSort(storageListP(
|
||||||
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "),
|
storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc),
|
||||||
archiveExpectList(1, 11, "0000000100000000"),
|
archiveExpectList(1, 11, "0000000100000000"),
|
||||||
"no archives expired");
|
"no archives expired");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, "
|
"20181119-152138F\n20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n"
|
||||||
"20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired");
|
"20181119-152900F\n20181119-152900F_20181119-152600D\n", "no backups expired");
|
||||||
harnessLogResult("P00 INFO: time-based archive retention not met - archive logs will not be expired");
|
harnessLogResult("P00 INFO: time-based archive retention not met - archive logs will not be expired");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -227,11 +227,11 @@ testRun(void)
|
|||||||
"P00 ERROR: [028]: invalid WAL '0000000200000001000000FF' for '9.2-1' exists, skipping\n"
|
"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");
|
"P00 ERROR: [028]: duplicate WAL '000000020000000200000001' for '9.2-1' exists, skipping");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(walFileList, ", "),
|
walFileList,
|
||||||
"0000000200000001000000FD-daa497dba64008db824607940609ba1cd7c6c501.gz, "
|
"0000000200000001000000FD-daa497dba64008db824607940609ba1cd7c6c501.gz\n"
|
||||||
"0000000200000001000000FE-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz, "
|
"0000000200000001000000FE-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz\n"
|
||||||
"000000020000000200000000, 000000020000000200000002",
|
"000000020000000200000000\n000000020000000200000002\n",
|
||||||
"skipped files removed");
|
"skipped files removed");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -150,16 +150,16 @@ testRun(void)
|
|||||||
TEST_RESULT_STR_Z(iniGetDefault(ini, strNew("section3"), strNew("key3"), strNew("true")), "true", "get section, key, bool");
|
TEST_RESULT_STR_Z(iniGetDefault(ini, strNew("section3"), strNew("key3"), strNew("true")), "true", "get section, key, bool");
|
||||||
|
|
||||||
TEST_RESULT_INT(strLstSize(iniSectionKeyList(ini, strNew("bogus"))), 0, "get keys for missing section");
|
TEST_RESULT_INT(strLstSize(iniSectionKeyList(ini, strNew("bogus"))), 0, "get keys for missing section");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(iniSectionKeyList(ini, strNew("section1")), "|"), "key1|key2", "get keys for section");
|
TEST_RESULT_STRLST_Z(iniSectionKeyList(ini, strNew("section1")), "key1\nkey2\n", "get keys for section");
|
||||||
|
|
||||||
TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("2")), "set section2, key");
|
TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("2")), "set section2, key");
|
||||||
TEST_RESULT_INT(strLstSize(iniSectionList(ini)), 2, "number of sections");
|
TEST_RESULT_INT(strLstSize(iniSectionList(ini)), 2, "number of sections");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(iniSectionList(ini), "|"), "section1|section2", "get sections");
|
TEST_RESULT_STRLST_Z(iniSectionList(ini), "section1\nsection2\n", "get sections");
|
||||||
|
|
||||||
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section1"), strNew("key1")), false, "single value is not list");
|
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section1"), strNew("key1")), false, "single value is not list");
|
||||||
TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("7")), "set section2, key");
|
TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("7")), "set section2, key");
|
||||||
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section2"), strNew("key2")), true, "section2, key2 is a list");
|
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section2"), strNew("key2")), true, "section2, key2 is a list");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(iniGetList(ini, strNew("section2"), strNew("key2")), "|"), "2|7", "get list");
|
TEST_RESULT_STRLST_Z(iniGetList(ini, strNew("section2"), strNew("key2")), "2\n7\n", "get list");
|
||||||
TEST_RESULT_PTR(iniGetList(ini, strNew("section2"), strNew("key-missing")), NULL, "get missing list");
|
TEST_RESULT_PTR(iniGetList(ini, strNew("section2"), strNew("key-missing")), NULL, "get missing list");
|
||||||
|
|
||||||
TEST_RESULT_VOID(iniFree(ini), "free ini");
|
TEST_RESULT_VOID(iniFree(ini), "free ini");
|
||||||
|
@ -71,7 +71,7 @@ testRun(void)
|
|||||||
TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key2"), strNew("value2b")), header, "add header");
|
TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key2"), strNew("value2b")), header, "add header");
|
||||||
|
|
||||||
TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key1"), strNew("value1")), header, "add header");
|
TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key1"), strNew("value1")), header, "add header");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(httpHeaderList(header), ", "), "key1, key2", "header list");
|
TEST_RESULT_STRLST_Z(httpHeaderList(header), "key1\nkey2\n", "header list");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key1")), "value1", "get value");
|
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key1")), "value1", "get value");
|
||||||
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key2")), "value2a, value2b", "get value");
|
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key2")), "value2a, value2b", "get value");
|
||||||
@ -132,7 +132,7 @@ testRun(void)
|
|||||||
TEST_RESULT_STR_Z(httpQueryRenderP(query), "key2=value2a", "render one query item");
|
TEST_RESULT_STR_Z(httpQueryRenderP(query), "key2=value2a", "render one query item");
|
||||||
|
|
||||||
TEST_RESULT_PTR(httpQueryAdd(query, strNew("key1"), strNew("value 1?")), query, "add query");
|
TEST_RESULT_PTR(httpQueryAdd(query, strNew("key1"), strNew("value 1?")), query, "add query");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(httpQueryList(query), ", "), "key1, key2", "query list");
|
TEST_RESULT_STRLST_Z(httpQueryList(query), "key1\nkey2\n", "query list");
|
||||||
TEST_RESULT_STR_Z(httpQueryRenderP(query), "key1=value%201%3F&key2=value2a", "render two query items");
|
TEST_RESULT_STR_Z(httpQueryRenderP(query), "key1=value%201%3F&key2=value2a", "render two query items");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
httpQueryRenderP(query, .redact = true), "key1=value%201%3F&key2=<redacted>", "render two query items with redaction");
|
httpQueryRenderP(query, .redact = true), "key1=value%201%3F&key2=<redacted>", "render two query items with redaction");
|
||||||
|
@ -114,7 +114,7 @@ testRun(void)
|
|||||||
TEST_ERROR(jsonToVarLst(strNew("[")), JsonFormatError, "expected data");
|
TEST_ERROR(jsonToVarLst(strNew("[")), JsonFormatError, "expected data");
|
||||||
TEST_ERROR(jsonToVarLst(strNew(" [] ZZZ")), JsonFormatError, "unexpected characters after array at 'ZZZ'");
|
TEST_ERROR(jsonToVarLst(strNew(" [] ZZZ")), JsonFormatError, "unexpected characters after array at 'ZZZ'");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(strLstJoin(strLstNewVarLst(jsonToVarLst(strNew("[\"e1\", \"e2\"]"))), "|"), "e1|e2", "json list");
|
TEST_RESULT_STRLST_Z(strLstNewVarLst(jsonToVarLst(strNew("[\"e1\", \"e2\"]"))), "e1\ne2\n", "json list");
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
|
@ -398,7 +398,7 @@ testRun(void)
|
|||||||
varLstAdd(list, varNewStrZ("string1"));
|
varLstAdd(list, varNewStrZ("string1"));
|
||||||
varLstAdd(list, varNewStrZ("string2"));
|
varLstAdd(list, varNewStrZ("string2"));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(strLstJoin(strLstNewVarLst(varLstDup(list)), ", "), "string1, string2", "duplicate variant list");
|
TEST_RESULT_STRLST_Z(strLstNewVarLst(varLstDup(list)), "string1\nstring2\n", "duplicate variant list");
|
||||||
|
|
||||||
TEST_RESULT_PTR(varLstDup(NULL), NULL, "duplicate null list");
|
TEST_RESULT_PTR(varLstDup(NULL), NULL, "duplicate null list");
|
||||||
}
|
}
|
||||||
@ -411,8 +411,7 @@ testRun(void)
|
|||||||
strLstAdd(listStr, strNew("string1"));
|
strLstAdd(listStr, strNew("string1"));
|
||||||
strLstAdd(listStr, strNew("string2"));
|
strLstAdd(listStr, strNew("string2"));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(strLstNewVarLst(varLstNewStrLst(listStr)), "string1\nstring2\n", "variant list from string list");
|
||||||
strLstJoin(strLstNewVarLst(varLstNewStrLst(listStr)), ", "), "string1, string2", "variant list from string list");
|
|
||||||
|
|
||||||
TEST_RESULT_PTR(varLstNewStrLst(NULL), NULL, "variant list from null string list");
|
TEST_RESULT_PTR(varLstNewStrLst(NULL), NULL, "variant list from null string list");
|
||||||
}
|
}
|
||||||
|
@ -33,20 +33,17 @@ testRun(void)
|
|||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(cfgExecParam(cfgCmdArchiveGet, cfgCmdRoleAsync, NULL, false, true), "|"),
|
cfgExecParam(cfgCmdArchiveGet, cfgCmdRoleAsync, NULL, false, true),
|
||||||
strNewFmt(
|
"--archive-async\n--no-config\n--exec-id=1-test\n--log-subprocess\n--reset-neutral-umask\n"
|
||||||
"--archive-async|--no-config|--exec-id=1-test|--log-subprocess|--reset-neutral-umask"
|
"--pg1-path=\"" TEST_PATH "/db path\"\n--pg2-path=/db2\n--repo1-path=" TEST_PATH "/repo\n--stanza=test1\n"
|
||||||
"|--pg1-path=\"%s/db path\"|--pg2-path=/db2|--repo1-path=%s/repo|--stanza=test1|archive-get:async",
|
"archive-get:async\n",
|
||||||
testPath(), testPath()),
|
|
||||||
"exec archive-get -> archive-get:async");
|
"exec archive-get -> archive-get:async");
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(cfgExecParam(cfgCmdBackup, cfgCmdRoleDefault, NULL, false, false), "|"),
|
cfgExecParam(cfgCmdBackup, cfgCmdRoleDefault, NULL, false, false),
|
||||||
strNewFmt(
|
"--archive-timeout=5\n--no-config\n--exec-id=1-test\n--log-subprocess\n--reset-neutral-umask\n"
|
||||||
"--archive-timeout=5|--no-config|--exec-id=1-test|--log-subprocess|--reset-neutral-umask|--pg1-path=%s/db path"
|
"--pg1-path=" TEST_PATH "/db path\n--pg2-path=/db2\n--repo1-path=" TEST_PATH "/repo\n--stanza=test1\nbackup\n",
|
||||||
"|--pg2-path=/db2|--repo1-path=%s/repo|--stanza=test1|backup",
|
|
||||||
testPath(), testPath()),
|
|
||||||
"exec archive-get -> backup");
|
"exec archive-get -> backup");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -71,12 +68,10 @@ testRun(void)
|
|||||||
kvPut(optionReplace, varNewStr(strNew("stanza")), NULL);
|
kvPut(optionReplace, varNewStr(strNew("stanza")), NULL);
|
||||||
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_PATH), VARSTRDEF("/log"));
|
kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_PATH), VARSTRDEF("/log"));
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(cfgExecParam(cfgCmdRestore, cfgCmdRoleDefault, optionReplace, true, false), "|"),
|
cfgExecParam(cfgCmdRestore, cfgCmdRoleDefault, optionReplace, true, false),
|
||||||
strNewFmt(
|
"--db-include=1\n--db-include=2\n--exec-id=1-test\n--log-path=/log\n--pg1-path=" TEST_PATH "/db path\n"
|
||||||
"--db-include=1|--db-include=2|--exec-id=1-test|--log-path=/log|--pg1-path=%s/db path|--recovery-option=a=b"
|
"--recovery-option=a=b\n--recovery-option=c=d\n--repo1-path=/replace/path\nrestore\n",
|
||||||
"|--recovery-option=c=d|--repo1-path=/replace/path|restore",
|
|
||||||
testPath()),
|
|
||||||
"exec restore -> restore");
|
"exec restore -> restore");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,9 +1127,8 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNew("000000010000000200000003"));
|
strLstAdd(argList, strNew("000000010000000200000003"));
|
||||||
strLstAdd(argList, strNew("/path/to/wal/RECOVERYWAL"));
|
strLstAdd(argList, strNew("/path/to/wal/RECOVERYWAL"));
|
||||||
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList), false), "command arguments");
|
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList), false), "command arguments");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(cfgCommandParam(), "|"), "000000010000000200000003|/path/to/wal/RECOVERYWAL",
|
cfgCommandParam(), "000000010000000200000003\n/path/to/wal/RECOVERYWAL\n", " check command arguments");
|
||||||
" check command arguments");
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -1152,7 +1151,7 @@ testRun(void)
|
|||||||
TEST_RESULT_UINT(cfgLogLevelDefault(), logLevelInfo, " backup defaults to log level warn");
|
TEST_RESULT_UINT(cfgLogLevelDefault(), logLevelInfo, " backup defaults to log level warn");
|
||||||
TEST_RESULT_BOOL(cfgLogFile(), true, " backup command does file logging");
|
TEST_RESULT_BOOL(cfgLogFile(), true, " backup command does file logging");
|
||||||
TEST_RESULT_BOOL(cfgLockRemoteRequired(), true, " backup command requires remote lock");
|
TEST_RESULT_BOOL(cfgLockRemoteRequired(), true, " backup command requires remote lock");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(cfgCommandParam(), "|"), "", " check command arguments");
|
TEST_RESULT_STRLST_Z(cfgCommandParam(), NULL, " check command arguments");
|
||||||
TEST_RESULT_UINT(cfgCommandRoleEnum(NULL), cfgCmdRoleDefault, "command role default enum");
|
TEST_RESULT_UINT(cfgCommandRoleEnum(NULL), cfgCmdRoleDefault, "command role default enum");
|
||||||
TEST_ERROR(cfgCommandRoleEnum(STRDEF("bogus")), CommandInvalidError, "invalid command role 'bogus'");
|
TEST_ERROR(cfgCommandRoleEnum(STRDEF("bogus")), CommandInvalidError, "invalid command role 'bogus'");
|
||||||
TEST_RESULT_INT(cfgCommandRole(), cfgCmdRoleDefault, " command role is default");
|
TEST_RESULT_INT(cfgCommandRole(), cfgCmdRoleDefault, " command role is default");
|
||||||
|
@ -55,8 +55,8 @@ testRun(void)
|
|||||||
varLstAdd(list, varNewStr(strNew("repo1-host")));
|
varLstAdd(list, varNewStr(strNew("repo1-host")));
|
||||||
varLstAdd(list, varNewStr(strNew("repo1-host-user")));
|
varLstAdd(list, varNewStr(strNew("repo1-host-user")));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstNewVarLst(configProtocolOption(client, list)), "|"), "repo-host|repo-host-user",
|
strLstNewVarLst(configProtocolOption(client, list)), "repo-host\nrepo-host-user\n",
|
||||||
"get options");
|
"get options");
|
||||||
|
|
||||||
protocolClientFree(client);
|
protocolClientFree(client);
|
||||||
|
@ -203,30 +203,29 @@ testRun(void)
|
|||||||
|
|
||||||
// infoBackupDataLabelList and infoBackupDataDelete
|
// infoBackupDataLabelList and infoBackupDataDelete
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "),
|
strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc),
|
||||||
"20161219-212741F, 20161219-212741F_20161219-212803D, 20161219-212741F_20161219-212918I",
|
"20161219-212741F\n20161219-212741F_20161219-212803D\n20161219-212741F_20161219-212918I\n",
|
||||||
"infoBackupDataLabelList without expression");
|
"infoBackupDataLabelList without expression");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
strLstSort(
|
||||||
strLstSort(
|
infoBackupDataLabelList(
|
||||||
infoBackupDataLabelList(
|
infoBackup, backupRegExpP(.full = true, .differential = true, .incremental = true)), sortOrderAsc),
|
||||||
infoBackup, backupRegExpP(.full = true, .differential = true, .incremental = true)), sortOrderAsc), ", "),
|
"20161219-212741F\n20161219-212741F_20161219-212803D\n20161219-212741F_20161219-212918I\n",
|
||||||
"20161219-212741F, 20161219-212741F_20161219-212803D, 20161219-212741F_20161219-212918I",
|
|
||||||
"infoBackupDataLabelList with expression");
|
"infoBackupDataLabelList with expression");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.full=true)), ", "), "20161219-212741F", " full=true");
|
infoBackupDataLabelList(infoBackup, backupRegExpP(.full=true)), "20161219-212741F\n", " full=true");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.differential=true)), ", "),
|
infoBackupDataLabelList(infoBackup, backupRegExpP(.differential=true)), "20161219-212741F_20161219-212803D\n",
|
||||||
"20161219-212741F_20161219-212803D", "differential=true");
|
"differential=true");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.incremental=true)), ", "),
|
infoBackupDataLabelList(infoBackup, backupRegExpP(.incremental=true)), "20161219-212741F_20161219-212918I\n",
|
||||||
"20161219-212741F_20161219-212918I", "incremental=true");
|
"incremental=true");
|
||||||
|
|
||||||
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212918I")), "delete a backup");
|
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212918I")), "delete a backup");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "),
|
strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc),
|
||||||
"20161219-212741F, 20161219-212741F_20161219-212803D", " backup deleted");
|
"20161219-212741F\n20161219-212741F_20161219-212803D\n", " backup deleted");
|
||||||
|
|
||||||
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212803D")), "delete all backups");
|
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212803D")), "delete all backups");
|
||||||
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F")), " deleted");
|
TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F")), " deleted");
|
||||||
@ -425,9 +424,9 @@ testRun(void)
|
|||||||
TEST_RESULT_STR_Z(backupData.backupArchiveStop, "000000030000028500000090", "archive stop set");
|
TEST_RESULT_STR_Z(backupData.backupArchiveStop, "000000030000028500000090", "archive stop set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupType, "diff", "backup type set");
|
TEST_RESULT_STR_Z(backupData.backupType, "diff", "backup type set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupPrior, "20190818-084502F", "backup prior set");
|
TEST_RESULT_STR_Z(backupData.backupPrior, "20190818-084502F", "backup prior set");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(backupData.backupReference, ", "),
|
backupData.backupReference,
|
||||||
"20190818-084502F, 20190818-084502F_20190819-084506D, 20190818-084502F_20190819-084506I",
|
"20190818-084502F\n20190818-084502F_20190819-084506D\n20190818-084502F_20190819-084506I\n",
|
||||||
"backup reference set and ordered");
|
"backup reference set and ordered");
|
||||||
TEST_RESULT_BOOL(backupData.optionArchiveCheck, true, "option archive check");
|
TEST_RESULT_BOOL(backupData.optionArchiveCheck, true, "option archive check");
|
||||||
TEST_RESULT_BOOL(backupData.optionArchiveCopy, true, "option archive copy");
|
TEST_RESULT_BOOL(backupData.optionArchiveCopy, true, "option archive copy");
|
||||||
@ -687,16 +686,14 @@ testRun(void)
|
|||||||
storagePathCreateP(storageRepoWrite(), strNew(STORAGE_REPO_BACKUP "/20190818-084502F")),
|
storagePathCreateP(storageRepoWrite(), strNew(STORAGE_REPO_BACKUP "/20190818-084502F")),
|
||||||
"create backup on disk that is in current but no manifest");
|
"create backup on disk that is in current but no manifest");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
strLstSort(
|
||||||
strLstSort(
|
storageListP(
|
||||||
storageListP(
|
storageRepo(), STORAGE_REPO_BACKUP_STR,
|
||||||
storageRepo(), STORAGE_REPO_BACKUP_STR,
|
.expression = backupRegExpP(.full = true, .differential = true, .incremental = true)),
|
||||||
.expression = backupRegExpP(.full = true, .differential = true, .incremental = true)),
|
sortOrderAsc),
|
||||||
sortOrderAsc),
|
"20190818-084444F\n20190818-084502F\n20190818-084502F_20190820-084502I\n20190818-084555F\n20190818-084666F\n"
|
||||||
", "),
|
"20190818-084777F\n20190923-164324F\n", "confirm backups on disk");
|
||||||
"20190818-084444F, 20190818-084502F, 20190818-084502F_20190820-084502I, 20190818-084555F, 20190818-084666F, "
|
|
||||||
"20190818-084777F, 20190923-164324F", "confirm backups on disk");
|
|
||||||
|
|
||||||
// With the infoBackup from above, upgrade the DB so there a 2 histories then save to disk
|
// With the infoBackup from above, upgrade the DB so there a 2 histories then save to disk
|
||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
@ -805,9 +802,9 @@ testRun(void)
|
|||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
infoBackup, infoBackupLoadFileReconstruct(storageRepo(), INFO_BACKUP_PATH_FILE_STR, cipherTypeNone, NULL),
|
infoBackup, infoBackupLoadFileReconstruct(storageRepo(), INFO_BACKUP_PATH_FILE_STR, cipherTypeNone, NULL),
|
||||||
"reconstruct");
|
"reconstruct");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "),
|
infoBackupDataLabelList(infoBackup, NULL),
|
||||||
"20190818-084444F, 20190818-084444F_20190924-084502D, 20190923-164324F",
|
"20190818-084444F\n20190818-084444F_20190924-084502D\n20190923-164324F\n",
|
||||||
"previously ignored pgId=1 manifest copy-only now added before existing, and add dependent found");
|
"previously ignored pgId=1 manifest copy-only now added before existing, and add dependent found");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 WARN: backup '20190818-084444F' found in repository added to backup.info\n"
|
"P00 WARN: backup '20190818-084444F' found in repository added to backup.info\n"
|
||||||
@ -925,27 +922,26 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F")), "full");
|
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F")), "full");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(dependencyList, ", "),
|
dependencyList,
|
||||||
"20200317-181625F, 20200317-181625F_20200317-182239D, 20200317-181625F_20200317-182300D, "
|
"20200317-181625F\n20200317-181625F_20200317-182239D\n20200317-181625F_20200317-182300D\n"
|
||||||
"20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I, 20200317-181625F_20200317-182340D",
|
"20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n20200317-181625F_20200317-182340D\n",
|
||||||
"all dependents");
|
"all dependents");
|
||||||
|
|
||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181416F")), "full");
|
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181416F")), "full");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(dependencyList, ", "), "20200317-181416F", "no dependents");
|
TEST_RESULT_STRLST_Z(dependencyList, "20200317-181416F\n", "no dependents");
|
||||||
|
|
||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182300D")), "diff");
|
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182300D")), "diff");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(dependencyList, ", "),
|
dependencyList,
|
||||||
"20200317-181625F_20200317-182300D, 20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I",
|
"20200317-181625F_20200317-182300D\n20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n",
|
||||||
"all dependents");
|
"all dependents");
|
||||||
|
|
||||||
TEST_ASSIGN(
|
TEST_ASSIGN(
|
||||||
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182324I")), "incr");
|
dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182324I")), "incr");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(dependencyList, ", "), "20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I",
|
dependencyList, "20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n", "all dependents");
|
||||||
"all dependents");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,40 +126,30 @@ testRun(void)
|
|||||||
TEST_RESULT_UINT(
|
TEST_RESULT_UINT(
|
||||||
pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF00000001"), 0x40000000), 0xFFFFFFFF40000000, "1G wal segment to lsn");
|
pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF00000001"), 0x40000000), 0xFFFFFFFF40000000, "1G wal segment to lsn");
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
pgLsnRangeToWalSegmentList(
|
||||||
pgLsnRangeToWalSegmentList(
|
PG_VERSION_92, 1, pgLsnFromStr(STRDEF("1/60")), pgLsnFromStr(STRDEF("1/60")), 16 * 1024 * 1024),
|
||||||
PG_VERSION_92, 1, pgLsnFromStr(STRDEF("1/60")), pgLsnFromStr(STRDEF("1/60")), 16 * 1024 * 1024),
|
"000000010000000100000000\n", "get single");
|
||||||
", "),
|
TEST_RESULT_STRLST_Z(
|
||||||
"000000010000000100000000", "get single");
|
pgLsnRangeToWalSegmentList(
|
||||||
TEST_RESULT_STR_Z(
|
PG_VERSION_92, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/1000000")), 16 * 1024 * 1024),
|
||||||
strLstJoin(
|
"0000000200000001000000FD\n0000000200000001000000FE\n000000020000000200000000\n000000020000000200000001\n",
|
||||||
pgLsnRangeToWalSegmentList(
|
|
||||||
PG_VERSION_92, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/1000000")), 16 * 1024 * 1024),
|
|
||||||
", "),
|
|
||||||
"0000000200000001000000FD, 0000000200000001000000FE, 000000020000000200000000, 000000020000000200000001",
|
|
||||||
"get range <= 9.2");
|
"get range <= 9.2");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
pgLsnRangeToWalSegmentList(
|
||||||
pgLsnRangeToWalSegmentList(
|
PG_VERSION_93, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024),
|
||||||
PG_VERSION_93, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024),
|
"0000000200000001000000FD\n0000000200000001000000FE\n0000000200000001000000FF\n000000020000000200000000\n",
|
||||||
", "),
|
|
||||||
"0000000200000001000000FD, 0000000200000001000000FE, 0000000200000001000000FF, 000000020000000200000000",
|
|
||||||
"get range > 9.2");
|
"get range > 9.2");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
pgLsnRangeToWalSegmentList(
|
||||||
pgLsnRangeToWalSegmentList(
|
PG_VERSION_11, 2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024),
|
||||||
PG_VERSION_11, 2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024),
|
"000000020000000A00000000\n000000020000000A00000001\n000000020000000A00000002\n000000020000000A00000003\n"
|
||||||
", "),
|
"000000020000000B00000000\n000000020000000B00000001\n000000020000000B00000002\n000000020000000B00000003\n",
|
||||||
"000000020000000A00000000, 000000020000000A00000001, 000000020000000A00000002, 000000020000000A00000003"
|
|
||||||
", 000000020000000B00000000, 000000020000000B00000001, 000000020000000B00000002, 000000020000000B00000003",
|
|
||||||
"get range >= 11/1GB");
|
"get range >= 11/1GB");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(
|
pgLsnRangeToWalSegmentList(
|
||||||
pgLsnRangeToWalSegmentList(
|
PG_VERSION_11, 3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024),
|
||||||
PG_VERSION_11, 3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024),
|
"000000030000000700000FFE\n000000030000000700000FFF\n000000030000000800000000\n000000030000000800000001\n",
|
||||||
", "),
|
|
||||||
"000000030000000700000FFE, 000000030000000700000FFF, 000000030000000800000000, 000000030000000800000001",
|
|
||||||
"get range >= 11/1MB");
|
"get range >= 11/1MB");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,10 +225,10 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "archive-get");
|
strLstAddZ(argList, "archive-get");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolLocalParam(protocolStorageTypeRepo, 0, 0), "|"),
|
protocolLocalParam(protocolStorageTypeRepo, 0, 0),
|
||||||
"--exec-id=1-test|--log-level-console=off|--log-level-file=off|--log-level-stderr=error|--pg1-path=/path/to/pg"
|
"--exec-id=1-test\n--log-level-console=off\n--log-level-file=off\n--log-level-stderr=error\n--pg1-path=/path/to/pg\n"
|
||||||
"|--process=0|--remote-type=repo|--stanza=test1|archive-get:local",
|
"--process=0\n--remote-type=repo\n--stanza=test1\narchive-get:local\n",
|
||||||
"local repo protocol params");
|
"local repo protocol params");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -241,10 +241,10 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "backup");
|
strLstAddZ(argList, "backup");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolLocalParam(protocolStorageTypePg, 0, 1), "|"),
|
protocolLocalParam(protocolStorageTypePg, 0, 1),
|
||||||
"--exec-id=1-test|--log-level-console=off|--log-level-file=info|--log-level-stderr=error|--log-subprocess|--pg=1"
|
"--exec-id=1-test\n--log-level-console=off\n--log-level-file=info\n--log-level-stderr=error\n--log-subprocess\n--pg=1\n"
|
||||||
"|--pg1-path=/pg|--process=1|--remote-type=pg|--stanza=test1|backup:local",
|
"--pg1-path=/pg\n--process=1\n--remote-type=pg\n--stanza=test1\nbackup:local\n",
|
||||||
"local pg protocol params");
|
"local pg protocol params");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,11 +266,11 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "archive-get");
|
strLstAddZ(argList, "archive-get");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
|
protocolRemoteParam(protocolStorageTypeRepo, 0),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\nrepo-host-user@repo-host\n"
|
||||||
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --stanza=test1 archive-get:remote",
|
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --stanza=test1 archive-get:remote\n",
|
||||||
"remote protocol params");
|
"remote protocol params");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -289,12 +289,12 @@ testRun(void)
|
|||||||
strLstAddZ(argList, CFGCMD_CHECK);
|
strLstAddZ(argList, CFGCMD_CHECK);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
|
protocolRemoteParam(protocolStorageTypeRepo, 0),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\n-p\n444\nrepo-host-user@repo-host\n"
|
||||||
"|pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
|
"pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
|
||||||
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
|
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
|
||||||
" --pg1-path=/unused --process=0 --remote-type=repo --stanza=test1 check:remote",
|
" --pg1-path=/unused --process=0 --remote-type=repo --stanza=test1 check:remote\n",
|
||||||
"remote protocol params with replacements");
|
"remote protocol params with replacements");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -308,11 +308,11 @@ testRun(void)
|
|||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"),
|
protocolRemoteParam(protocolStorageTypeRepo, 0),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npgbackrest@repo-host\n"
|
||||||
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --stanza=test1 archive-get:remote",
|
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --stanza=test1 archive-get:remote\n",
|
||||||
"remote protocol params for backup local");
|
"remote protocol params for backup local");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -325,11 +325,11 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "backup");
|
strLstAddZ(argList, "backup");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 0), "|"),
|
protocolRemoteParam(protocolStorageTypePg, 0),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg1-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg1-host\n"
|
||||||
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote",
|
" --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote\n",
|
||||||
"remote protocol params for db backup");
|
"remote protocol params for db backup");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -347,11 +347,11 @@ testRun(void)
|
|||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"),
|
protocolRemoteParam(protocolStorageTypePg, 1),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg2-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg2-host\n"
|
||||||
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote",
|
" --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote\n",
|
||||||
"remote protocol params for db local");
|
"remote protocol params for db local");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -369,12 +369,12 @@ testRun(void)
|
|||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"),
|
protocolRemoteParam(protocolStorageTypePg, 1),
|
||||||
"-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg3-host"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg3-host\n"
|
||||||
"|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1"
|
" --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1"
|
||||||
" backup:remote",
|
" backup:remote\n",
|
||||||
"remote protocol params for db local");
|
"remote protocol params for db local");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,17 +455,16 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(storageNewWriteP(storageTest, strNew(".aaa.txt")), BUFSTRDEF("aaa")), "write aaa.text");
|
storagePutP(storageNewWriteP(storageTest, strNew(".aaa.txt")), BUFSTRDEF("aaa")), "write aaa.text");
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
strLstJoin(strLstSort(storageListP(storageTest, NULL), sortOrderAsc), ", "),
|
strLstSort(storageListP(storageTest, NULL), sortOrderAsc), ".aaa.txt\n"
|
||||||
".aaa.txt"
|
|
||||||
#ifdef TEST_CONTAINER_REQUIRED
|
#ifdef TEST_CONTAINER_REQUIRED
|
||||||
", noperm"
|
"noperm\n"
|
||||||
#endif // TEST_CONTAINER_REQUIRED
|
#endif // TEST_CONTAINER_REQUIRED
|
||||||
, "dir list");
|
, "dir list");
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(storageNewWriteP(storageTest, strNew("bbb.txt")), BUFSTRDEF("bbb")), "write bbb.text");
|
storagePutP(storageNewWriteP(storageTest, strNew("bbb.txt")), BUFSTRDEF("bbb")), "write bbb.text");
|
||||||
TEST_RESULT_STR_Z(strLstJoin(storageListP(storageTest, NULL, .expression = strNew("^bbb")), ", "), "bbb.txt", "dir list");
|
TEST_RESULT_STRLST_Z(storageListP(storageTest, NULL, .expression = strNew("^bbb")), "bbb.txt\n", "dir list");
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
|
Reference in New Issue
Block a user