pgbackrest.git / summary / log / commit / refs
commit 0a65e59b5591718e46a4c331fa5301c41d49155d
Author: David Steele <david@pgmasters.net>
Date: Fri Jun 11 23:16:25 2021 +0000
Update pg-path options in db test module to be valid.
This allows files to be saved in the paths, which would have failed when they were invalid.
test/src/module/db/dbTest.c | 74 ++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/test/src/module/db/dbTest.c b/test/src/module/db/dbTest.c
index e58c49ceb..446281337 100644
--- a/test/src/module/db/dbTest.c
+++ b/test/src/module/db/dbTest.c
@@ -1,15 +1,15 @@
/***********************************************************************************************************************************
Test Database
***********************************************************************************************************************************/
+#include "common/io/fdRead.h"
+#include "common/io/fdWrite.h"
+#include "common/type/json.h"
+
#include "common/harnessConfig.h"
#include "common/harnessFork.h"
#include "common/harnessLog.h"
#include "common/harnessPq.h"
-#include "common/io/fdRead.h"
-#include "common/io/fdWrite.h"
-#include "common/type/json.h"
-
/***********************************************************************************************************************************
Macro to check that replay is making progress -- this does not seem useful enough to be included in the pq harness header
***********************************************************************************************************************************/
@@ -71,7 +71,7 @@ testRun(void)
// Set options
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
- strLstAddZ(argList, "--pg1-path=/path/to/pg");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG);
strLstAddZ(argList, "--pg1-database=testdb");
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
strLstAddZ(argList, "--process=0");
@@ -83,13 +83,13 @@ testRun(void)
HRNPQ_MACRO_OPEN(1, "dbname='testdb' port=5432"),
HRNPQ_MACRO_SET_SEARCH_PATH(1),
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
- HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_84, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_84, TEST_PATH_PG, NULL, NULL),
HRNPQ_MACRO_CLOSE(1),
HRNPQ_MACRO_OPEN(1, "dbname='testdb' port=5432"),
HRNPQ_MACRO_SET_SEARCH_PATH(1),
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
- HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_84, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_84, TEST_PATH_PG, NULL, NULL),
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000030000000200000003"),
HRNPQ_MACRO_CLOSE(1),
@@ -147,7 +147,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-retention-full=1");
- strLstAddZ(argList, "--pg1-path=/pg1");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG "1");
strLstAddZ(argList, "--pg1-database=backupdb");
HRN_CFG_LOAD(cfgCmdBackup, argList);
@@ -205,7 +205,7 @@ testRun(void)
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_LE_91(1, "dbname='backupdb' port=5432", PG_VERSION_83, "/pg1", NULL, NULL),
+ HRNPQ_MACRO_OPEN_LE_91(1, "dbname='backupdb' port=5432", PG_VERSION_83, TEST_PATH_PG "1", NULL, NULL),
// Get advisory lock
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
@@ -232,7 +232,7 @@ testRun(void)
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, "/pg1", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH_PG "1", false, NULL, NULL),
// Get start time
HRNPQ_MACRO_TIME_QUERY(1, 1000),
@@ -288,7 +288,7 @@ testRun(void)
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, "/pg1", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH_PG "1", false, NULL, NULL),
// Start backup when backup is in progress
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
@@ -327,7 +327,7 @@ testRun(void)
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_GE_96(1, "dbname='backupdb' port=5432", PG_VERSION_96, "/pg1", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_96(1, "dbname='backupdb' port=5432", PG_VERSION_96, TEST_PATH_PG "1", false, NULL, NULL),
// Start backup
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
@@ -362,18 +362,18 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-retention-full=1");
- strLstAddZ(argList, "--pg1-path=/pg1");
- strLstAddZ(argList, "--pg2-path=/pg2");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG "1");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, TEST_PATH_PG "2");
strLstAddZ(argList, "--pg2-port=5433");
HRN_CFG_LOAD(cfgCmdBackup, argList);
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_95, "/pg1", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH_PG "1", false, NULL, NULL),
// Connect to standby
- HRNPQ_MACRO_OPEN_GE_92(2, "dbname='postgres' port=5433", PG_VERSION_95, "/pg2", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(2, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH_PG "2", true, NULL, NULL),
// Start backup
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
@@ -405,10 +405,10 @@ testRun(void)
harnessPqScriptSet((HarnessPq [])
{
// Connect to primary
- HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_10, "/pg1", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH_PG "1", false, NULL, NULL),
// Connect to standby
- HRNPQ_MACRO_OPEN_GE_96(2, "dbname='postgres' port=5433", PG_VERSION_10, "/pg2", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_96(2, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH_PG "2", true, NULL, NULL),
// Start backup
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
@@ -502,7 +502,7 @@ testRun(void)
StringList *argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-retention-full=1");
- strLstAddZ(argList, "--pg1-path=/path/to/pg");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG "1");
strLstAddZ(argList, "--pg1-user=bob");
HRN_CFG_LOAD(cfgCmdBackup, argList);
@@ -527,7 +527,7 @@ testRun(void)
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
HRNPQ_MACRO_SET_SEARCH_PATH(1),
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
- HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH_PG, NULL, NULL),
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
HRNPQ_MACRO_IS_STANDBY_QUERY(1, true),
HRNPQ_MACRO_CLOSE(1),
@@ -544,7 +544,7 @@ testRun(void)
HRNPQ_MACRO_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
HRNPQ_MACRO_SET_SEARCH_PATH(1),
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
- HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH_PG, NULL, NULL),
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
HRNPQ_MACRO_IS_STANDBY_QUERY(1, false),
HRNPQ_MACRO_CLOSE(1),
@@ -557,7 +557,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
harnessPqScriptSet((HarnessPq [])
{
- HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_84, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_84, TEST_PATH_PG "1", NULL, NULL),
HRNPQ_MACRO_CLOSE(1),
HRNPQ_MACRO_DONE()
});
@@ -569,7 +569,7 @@ testRun(void)
TEST_RESULT_INT(result.standbyIdx, 0, " check standby id");
TEST_RESULT_BOOL(result.standby == NULL, true, " check standby");
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_84, " version set");
- TEST_RESULT_STR_Z(dbPgDataPath(result.primary), "/pgdata", " path set");
+ TEST_RESULT_STR_Z(dbPgDataPath(result.primary), TEST_PATH_PG "1", " path set");
TEST_RESULT_VOID(dbFree(result.primary), "free primary");
@@ -578,15 +578,15 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-retention-full=1");
- strLstAddZ(argList, "--pg1-path=/path/to/pg1");
- strLstAddZ(argList, "--pg8-path=/path/to/pg2");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG "1");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, TEST_PATH_PG "8");
strLstAddZ(argList, "--pg8-port=5433");
HRN_CFG_LOAD(cfgCmdBackup, argList);
harnessPqScriptSet((HarnessPq [])
{
- HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432", PG_VERSION_84, "/pgdata", NULL, NULL),
- HRNPQ_MACRO_OPEN_LE_91(8, "dbname='postgres' port=5433", PG_VERSION_84, "/pgdata", NULL, NULL),
+ HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432", PG_VERSION_84, TEST_PATH_PG "1", NULL, NULL),
+ HRNPQ_MACRO_OPEN_LE_91(8, "dbname='postgres' port=5433", PG_VERSION_84, TEST_PATH_PG "8", NULL, NULL),
HRNPQ_MACRO_CLOSE(1),
HRNPQ_MACRO_CLOSE(8),
@@ -600,8 +600,8 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
harnessPqScriptSet((HarnessPq [])
{
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
- HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/pgdata", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG "1", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH_PG "8", true, NULL, NULL),
HRNPQ_MACRO_CLOSE(8),
HRNPQ_MACRO_CLOSE(1),
@@ -615,8 +615,8 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
harnessPqScriptSet((HarnessPq [])
{
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
- HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/pgdata", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG "1", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH_PG "8", true, NULL, NULL),
HRNPQ_MACRO_CLOSE(8),
HRNPQ_MACRO_CLOSE(1),
@@ -638,19 +638,19 @@ testRun(void)
argList = strLstNew();
strLstAddZ(argList, "--stanza=test1");
strLstAddZ(argList, "--repo1-retention-full=1");
- strLstAddZ(argList, "--pg1-path=/path/to/pg1");
- strLstAddZ(argList, "--pg4-path=/path/to/pg4");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, TEST_PATH_PG "1");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 4, TEST_PATH_PG "4");
strLstAddZ(argList, "--pg4-port=5433");
strLstAddZ(argList, "--pg5-host=localhost");
strLstAddZ(argList, "--pg5-host-user=" TEST_USER);
- strLstAddZ(argList, "--pg5-path=/path/to/pg5");
- strLstAddZ(argList, "--pg8-path=/path/to/pg8");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 5, TEST_PATH_PG "5");
+ hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, TEST_PATH_PG "8");
strLstAddZ(argList, "--pg8-port=5434");
HRN_CFG_LOAD(cfgCmdBackup, argList);
harnessPqScriptSet((HarnessPq [])
{
- HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG "1", true, NULL, NULL),
// pg-4 error
{.session = 4, .function = HRNPQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
@@ -658,7 +658,7 @@ testRun(void)
{.session = 4, .function = HRNPQ_ERRORMESSAGE, .resultZ = "error"},
{.session = 4, .function = HRNPQ_FINISH},
- HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5434", PG_VERSION_92, "/pgdata", false, NULL, NULL),
+ HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5434", PG_VERSION_92, TEST_PATH_PG "8", false, NULL, NULL),
HRNPQ_MACRO_CREATE_RESTORE_POINT(8, "2/3"),
HRNPQ_MACRO_WAL_SWITCH(8, "xlog", "000000010000000200000003"),
[parent: 97155bad8600]