You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-09 00:45:49 +02:00
Remove TEST_PATH_REPO, TEST_PATH_PG, and TEST_PATH_SPOOL constants.
It seems better to use TEST_PATH in combination with a constant string rather than have a number of different path constants. This improves readability and reduces confusion about which constant should be used.
This commit is contained in:
@ -31,8 +31,8 @@ testRun(void)
|
||||
// Load Parameters
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
@ -58,7 +58,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -70,10 +70,10 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, "/path/to/standby2");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPort, 8, "5433");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoHost, 2, "repo.domain.com");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
@ -98,7 +98,7 @@ testRun(void)
|
||||
// Standby only, repo remote but only one pg-path configured
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoHost, 1, "repo.domain.com");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
@ -112,15 +112,15 @@ testRun(void)
|
||||
|
||||
// Only confirming we get passed the check for repoIsLocal || more than one pg-path configured
|
||||
TEST_ERROR(
|
||||
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/global/pg_control' for read");
|
||||
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH "/pg/global/pg_control' for read");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("backup-standby set without standby");
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
hrnCfgArgRawBool(argList, cfgOptBackupStandby, true);
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
@ -128,13 +128,13 @@ testRun(void)
|
||||
// Primary database connection ok
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
TEST_ERROR(
|
||||
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/global/pg_control' for read");
|
||||
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH "/pg/global/pg_control' for read");
|
||||
TEST_RESULT_LOG("P00 WARN: option 'backup-standby' is enabled but standby is not properly configured");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -142,8 +142,8 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, TEST_PATH "/pg8");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPort, 8, "5433");
|
||||
@ -169,7 +169,7 @@ testRun(void)
|
||||
TEST_ERROR(
|
||||
cmdCheck(), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_92_STR
|
||||
"' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/global/pg_control'\n"
|
||||
"' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n"
|
||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -206,7 +206,7 @@ testRun(void)
|
||||
// Single repo config - error when checking archive mode setting on database
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", false, "off", NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -231,7 +231,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
@ -261,8 +261,8 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
@ -293,7 +293,7 @@ testRun(void)
|
||||
// Error when WAL segment not found
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -322,7 +322,7 @@ testRun(void)
|
||||
// WAL segment switch is performed once for all repos
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -341,7 +341,7 @@ testRun(void)
|
||||
"P00 INFO: check repo1 configuration (primary)\n"
|
||||
"P00 INFO: check repo2 configuration (primary)\n"
|
||||
"P00 INFO: check repo1 archive for WAL (primary)\n"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH_REPO "/archive/test1/9.2-1/"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo/archive/test1/9.2-1/"
|
||||
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo1\n"
|
||||
"P00 INFO: check repo2 archive for WAL (primary)\n"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo2/archive/test1/9.2-1/"
|
||||
@ -359,7 +359,7 @@ testRun(void)
|
||||
{
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 5, "localhost");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 5, "pgbackrest-bogus");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 5, "/path/to/pg5");
|
||||
@ -396,17 +396,17 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, TEST_PATH "/pg8");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPort, 8, "5433");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
DbGetResult db = {0};
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/badpath", true, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -423,8 +423,8 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH_PG "' queried from cluster do not match version '"
|
||||
PG_VERSION_94_STR "' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/global/pg_control'\n"
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
|
||||
PG_VERSION_94_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n"
|
||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -450,10 +450,10 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, TEST_PATH "/pg8");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPort, 8, "5433");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
@ -467,13 +467,13 @@ testRun(void)
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH_PG, false, "always", NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, "always", NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -565,8 +565,8 @@ testRun(void)
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawBool(argList, cfgOptOnline, false);
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 1, TEST_CIPHER_PASS);
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
Reference in New Issue
Block a user