You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
Remove forks from command/archive-get test.
These were required to deal with the legacy Perl code being unable to load new options between tests. The C code does not have this issue so remove the forks and update process ids in the log tests.
This commit is contained in:
@ -525,15 +525,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "archive-get");
|
strLstAddZ(argList, "archive-get");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "WAL segment to get required");
|
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "WAL segment to get required");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListTemp = strLstDup(argList);
|
StringList *argListTemp = strLstDup(argList);
|
||||||
@ -541,15 +533,7 @@ testRun(void)
|
|||||||
strLstAdd(argListTemp, walSegment);
|
strLstAdd(argListTemp, walSegment);
|
||||||
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "path to copy WAL segment required");
|
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "path to copy WAL segment required");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -562,11 +546,6 @@ testRun(void)
|
|||||||
strLstAdd(argListTemp, walFile);
|
strLstAdd(argListTemp, walFile);
|
||||||
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
||||||
|
|
||||||
// Test this in a fork so we can use different Perl options in later tests
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
cmdArchiveGet(), FileMissingError,
|
cmdArchiveGet(), FileMissingError,
|
||||||
"unable to load info file '%s/archive/test1/archive.info' or '%s/archive/test1/archive.info.copy':\n"
|
"unable to load info file '%s/archive/test1/archive.info' or '%s/archive/test1/archive.info.copy':\n"
|
||||||
@ -580,10 +559,6 @@ testRun(void)
|
|||||||
strZ(cfgOptionStr(cfgOptRepoPath)), strZ(cfgOptionStr(cfgOptRepoPath)),
|
strZ(cfgOptionStr(cfgOptRepoPath)), strZ(cfgOptionStr(cfgOptRepoPath)),
|
||||||
strZ(strNewFmt("%s/archive/test1/archive.info", strZ(cfgOptionStr(cfgOptRepoPath)))),
|
strZ(strNewFmt("%s/archive/test1/archive.info", strZ(cfgOptionStr(cfgOptRepoPath)))),
|
||||||
strZ(strNewFmt("%s/archive/test1/archive.info.copy", strZ(cfgOptionStr(cfgOptRepoPath)))));
|
strZ(strNewFmt("%s/archive/test1/archive.info.copy", strZ(cfgOptionStr(cfgOptRepoPath)))));
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
@ -592,11 +567,6 @@ testRun(void)
|
|||||||
strLstAddZ(argListTemp, "--archive-async");
|
strLstAddZ(argListTemp, "--archive-async");
|
||||||
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
harnessCfgLoadRaw(strLstSize(argListTemp), strLstPtr(argListTemp));
|
||||||
|
|
||||||
// Test this in a fork so we can use different Perl options in later tests
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
cmdArchiveGet(), FileMissingError,
|
cmdArchiveGet(), FileMissingError,
|
||||||
"unable to load info file '%s/archive/test1/archive.info' or '%s/archive/test1/archive.info.copy':\n"
|
"unable to load info file '%s/archive/test1/archive.info' or '%s/archive/test1/archive.info.copy':\n"
|
||||||
@ -610,10 +580,6 @@ testRun(void)
|
|||||||
strZ(cfgOptionStr(cfgOptRepoPath)), strZ(cfgOptionStr(cfgOptRepoPath)),
|
strZ(cfgOptionStr(cfgOptRepoPath)), strZ(cfgOptionStr(cfgOptRepoPath)),
|
||||||
strZ(strNewFmt("%s/archive/test1/archive.info", strZ(cfgOptionStr(cfgOptRepoPath)))),
|
strZ(strNewFmt("%s/archive/test1/archive.info", strZ(cfgOptionStr(cfgOptRepoPath)))),
|
||||||
strZ(strNewFmt("%s/archive/test1/archive.info.copy", strZ(cfgOptionStr(cfgOptRepoPath)))));
|
strZ(strNewFmt("%s/archive/test1/archive.info.copy", strZ(cfgOptionStr(cfgOptRepoPath)))));
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
// Make sure the process times out when there is nothing to get
|
// Make sure the process times out when there is nothing to get
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -625,33 +591,17 @@ testRun(void)
|
|||||||
|
|
||||||
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 1, "timeout getting WAL segment");
|
TEST_RESULT_INT(cmdArchiveGet(), 1, "timeout getting WAL segment");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
harnessLogResult("P01 INFO: unable to find 000000010000000100000001 in the archive");
|
harnessLogResult("P00 INFO: unable to find 000000010000000100000001 in the archive");
|
||||||
|
|
||||||
// Check for missing WAL
|
// Check for missing WAL
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
storagePutP(storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s.ok", strZ(walSegment))), NULL);
|
storagePutP(storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s.ok", strZ(walSegment))), NULL);
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 1, "successful get of missing WAL");
|
TEST_RESULT_INT(cmdArchiveGet(), 1, "successful get of missing WAL");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
harnessLogResult("P01 INFO: unable to find 000000010000000100000001 in the archive");
|
harnessLogResult("P00 INFO: unable to find 000000010000000100000001 in the archive");
|
||||||
|
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
storageExistsP(storageSpool(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s.ok", strZ(walSegment))), false,
|
storageExistsP(storageSpool(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s.ok", strZ(walSegment))), false,
|
||||||
@ -663,17 +613,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment))),
|
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment))),
|
||||||
BUFSTRDEF("SHOULD-BE-A-REAL-WAL-FILE"));
|
BUFSTRDEF("SHOULD-BE-A-REAL-WAL-FILE"));
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
|
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessLogResult("P01 INFO: found 000000010000000100000001 in the archive"), "check log");
|
TEST_RESULT_VOID(harnessLogResult("P00 INFO: found 000000010000000100000001 in the archive"), "check log");
|
||||||
|
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
storageExistsP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment))), false,
|
storageExistsP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment))), false,
|
||||||
@ -695,17 +637,9 @@ testRun(void)
|
|||||||
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment2))),
|
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strZ(walSegment2))),
|
||||||
BUFSTRDEF("SHOULD-BE-A-REAL-WAL-FILE"));
|
BUFSTRDEF("SHOULD-BE-A-REAL-WAL-FILE"));
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
|
TEST_RESULT_INT(cmdArchiveGet(), 0, "successful get");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessLogResult("P01 INFO: found 000000010000000100000001 in the archive"), "check log");
|
TEST_RESULT_VOID(harnessLogResult("P00 INFO: found 000000010000000100000001 in the archive"), "check log");
|
||||||
|
|
||||||
TEST_RESULT_BOOL(storageExistsP(storageTest, walFile), true, "check WAL segment was moved");
|
TEST_RESULT_BOOL(storageExistsP(storageTest, walFile), true, "check WAL segment was moved");
|
||||||
|
|
||||||
@ -717,17 +651,9 @@ testRun(void)
|
|||||||
"acquire lock");
|
"acquire lock");
|
||||||
TEST_RESULT_VOID(lockClear(true), "clear lock");
|
TEST_RESULT_VOID(lockClear(true), "clear lock");
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
|
||||||
{
|
|
||||||
HARNESS_FORK_CHILD_BEGIN(0, false)
|
|
||||||
{
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 1, "timeout waiting for lock");
|
TEST_RESULT_INT(cmdArchiveGet(), 1, "timeout waiting for lock");
|
||||||
}
|
|
||||||
HARNESS_FORK_CHILD_END();
|
|
||||||
}
|
|
||||||
HARNESS_FORK_END();
|
|
||||||
|
|
||||||
harnessLogResult("P01 INFO: unable to find 000000010000000100000001 in the archive");
|
harnessLogResult("P00 INFO: unable to find 000000010000000100000001 in the archive");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, BOGUS_STR);
|
strLstAddZ(argList, BOGUS_STR);
|
||||||
|
Reference in New Issue
Block a user