mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Replace TEST_ERROR_FMT() with TEST_ERROR() where possible.
Some calls did not need TEST_ERROR_FMT() at all and others could be converted by replacing parameters with available defines, e.g. TEST_PATH.
This commit is contained in:
parent
a4f057bb70
commit
6baad5cdd1
@ -609,7 +609,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_ERROR_FMT(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
||||||
|
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
|
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
|
||||||
@ -630,7 +630,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--archive-async");
|
strLstAddZ(argList, "--archive-async");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_ERROR_FMT(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
||||||
|
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
|
"P00 WARN: repo1: [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/test1/archive.info' or '"
|
||||||
|
@ -58,7 +58,7 @@ testRun(void)
|
|||||||
{.function = NULL}
|
{.function = NULL}
|
||||||
});
|
});
|
||||||
|
|
||||||
TEST_ERROR_FMT(cmdCheck(), ConfigError, "no database found\nHINT: check indexed pg-path/pg-host configurations");
|
TEST_ERROR(cmdCheck(), ConfigError, "no database found\nHINT: check indexed pg-path/pg-host configurations");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432': error");
|
"P00 WARN: unable to check pg-1: [DbConnectError] unable to connect to 'dbname='postgres' port=5432': error");
|
||||||
|
|
||||||
@ -172,10 +172,11 @@ testRun(void)
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
cmdCheck(), DbMismatchError, "version '%s' and path '%s' queried from cluster do not match version '%s' and '%s'"
|
cmdCheck(), DbMismatchError,
|
||||||
" read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_92_STR
|
||||||
|
"' and '%s' read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
||||||
strZ(pgVersionToStr(PG_VERSION_92)), TEST_PATH, strZ(pgVersionToStr(PG_VERSION_92)), strZ(pg1Path), strZ(pg1Path));
|
strZ(pg1Path), strZ(pg1Path));
|
||||||
|
|
||||||
// Standby
|
// Standby
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -224,7 +225,7 @@ testRun(void)
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Error on primary but standby check ok
|
// Error on primary but standby check ok
|
||||||
TEST_ERROR_FMT(cmdCheck(), ArchiveDisabledError, "archive_mode must be enabled");
|
TEST_ERROR(cmdCheck(), ArchiveDisabledError, "archive_mode must be enabled");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: check repo1 (standby)\n"
|
"P00 INFO: check repo1 (standby)\n"
|
||||||
"P00 INFO: switch wal not performed because this is a standby");
|
"P00 INFO: switch wal not performed because this is a standby");
|
||||||
@ -248,15 +249,15 @@ testRun(void)
|
|||||||
// Stanza has not yet been created on repo2 but is created (and checked) on repo1
|
// Stanza has not yet been created on repo2 but is created (and checked) on repo1
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
cmdCheck(), FileMissingError,
|
cmdCheck(), FileMissingError,
|
||||||
"unable to load info file '%s/repo2/archive/test1/archive.info' or '%s/repo2/archive/test1/archive.info.copy':\n"
|
"unable to load info file '" TEST_PATH "/repo2/archive/test1/archive.info' or"
|
||||||
|
" '" TEST_PATH "/repo2/archive/test1/archive.info.copy':\n"
|
||||||
"FileMissingError: " STORAGE_ERROR_READ_MISSING "\n"
|
"FileMissingError: " STORAGE_ERROR_READ_MISSING "\n"
|
||||||
"FileMissingError: " STORAGE_ERROR_READ_MISSING "\n"
|
"FileMissingError: " STORAGE_ERROR_READ_MISSING "\n"
|
||||||
"HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
|
"HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
|
||||||
"HINT: is archive_command configured correctly in postgresql.conf?\n"
|
"HINT: is archive_command configured correctly in postgresql.conf?\n"
|
||||||
"HINT: has a stanza-create been performed?\n"
|
"HINT: has a stanza-create been performed?\n"
|
||||||
"HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.",
|
"HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.",
|
||||||
TEST_PATH, TEST_PATH, strZ(strNewFmt("%s/repo2/archive/test1/archive.info", TEST_PATH)),
|
TEST_PATH "/repo2/archive/test1/archive.info", TEST_PATH "/repo2/archive/test1/archive.info.copy");
|
||||||
strZ(strNewFmt("%s/repo2/archive/test1/archive.info.copy", TEST_PATH)));
|
|
||||||
harnessLogResult("P00 INFO: check repo1 (standby)\nP00 INFO: check repo2 (standby)");
|
harnessLogResult("P00 INFO: check repo1 (standby)\nP00 INFO: check repo2 (standby)");
|
||||||
|
|
||||||
// Single primary
|
// Single primary
|
||||||
@ -364,17 +365,15 @@ testRun(void)
|
|||||||
if (testBegin("checkDbConfig(), checkArchiveCommand()"))
|
if (testBegin("checkDbConfig(), checkArchiveCommand()"))
|
||||||
{
|
{
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(checkArchiveCommand(NULL), ArchiveCommandInvalidError, "archive_command '[null]' must contain " PROJECT_BIN);
|
||||||
checkArchiveCommand(NULL), ArchiveCommandInvalidError, "archive_command '[null]' must contain " PROJECT_BIN);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(checkArchiveCommand(strNew()), ArchiveCommandInvalidError, "archive_command '' must contain " PROJECT_BIN);
|
||||||
checkArchiveCommand(strNew()), ArchiveCommandInvalidError, "archive_command '' must contain " PROJECT_BIN);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkArchiveCommand(STRDEF("backrest")), ArchiveCommandInvalidError, "archive_command 'backrest' must contain "
|
checkArchiveCommand(STRDEF("backrest")), ArchiveCommandInvalidError,
|
||||||
PROJECT_BIN);
|
"archive_command 'backrest' must contain " PROJECT_BIN);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_RESULT_BOOL(checkArchiveCommand(STRDEF("pgbackrest --stanza=demo archive-push %p")), true, "archive_command valid");
|
TEST_RESULT_BOOL(checkArchiveCommand(STRDEF("pgbackrest --stanza=demo archive-push %p")), true, "archive_command valid");
|
||||||
@ -408,20 +407,19 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
|
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
|
||||||
"version '%s' and path '%s' queried from cluster do not match version '%s' and '%s' read from '%s/"
|
"version '" PG_VERSION_92_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_94_STR "' and"
|
||||||
PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
" '%s' read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
||||||
strZ(pgVersionToStr(PG_VERSION_92)), strZ(pg1Path), strZ(pgVersionToStr(PG_VERSION_94)), strZ(pg1Path), strZ(pg1Path));
|
strZ(pg1Path), strZ(pg1Path), strZ(pg1Path));
|
||||||
|
|
||||||
// Path mismatch
|
// Path mismatch
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
checkDbConfig(PG_VERSION_92, db.standbyIdx, db.standby, true), DbMismatchError,
|
checkDbConfig(PG_VERSION_92, db.standbyIdx, db.standby, true), DbMismatchError,
|
||||||
"version '%s' and path '%s' queried from cluster do not match version '%s' and '%s' read from '%s/"
|
"version '" PG_VERSION_92_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_92_STR "' and"
|
||||||
PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
" '%s' read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||||
"HINT: the pg8-path and pg8-port settings likely reference different clusters.",
|
"HINT: the pg8-path and pg8-port settings likely reference different clusters.",
|
||||||
strZ(pgVersionToStr(PG_VERSION_92)), strZ(dbPgDataPath(db.standby)), strZ(pgVersionToStr(PG_VERSION_92)), strZ(pg8Path),
|
strZ(dbPgDataPath(db.standby)), strZ(pg8Path), strZ(pg8Path));
|
||||||
strZ(pg8Path));
|
|
||||||
|
|
||||||
// archive-check=false
|
// archive-check=false
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -462,7 +460,7 @@ testRun(void)
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST_ASSIGN(db, dbGet(true, true, false), "get primary");
|
TEST_ASSIGN(db, dbGet(true, true, false), "get primary");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), FeatureNotSupportedError,
|
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), FeatureNotSupportedError,
|
||||||
"archive_mode=always not supported");
|
"archive_mode=always not supported");
|
||||||
|
|
||||||
@ -492,8 +490,9 @@ testRun(void)
|
|||||||
backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_96), NULL);
|
backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_96), NULL);
|
||||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError, "backup info file and archive info file do not match\n"
|
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 1, version = 9.6, system-id = 6569239123849665999\n"
|
"backup : id = 1, version = 9.6, system-id = 6569239123849665999\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -503,8 +502,9 @@ testRun(void)
|
|||||||
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
||||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError, "backup info file and archive info file do not match\n"
|
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 1, version = 9.5, system-id = 6569239123849665999\n"
|
"backup : id = 1, version = 9.5, system-id = 6569239123849665999\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -514,8 +514,9 @@ testRun(void)
|
|||||||
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
||||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError, "backup info file and archive info file do not match\n"
|
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 1, version = 9.5, system-id = 6569239123849665679\n"
|
"backup : id = 1, version = 9.5, system-id = 6569239123849665679\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -525,8 +526,9 @@ testRun(void)
|
|||||||
infoBackupPgSet(backupInfo, PG_VERSION_96, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_96));
|
infoBackupPgSet(backupInfo, PG_VERSION_96, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_96));
|
||||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError, "backup info file and archive info file do not match\n"
|
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
"backup : id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -552,7 +554,7 @@ testRun(void)
|
|||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||||
|
|
||||||
// Version mismatch
|
// Version mismatch
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfoPg(
|
checkStanzaInfoPg(
|
||||||
storageRepoIdx(0), PG_VERSION_94, 6569239123849665679, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
storageRepoIdx(0), PG_VERSION_94, 6569239123849665679, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
||||||
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
|
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
|
||||||
@ -562,7 +564,7 @@ testRun(void)
|
|||||||
"HINT: did an error occur during stanza-upgrade?");
|
"HINT: did an error occur during stanza-upgrade?");
|
||||||
|
|
||||||
// SystemId mismatch
|
// SystemId mismatch
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
checkStanzaInfoPg(
|
checkStanzaInfoPg(
|
||||||
storageRepoIdx(0), PG_VERSION_96, 6569239123849665699, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
storageRepoIdx(0), PG_VERSION_96, 6569239123849665699, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
||||||
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
|
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
|
||||||
|
@ -494,8 +494,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-host=/repo/not/local");
|
strLstAddZ(argList, "--repo1-host=/repo/not/local");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
harnessCfgLoad(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(cmdExpire(), HostInvalidError, "expire command must be run on the repository host");
|
||||||
cmdExpire(), HostInvalidError, "expire command must be run on the repository host");
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("check stop file");
|
TEST_TITLE("check stop file");
|
||||||
@ -508,7 +507,7 @@ testRun(void)
|
|||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), BUFSTRDEF("")),
|
storageNewWriteP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), BUFSTRDEF("")),
|
||||||
"create stop file");
|
"create stop file");
|
||||||
TEST_ERROR_FMT(cmdExpire(), StopError, "stop file exists for stanza db");
|
TEST_ERROR(cmdExpire(), StopError, "stop file exists for stanza db");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storageRemoveP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), "remove the stop file");
|
storageRemoveP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), "remove the stop file");
|
||||||
|
|
||||||
|
@ -2749,8 +2749,7 @@ testRun(void)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--set=bogus");
|
strLstAddZ(argList, "--set=bogus");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(harnessCfgLoad(cfgCmdInfo, argList), OptionInvalidError, "option 'set' not valid without option 'stanza'");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList), OptionInvalidError, "option 'set' not valid without option 'stanza'");
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("repo-level error");
|
TEST_TITLE("repo-level error");
|
||||||
|
@ -349,12 +349,11 @@ testRun(void)
|
|||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("postmaster.pid")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("postmaster.pid")), NULL);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restorePathValidate(), PgRunningError,
|
restorePathValidate(), PgRunningError,
|
||||||
"unable to restore while PostgreSQL is running\n"
|
"unable to restore while PostgreSQL is running\n"
|
||||||
"HINT: presence of 'postmaster.pid' in '%s/pg' indicates PostgreSQL is running.\n"
|
"HINT: presence of 'postmaster.pid' in '" TEST_PATH "/pg' indicates PostgreSQL is running.\n"
|
||||||
"HINT: remove 'postmaster.pid' only if PostgreSQL is not running.",
|
"HINT: remove 'postmaster.pid' only if PostgreSQL is not running.");
|
||||||
TEST_PATH);
|
|
||||||
|
|
||||||
storageRemoveP(storagePgWrite(), STRDEF("postmaster.pid"), .errorOnMissing = true);
|
storageRemoveP(storagePgWrite(), STRDEF("postmaster.pid"), .errorOnMissing = true);
|
||||||
|
|
||||||
@ -409,8 +408,8 @@ testRun(void)
|
|||||||
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 09:18:15-0700")), 1578500295, "epoch with timezone");
|
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 09:18:15-0700")), 1578500295, "epoch with timezone");
|
||||||
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 16:18:15.0000")), 1578500295, "same epoch no timezone");
|
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 16:18:15.0000")), 1578500295, "same epoch no timezone");
|
||||||
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 16:18:15.0000+00")), 1578500295, "same epoch timezone 0");
|
TEST_RESULT_INT(getEpoch(STRDEF("2020-01-08 16:18:15.0000+00")), 1578500295, "same epoch timezone 0");
|
||||||
TEST_ERROR_FMT(getEpoch(STRDEF("2020-13-08 16:18:15")), FormatError, "invalid date 2020-13-08");
|
TEST_ERROR(getEpoch(STRDEF("2020-13-08 16:18:15")), FormatError, "invalid date 2020-13-08");
|
||||||
TEST_ERROR_FMT(getEpoch(STRDEF("2020-01-08 16:68:15")), FormatError, "invalid time 16:68:15");
|
TEST_ERROR(getEpoch(STRDEF("2020-01-08 16:68:15")), FormatError, "invalid time 16:68:15");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("system time America/New_York");
|
TEST_TITLE("system time America/New_York");
|
||||||
@ -454,7 +453,7 @@ testRun(void)
|
|||||||
TEST_TITLE("error when no backups are present");
|
TEST_TITLE("error when no backups are present");
|
||||||
|
|
||||||
HRN_INFO_PUT(storageRepoWrite(), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoWrite(), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
TEST_ERROR_FMT(restoreBackupSet(), BackupSetInvalidError, "no backup set found to restore");
|
TEST_ERROR(restoreBackupSet(), BackupSetInvalidError, "no backup set found to restore");
|
||||||
TEST_RESULT_LOG("P00 WARN: repo1: [BackupSetInvalidError] no backup sets to restore");
|
TEST_RESULT_LOG("P00 WARN: repo1: [BackupSetInvalidError] no backup sets to restore");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -617,7 +616,7 @@ testRun(void)
|
|||||||
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
HRN_INFO_PUT(storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
|
|
||||||
TEST_ERROR_FMT(restoreBackupSet(), BackupSetInvalidError, "no backup set found to restore");
|
TEST_ERROR(restoreBackupSet(), BackupSetInvalidError, "no backup set found to restore");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: repo1: [BackupSetInvalidError] no backup sets to restore\n"
|
"P00 WARN: repo1: [BackupSetInvalidError] no backup sets to restore\n"
|
||||||
"P00 WARN: repo2: [BackupSetInvalidError] no backup sets to restore");
|
"P00 WARN: repo2: [BackupSetInvalidError] no backup sets to restore");
|
||||||
@ -1027,22 +1026,22 @@ testRun(void)
|
|||||||
|
|
||||||
userLocalData.userId = TEST_USER_ID + 1;
|
userLocalData.userId = TEST_USER_ID + 1;
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '%s/pg' not owned by current user", TEST_PATH);
|
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '" TEST_PATH "/pg' not owned by current user");
|
||||||
|
|
||||||
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
||||||
|
|
||||||
userLocalData.userRoot = true;
|
userLocalData.userRoot = true;
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '%s/pg' without rwx permissions", TEST_PATH);
|
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '" TEST_PATH "/pg' without rwx permissions");
|
||||||
|
|
||||||
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
||||||
|
|
||||||
userInitInternal();
|
userInitInternal();
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '%s/pg' without rwx permissions", TEST_PATH);
|
restoreCleanBuild(manifest), PathOpenError, "unable to restore to path '" TEST_PATH "/pg' without rwx permissions");
|
||||||
|
|
||||||
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
||||||
|
|
||||||
@ -1054,11 +1053,10 @@ testRun(void)
|
|||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_RECOVERYCONF_STR), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_RECOVERYCONF_STR), NULL);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restoreCleanBuild(manifest), PathNotEmptyError,
|
restoreCleanBuild(manifest), PathNotEmptyError,
|
||||||
"unable to restore to path '%s/pg' because it contains files\n"
|
"unable to restore to path '" TEST_PATH "/pg' because it contains files\n"
|
||||||
"HINT: try using --delta if this is what you intended.",
|
"HINT: try using --delta if this is what you intended.");
|
||||||
TEST_PATH);
|
|
||||||
|
|
||||||
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
TEST_RESULT_LOG("P00 DETAIL: check '" TEST_PATH "/pg' exists");
|
||||||
|
|
||||||
@ -1089,11 +1087,10 @@ testRun(void)
|
|||||||
storageRemoveP(storagePgWrite(), STRDEF("pg_hba.conf"));
|
storageRemoveP(storagePgWrite(), STRDEF("pg_hba.conf"));
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("../conf/pg_hba.conf")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("../conf/pg_hba.conf")), NULL);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
restoreCleanBuild(manifest), FileExistsError,
|
restoreCleanBuild(manifest), FileExistsError,
|
||||||
"unable to restore file '%s/conf/pg_hba.conf' because it already exists\n"
|
"unable to restore file '" TEST_PATH "/conf/pg_hba.conf' because it already exists\n"
|
||||||
"HINT: try using --delta if this is what you intended.",
|
"HINT: try using --delta if this is what you intended.");
|
||||||
TEST_PATH);
|
|
||||||
|
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
|
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
|
||||||
@ -2679,11 +2676,10 @@ testRun(void)
|
|||||||
// Set log level to warn
|
// Set log level to warn
|
||||||
harnessLogLevelSet(logLevelWarn);
|
harnessLogLevelSet(logLevelWarn);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdRestore(), FileMissingError,
|
cmdRestore(), FileMissingError,
|
||||||
"raised from local-1 shim protocol: unable to open missing file"
|
"raised from local-1 shim protocol: unable to open missing file"
|
||||||
" '%s/repo/backup/test1/20161219-212741F_20161219-212918I/pg_data/global/pg_control' for read",
|
" '" TEST_PATH "/repo/backup/test1/20161219-212741F_20161219-212918I/pg_data/global/pg_control' for read");
|
||||||
TEST_PATH);
|
|
||||||
|
|
||||||
// Free local processes that were not freed because of the error
|
// Free local processes that were not freed because of the error
|
||||||
protocolFree();
|
protocolFree();
|
||||||
|
@ -41,7 +41,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList), OptionInvalidError, "option 'repo' not valid for command 'stanza-create'");
|
harnessCfgLoad(cfgCmdStanzaCreate, argList), OptionInvalidError, "option 'repo' not valid for command 'stanza-create'");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -249,8 +249,9 @@ testRun(void)
|
|||||||
hrnCfgArgRawFmt(argListCmd, cfgOptStanza, "%s", strZ(stanza));
|
hrnCfgArgRawFmt(argListCmd, cfgOptStanza, "%s", strZ(stanza));
|
||||||
hrnCfgArgKeyRawFmt(argListCmd, cfgOptPgPath, 1, TEST_PATH "/%s", strZ(stanza));
|
hrnCfgArgKeyRawFmt(argListCmd, cfgOptPgPath, 1, TEST_PATH "/%s", strZ(stanza));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListCmd), OptionRequiredError, "stanza-delete command requires option: repo\n"
|
harnessCfgLoad(cfgCmdStanzaDelete, argListCmd), OptionRequiredError,
|
||||||
|
"stanza-delete command requires option: repo\n"
|
||||||
"HINT: this command requires a specific repository to operate on");
|
"HINT: this command requires a specific repository to operate on");
|
||||||
|
|
||||||
// Add the repo option
|
// Add the repo option
|
||||||
@ -258,8 +259,9 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "4");
|
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "4");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListDelete);
|
harnessCfgLoad(cfgCmdStanzaDelete, argListDelete);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaDelete(), FileMissingError, "stop file does not exist for stanza 'db'\n"
|
cmdStanzaDelete(), FileMissingError,
|
||||||
|
"stop file does not exist for stanza 'db'\n"
|
||||||
"HINT: has the pgbackrest stop command been run on this server for this stanza?");
|
"HINT: has the pgbackrest stop command been run on this server for this stanza?");
|
||||||
|
|
||||||
// Create the stop file
|
// Create the stop file
|
||||||
@ -313,8 +315,9 @@ testRun(void)
|
|||||||
"backup.info.copy removed repo2");
|
"backup.info.copy removed repo2");
|
||||||
TEST_RESULT_VOID(storageRemoveP(storageTest, backupInfoFileNameRepo2, .errorOnMissing = true),
|
TEST_RESULT_VOID(storageRemoveP(storageTest, backupInfoFileNameRepo2, .errorOnMissing = true),
|
||||||
"backup.info removed repo2");
|
"backup.info removed repo2");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "archive.info exists but backup.info is missing on repo2\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"archive.info exists but backup.info is missing on repo2\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 INFO: stanza-create for stanza 'db' on repo1\n"
|
"P00 INFO: stanza-create for stanza 'db' on repo1\n"
|
||||||
@ -327,8 +330,9 @@ testRun(void)
|
|||||||
"archive.info.copy removed repo1");
|
"archive.info.copy removed repo1");
|
||||||
TEST_RESULT_VOID(storageRemoveP(storageTest, archiveInfoFileName, .errorOnMissing = true),
|
TEST_RESULT_VOID(storageRemoveP(storageTest, archiveInfoFileName, .errorOnMissing = true),
|
||||||
"archive.info removed repo1");
|
"archive.info removed repo1");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "backup.info exists but archive.info is missing on repo1\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"backup.info exists but archive.info is missing on repo1\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
@ -355,8 +359,9 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storageRemoveP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)), .errorOnMissing = true),
|
storageRemoveP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)), .errorOnMissing = true),
|
||||||
"backup.info.copy removed");
|
"backup.info.copy removed");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "backup.info exists but archive.info is missing on repo1\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"backup.info exists but archive.info is missing on repo1\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
@ -366,8 +371,9 @@ testRun(void)
|
|||||||
storageNewReadP(storageTest, backupInfoFileName),
|
storageNewReadP(storageTest, backupInfoFileName),
|
||||||
storageNewWriteP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)))),
|
storageNewWriteP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)))),
|
||||||
"backup.info moved to backup.info.copy");
|
"backup.info moved to backup.info.copy");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "backup.info exists but archive.info is missing on repo1\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"backup.info exists but archive.info is missing on repo1\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
@ -379,8 +385,9 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storageRemoveP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)), .errorOnMissing = true),
|
storageRemoveP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(backupInfoFileName)), .errorOnMissing = true),
|
||||||
"backup.info.copy removed");
|
"backup.info.copy removed");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "archive.info exists but backup.info is missing on repo1\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"archive.info exists but backup.info is missing on repo1\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
@ -390,8 +397,9 @@ testRun(void)
|
|||||||
storageNewReadP(storageTest, archiveInfoFileName),
|
storageNewReadP(storageTest, archiveInfoFileName),
|
||||||
storageNewWriteP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileName)))),
|
storageNewWriteP(storageTest, strNewFmt("%s" INFO_COPY_EXT, strZ(archiveInfoFileName)))),
|
||||||
"archive.info moved to archive.info.copy");
|
"archive.info moved to archive.info.copy");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileMissingError, "archive.info exists but backup.info is missing on repo1\n"
|
cmdStanzaCreate(), FileMissingError,
|
||||||
|
"archive.info exists but backup.info is missing on repo1\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
@ -416,8 +424,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageTest, backupInfoFileName), harnessInfoChecksum(contentBackup)),
|
storageNewWriteP(storageTest, backupInfoFileName), harnessInfoChecksum(contentBackup)),
|
||||||
"put backup info to file - bad db-id");
|
"put backup info to file - bad db-id");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileInvalidError, "backup info file and archive info file do not match\n"
|
cmdStanzaCreate(), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
"backup : id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -462,8 +471,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageTest, archiveInfoFileName), harnessInfoChecksum(contentArchive)),
|
storageNewWriteP(storageTest, archiveInfoFileName), harnessInfoChecksum(contentArchive)),
|
||||||
"put archive info file");
|
"put archive info file");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileInvalidError, "backup and archive info files exist but do not match the database\n"
|
cmdStanzaCreate(), FileInvalidError,
|
||||||
|
"backup and archive info files exist but do not match the database\n"
|
||||||
"HINT: is this the correct stanza?\n"
|
"HINT: is this the correct stanza?\n"
|
||||||
"HINT: did an error occur during stanza-upgrade?");
|
"HINT: did an error occur during stanza-upgrade?");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
@ -502,8 +512,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageTest, backupInfoFileName), harnessInfoChecksum(contentBackup)),
|
storageNewWriteP(storageTest, backupInfoFileName), harnessInfoChecksum(contentBackup)),
|
||||||
"put backup info to file");
|
"put backup info to file");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaCreate(), FileInvalidError, "backup and archive info files exist but do not match the database\n"
|
cmdStanzaCreate(), FileInvalidError,
|
||||||
|
"backup and archive info files exist but do not match the database\n"
|
||||||
"HINT: is this the correct stanza?\n"
|
"HINT: is this the correct stanza?\n"
|
||||||
"HINT: did an error occur during stanza-upgrade?");
|
"HINT: did an error occur during stanza-upgrade?");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
@ -515,7 +526,7 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePathCreateP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))),
|
storagePathCreateP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))),
|
||||||
"create directory in backup");
|
"create directory in backup");
|
||||||
TEST_ERROR_FMT(cmdStanzaCreate(), PathNotEmptyError, "backup directory not empty");
|
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "backup directory not empty");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
// File in archive, directory in backup
|
// File in archive, directory in backup
|
||||||
@ -523,20 +534,20 @@ testRun(void)
|
|||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageTest, strNewFmt("%s/somefile", strZ(archiveStanzaPath))), BUFSTRDEF("some content")),
|
storageNewWriteP(storageTest, strNewFmt("%s/somefile", strZ(archiveStanzaPath))), BUFSTRDEF("some content")),
|
||||||
"create file in archive");
|
"create file in archive");
|
||||||
TEST_ERROR_FMT(cmdStanzaCreate(), PathNotEmptyError, "backup directory and/or archive directory not empty");
|
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "backup directory and/or archive directory not empty");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
// File in archive, backup empty
|
// File in archive, backup empty
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePathRemoveP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))), "remove backup subdir");
|
storagePathRemoveP(storageTest, strNewFmt("%s/backup.history", strZ(backupStanzaPath))), "remove backup subdir");
|
||||||
TEST_ERROR_FMT(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
||||||
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
harnessLogResult("P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
|
|
||||||
// Repeat last test using --force (deprecated)
|
// Repeat last test using --force (deprecated)
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--force");
|
strLstAddZ(argList, "--force");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
||||||
TEST_ERROR_FMT(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
||||||
harnessLogResult(
|
harnessLogResult(
|
||||||
"P00 WARN: option --force is no longer supported\n"
|
"P00 WARN: option --force is no longer supported\n"
|
||||||
"P00 INFO: stanza-create for stanza 'db' on repo1");
|
"P00 INFO: stanza-create for stanza 'db' on repo1");
|
||||||
@ -599,10 +610,11 @@ testRun(void)
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
pgValidate(), DbMismatchError, "version '%s' and path '%s' queried from cluster do not match version '%s' and '%s'"
|
pgValidate(), DbMismatchError,
|
||||||
" read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
"version '" PG_VERSION_92_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_91_STR "' and "
|
||||||
|
"'%s' read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
"HINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
||||||
strZ(pgVersionToStr(PG_VERSION_92)), strZ(pg1Path), strZ(pgVersionToStr(PG_VERSION_91)), strZ(pg1Path), strZ(pg1Path));
|
strZ(pg1Path), strZ(pg1Path), strZ(pg1Path));
|
||||||
|
|
||||||
// Path mismatch
|
// Path mismatch
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -618,10 +630,10 @@ testRun(void)
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
pgValidate(), DbMismatchError, "version '%s' and path '%s' queried from cluster do not match version '%s' and '%s'"
|
pgValidate(), DbMismatchError,
|
||||||
" read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
|
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "/pg2' queried from cluster do not match version '"
|
||||||
|
PG_VERSION_92_STR "' and '%s' read from '%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
|
||||||
"'\nHINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
"'\nHINT: the pg1-path and pg1-port settings likely reference different clusters.",
|
||||||
strZ(pgVersionToStr(PG_VERSION_92)), TEST_PATH "/pg2", strZ(pgVersionToStr(PG_VERSION_92)),
|
|
||||||
strZ(pg1Path), strZ(pg1Path));
|
strZ(pg1Path), strZ(pg1Path));
|
||||||
|
|
||||||
// Primary at pg2
|
// Primary at pg2
|
||||||
@ -673,7 +685,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argList), OptionInvalidError,
|
harnessCfgLoad(cfgCmdStanzaUpgrade, argList), OptionInvalidError,
|
||||||
"option 'repo' not valid for command 'stanza-upgrade'");
|
"option 'repo' not valid for command 'stanza-upgrade'");
|
||||||
|
|
||||||
@ -743,8 +755,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageTest, archiveInfoFileName), harnessInfoChecksum(contentArchive)),
|
storageNewWriteP(storageTest, archiveInfoFileName), harnessInfoChecksum(contentArchive)),
|
||||||
"put archive info to file");
|
"put archive info to file");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaUpgrade(), FileInvalidError, "backup info file and archive info file do not match\n"
|
cmdStanzaUpgrade(), FileInvalidError,
|
||||||
|
"backup info file and archive info file do not match\n"
|
||||||
"archive: id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
"archive: id = 2, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"backup : id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
"backup : id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||||
"HINT: this may be a symptom of repository corruption!");
|
"HINT: this may be a symptom of repository corruption!");
|
||||||
@ -1056,8 +1069,7 @@ testRun(void)
|
|||||||
"create stop file");
|
"create stop file");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
cmdStanzaDelete(), FileRemoveError,
|
cmdStanzaDelete(), FileRemoveError,
|
||||||
"unable to remove '%s/repo/backup/%s/20190708-154306F/backup.manifest': [20] Not a directory", TEST_PATH,
|
"unable to remove '" TEST_PATH "/repo/backup/%s/20190708-154306F/backup.manifest': [20] Not a directory", strZ(stanza));
|
||||||
strZ(stanza));
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storageRemoveP(storageTest, strNewFmt("repo/backup/%s/20190708-154306F", strZ(stanza))), "remove backup directory");
|
storageRemoveP(storageTest, strNewFmt("repo/backup/%s/20190708-154306F", strZ(stanza))), "remove backup directory");
|
||||||
|
|
||||||
@ -1112,7 +1124,7 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(storageNewWriteP(storageTest, strNewFmt("%s/" PG_FILE_POSTMASTERPID, strZ(stanza))), BUFSTRDEF("")),
|
storagePutP(storageNewWriteP(storageTest, strNewFmt("%s/" PG_FILE_POSTMASTERPID, strZ(stanza))), BUFSTRDEF("")),
|
||||||
"create pid file");
|
"create pid file");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. "
|
cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. "
|
||||||
"To delete stanza 'db' on repo1, shut down " PG_NAME " for stanza 'db' and try again, or use --force.");
|
"To delete stanza 'db' on repo1, shut down " PG_NAME " for stanza 'db' and try again, or use --force.");
|
||||||
|
|
||||||
@ -1126,7 +1138,7 @@ testRun(void)
|
|||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageTest, strNewFmt("repo2/backup/%s/backup.info", strZ(stanza))), BUFSTRDEF("")),
|
storageNewWriteP(storageTest, strNewFmt("repo2/backup/%s/backup.info", strZ(stanza))), BUFSTRDEF("")),
|
||||||
"create backup.info");
|
"create backup.info");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. "
|
cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. "
|
||||||
"To delete stanza 'db' on repo2, shut down " PG_NAME " for stanza 'db' and try again, or use --force.");
|
"To delete stanza 'db' on repo2, shut down " PG_NAME " for stanza 'db' and try again, or use --force.");
|
||||||
|
|
||||||
|
@ -937,11 +937,11 @@ testRun(void)
|
|||||||
BUFSTRDEF("12\n"));
|
BUFSTRDEF("12\n"));
|
||||||
|
|
||||||
// Tablespace link errors when correct verion not found
|
// Tablespace link errors when correct verion not found
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
manifestNewBuild(storagePg, PG_VERSION_12, hrnPgCatalogVersion(PG_VERSION_12), false, false, NULL, NULL),
|
manifestNewBuild(storagePg, PG_VERSION_12, hrnPgCatalogVersion(PG_VERSION_12), false, false, NULL, NULL),
|
||||||
FileOpenError,
|
FileOpenError,
|
||||||
"unable to get info for missing path/file '%s/pg/pg_tblspc/1/PG_12_201909212': [2] No such file or directory",
|
"unable to get info for missing path/file '" TEST_PATH "/pg/pg_tblspc/1/PG_12_201909212': [2] No such file or"
|
||||||
TEST_PATH);
|
" directory");
|
||||||
|
|
||||||
// Remove the link inside pg/pg_tblspc
|
// Remove the link inside pg/pg_tblspc
|
||||||
THROW_ON_SYS_ERROR(unlink(TEST_PATH "/pg/pg_tblspc/1") == -1, FileRemoveError, "unable to remove symlink");
|
THROW_ON_SYS_ERROR(unlink(TEST_PATH "/pg/pg_tblspc/1") == -1, FileRemoveError, "unable to remove symlink");
|
||||||
|
@ -168,7 +168,7 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(repoIsLocal(0), true, "repo is local");
|
TEST_RESULT_BOOL(repoIsLocal(0), true, "repo is local");
|
||||||
TEST_RESULT_VOID(repoIsLocalVerify(), " local verified");
|
TEST_RESULT_VOID(repoIsLocalVerify(), " local verified");
|
||||||
TEST_RESULT_VOID(repoIsLocalVerifyIdx(0), " local by index verified");
|
TEST_RESULT_VOID(repoIsLocalVerifyIdx(0), " local by index verified");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
repoIsLocalVerifyIdx(cfgOptionGroupIdxTotal(cfgOptGrpRepo) - 1), HostInvalidError,
|
repoIsLocalVerifyIdx(cfgOptionGroupIdxTotal(cfgOptGrpRepo) - 1), HostInvalidError,
|
||||||
"archive-get command must be run on the repository host");
|
"archive-get command must be run on the repository host");
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ testRun(void)
|
|||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_BOOL(repoIsLocal(0), false, "repo is remote");
|
TEST_RESULT_BOOL(repoIsLocal(0), false, "repo is remote");
|
||||||
TEST_ERROR_FMT(repoIsLocalVerify(), HostInvalidError, "archive-get command must be run on the repository host");
|
TEST_ERROR(repoIsLocalVerify(), HostInvalidError, "archive-get command must be run on the repository host");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("pg1 is local");
|
TEST_TITLE("pg1 is local");
|
||||||
@ -210,7 +210,7 @@ testRun(void)
|
|||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
TEST_RESULT_BOOL(pgIsLocal(0), false, "pg1 is remote");
|
TEST_RESULT_BOOL(pgIsLocal(0), false, "pg1 is remote");
|
||||||
TEST_ERROR_FMT(pgIsLocalVerify(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
TEST_ERROR(pgIsLocalVerify(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("pg7 is not local");
|
TEST_TITLE("pg7 is not local");
|
||||||
|
@ -297,7 +297,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
storageInfoListP(storageTest, STRDEF(BOGUS_STR), (StorageInfoListCallback)1, NULL, .errorOnMissing = true),
|
storageInfoListP(storageTest, STRDEF(BOGUS_STR), (StorageInfoListCallback)1, NULL, .errorOnMissing = true),
|
||||||
PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING, strZ(strNewFmt("%s/BOGUS", TEST_PATH)));
|
PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING, TEST_PATH "/BOGUS");
|
||||||
|
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
storageInfoListP(storageTest, STRDEF(BOGUS_STR), (StorageInfoListCallback)1, NULL), false, "ignore missing dir");
|
storageInfoListP(storageTest, STRDEF(BOGUS_STR), (StorageInfoListCallback)1, NULL), false, "ignore missing dir");
|
||||||
@ -432,7 +432,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
storageListP(storageTest, STRDEF(BOGUS_STR), .errorOnMissing = true), PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING,
|
storageListP(storageTest, STRDEF(BOGUS_STR), .errorOnMissing = true), PathMissingError, STORAGE_ERROR_LIST_INFO_MISSING,
|
||||||
strZ(strNewFmt("%s/BOGUS", TEST_PATH)));
|
TEST_PATH "/BOGUS");
|
||||||
|
|
||||||
TEST_RESULT_PTR(storageListP(storageTest, STRDEF(BOGUS_STR), .nullOnMissing = true), NULL, "null for missing dir");
|
TEST_RESULT_PTR(storageListP(storageTest, STRDEF(BOGUS_STR), .nullOnMissing = true), NULL, "null for missing dir");
|
||||||
TEST_RESULT_UINT(strLstSize(storageListP(storageTest, STRDEF(BOGUS_STR))), 0, "empty list for missing dir");
|
TEST_RESULT_UINT(strLstSize(storageListP(storageTest, STRDEF(BOGUS_STR))), 0, "empty list for missing dir");
|
||||||
@ -633,16 +633,16 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub1")), "create sub1");
|
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub1")), "create sub1");
|
||||||
TEST_RESULT_INT(storageInfoP(storageTest, STRDEF("sub1")).mode, 0750, "check sub1 dir mode");
|
TEST_RESULT_INT(storageInfoP(storageTest, STRDEF("sub1")).mode, 0750, "check sub1 dir mode");
|
||||||
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub1")), "create sub1 again");
|
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub1")), "create sub1 again");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storagePathCreateP(storageTest, STRDEF("sub1"), .errorOnExists = true), PathCreateError,
|
storagePathCreateP(storageTest, STRDEF("sub1"), .errorOnExists = true), PathCreateError,
|
||||||
"unable to create path '%s/sub1': [17] File exists", TEST_PATH);
|
"unable to create path '" TEST_PATH "/sub1': [17] File exists");
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub2"), .mode = 0777), "create sub2 with custom mode");
|
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub2"), .mode = 0777), "create sub2 with custom mode");
|
||||||
TEST_RESULT_INT(storageInfoP(storageTest, STRDEF("sub2")).mode, 0777, "check sub2 dir mode");
|
TEST_RESULT_INT(storageInfoP(storageTest, STRDEF("sub2")).mode, 0777, "check sub2 dir mode");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storagePathCreateP(storageTest, STRDEF("sub3/sub4"), .noParentCreate = true), PathCreateError,
|
storagePathCreateP(storageTest, STRDEF("sub3/sub4"), .noParentCreate = true), PathCreateError,
|
||||||
"unable to create path '%s/sub3/sub4': [2] No such file or directory", TEST_PATH);
|
"unable to create path '" TEST_PATH "/sub3/sub4': [2] No such file or directory");
|
||||||
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub3/sub4")), "create sub3/sub4");
|
TEST_RESULT_VOID(storagePathCreateP(storageTest, STRDEF("sub3/sub4")), "create sub3/sub4");
|
||||||
|
|
||||||
TEST_RESULT_INT(system(strZ(strNewFmt("rm -rf %s/sub*", TEST_PATH))), 0, "remove sub paths");
|
TEST_RESULT_INT(system(strZ(strNewFmt("rm -rf %s/sub*", TEST_PATH))), 0, "remove sub paths");
|
||||||
@ -815,9 +815,9 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
Storage *storageTest = storagePosixNewP(STRDEF("/"), .write = true);
|
Storage *storageTest = storagePosixNewP(STRDEF("/"), .write = true);
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageGetP(storageNewReadP(storageTest, TEST_PATH_STR)), FileReadError,
|
storageGetP(storageNewReadP(storageTest, TEST_PATH_STR)), FileReadError,
|
||||||
"unable to read '%s': [21] Is a directory", TEST_PATH);
|
"unable to read '" TEST_PATH "': [21] Is a directory");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
const String *emptyFile = STRDEF(TEST_PATH "/test.empty");
|
const String *emptyFile = STRDEF(TEST_PATH "/test.empty");
|
||||||
@ -848,9 +848,9 @@ testRun(void)
|
|||||||
TEST_RESULT_UINT(bufSize(buffer), 4, "check size");
|
TEST_RESULT_UINT(bufSize(buffer), 4, "check size");
|
||||||
TEST_RESULT_BOOL(memcmp(bufPtrConst(buffer), "TEST", bufSize(buffer)) == 0, true, "check content");
|
TEST_RESULT_BOOL(memcmp(bufPtrConst(buffer), "TEST", bufSize(buffer)) == 0, true, "check content");
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageGetP(storageNewReadP(storageTest, STRDEF(TEST_PATH "/test.txt")), .exactSize = 64), FileReadError,
|
storageGetP(storageNewReadP(storageTest, STRDEF(TEST_PATH "/test.txt")), .exactSize = 64), FileReadError,
|
||||||
"unable to read 64 byte(s) from '%s/test.txt'", TEST_PATH);
|
"unable to read 64 byte(s) from '" TEST_PATH "/test.txt'");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
ioBufferSizeSet(2);
|
ioBufferSizeSet(2);
|
||||||
@ -878,9 +878,9 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_RESULT_VOID(storageRemoveP(storageTest, STRDEF("missing")), "remove missing file");
|
TEST_RESULT_VOID(storageRemoveP(storageTest, STRDEF("missing")), "remove missing file");
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageRemoveP(storageTest, STRDEF("missing"), .errorOnMissing = true), FileRemoveError,
|
storageRemoveP(storageTest, STRDEF("missing"), .errorOnMissing = true), FileRemoveError,
|
||||||
"unable to remove '%s/missing': [2] No such file or directory", TEST_PATH);
|
"unable to remove '" TEST_PATH "/missing': [2] No such file or directory");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
const String *fileExists = STRDEF(TEST_PATH "/exists");
|
const String *fileExists = STRDEF(TEST_PATH "/exists");
|
||||||
|
@ -337,8 +337,7 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
strZ(strNewBuf(storageGetP(storageNewReadP(storageRemote, STRDEF("test.txt"))))), FileMissingError,
|
strZ(strNewBuf(storageGetP(storageNewReadP(storageRemote, STRDEF("test.txt"))))), FileMissingError,
|
||||||
"raised from remote-0 protocol on 'localhost': " STORAGE_ERROR_READ_MISSING,
|
"raised from remote-0 protocol on 'localhost': " STORAGE_ERROR_READ_MISSING, TEST_PATH "/repo/test.txt");
|
||||||
strZ(strNewFmt("%s/repo/test.txt", TEST_PATH)));
|
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storageTest, STRDEF("repo/test.txt")), contentBuf);
|
storagePutP(storageNewWriteP(storageTest, STRDEF("repo/test.txt")), contentBuf);
|
||||||
|
|
||||||
@ -623,10 +622,9 @@ testRun(void)
|
|||||||
varLstAdd(paramList, varNewBool(true)); // noParentCreate (true=error if it does not have a parent, false=create parent)
|
varLstAdd(paramList, varNewBool(true)); // noParentCreate (true=error if it does not have a parent, false=create parent)
|
||||||
varLstAdd(paramList, varNewUInt64(0)); // path mode
|
varLstAdd(paramList, varNewUInt64(0)); // path mode
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageRemotePathCreateProtocol(paramList, server), PathCreateError,
|
storageRemotePathCreateProtocol(paramList, server), PathCreateError,
|
||||||
"raised from remote-0 protocol on 'localhost': unable to create path '%s/repo/testpath': [17] File exists",
|
"raised from remote-0 protocol on 'localhost': unable to create path '" TEST_PATH "/repo/testpath': [17] File exists");
|
||||||
TEST_PATH);
|
|
||||||
|
|
||||||
// Error if parent path not exist
|
// Error if parent path not exist
|
||||||
path = STRDEF("parent/testpath");
|
path = STRDEF("parent/testpath");
|
||||||
@ -636,10 +634,10 @@ testRun(void)
|
|||||||
varLstAdd(paramList, varNewBool(true)); // noParentCreate (true=error if it does not have a parent, false=create parent)
|
varLstAdd(paramList, varNewBool(true)); // noParentCreate (true=error if it does not have a parent, false=create parent)
|
||||||
varLstAdd(paramList, varNewUInt64(0)); // path mode
|
varLstAdd(paramList, varNewUInt64(0)); // path mode
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageRemotePathCreateProtocol(paramList, server), PathCreateError,
|
storageRemotePathCreateProtocol(paramList, server), PathCreateError,
|
||||||
"raised from remote-0 protocol on 'localhost': unable to create path '%s/repo/parent/testpath': "
|
"raised from remote-0 protocol on 'localhost': unable to create path '" TEST_PATH "/repo/parent/testpath': [2] No such"
|
||||||
"[2] No such file or directory", TEST_PATH);
|
" file or directory");
|
||||||
|
|
||||||
// Create parent and path with default mode
|
// Create parent and path with default mode
|
||||||
paramList = varLstNew();
|
paramList = varLstNew();
|
||||||
@ -716,10 +714,10 @@ testRun(void)
|
|||||||
varLstAdd(paramList, varNewStr(strNewFmt(TEST_PATH "/repo/%s", strZ(file))));
|
varLstAdd(paramList, varNewStr(strNewFmt(TEST_PATH "/repo/%s", strZ(file))));
|
||||||
varLstAdd(paramList, varNewBool(true));
|
varLstAdd(paramList, varNewBool(true));
|
||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR(
|
||||||
storageRemoteRemoveProtocol(paramList, server), FileRemoveError,
|
storageRemoteRemoveProtocol(paramList, server), FileRemoveError,
|
||||||
"raised from remote-0 protocol on 'localhost': unable to remove '%s/repo/file.txt': "
|
"raised from remote-0 protocol on 'localhost': unable to remove '" TEST_PATH "/repo/file.txt': [2] No such file or"
|
||||||
"[2] No such file or directory", TEST_PATH);
|
" directory");
|
||||||
|
|
||||||
paramList = varLstNew();
|
paramList = varLstNew();
|
||||||
varLstAdd(paramList, varNewStr(strNewFmt(TEST_PATH "/repo/%s", strZ(file))));
|
varLstAdd(paramList, varNewStr(strNewFmt(TEST_PATH "/repo/%s", strZ(file))));
|
||||||
@ -762,8 +760,7 @@ testRun(void)
|
|||||||
varLstAdd(paramList, varNewStrZ(TEST_PATH "/repo/anewpath"));
|
varLstAdd(paramList, varNewStrZ(TEST_PATH "/repo/anewpath"));
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
storageRemotePathSyncProtocol(paramList, server), PathMissingError,
|
storageRemotePathSyncProtocol(paramList, server), PathMissingError,
|
||||||
"raised from remote-0 protocol on 'localhost': " STORAGE_ERROR_PATH_SYNC_MISSING,
|
"raised from remote-0 protocol on 'localhost': " STORAGE_ERROR_PATH_SYNC_MISSING, TEST_PATH "/repo/anewpath");
|
||||||
strZ(strNewFmt("%s/repo/anewpath", TEST_PATH)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protocolFree();
|
protocolFree();
|
||||||
|
Loading…
Reference in New Issue
Block a user