1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-18 23:57:33 +02:00

Allow most unit tests to run outside of a container.

Three major changes were required to get this working:

1) Provide the path to pgbackrest in the build directory when running outside a container.  Tests in a container will continue to install and run against /usr/bin/pgbackrest.

1) Set a per-test lock path so tests don't conflict on the default /tmp/pgbackrest path.  Also set a per-test log-path while we are at it.

2) Use localhost instead of a custom host for TLS test connections.  Tests in containers will continue to update /etc/hosts and use the custom host.

Add infrastructure and update harnessCfgLoad*() to get the correct exe and paths loaded for testing.

Since new tests are required to verify that running outside a container works, also rework the tests in Travis CI to provide coverage within a reasonable amount of time.  Mainly, break up to doc tests by VM and run an abbreviated unit test suite on co6 and co7.
This commit is contained in:
David Steele
2019-10-08 12:06:30 -04:00
parent 77b0c6c993
commit 45881c74ae
48 changed files with 808 additions and 682 deletions

View File

@ -24,13 +24,11 @@ testRun(void)
if (testBegin("cmdCheck()"))
{
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAdd(argList, pg1PathOpt);
strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath()));
strLstAddZ(argList, "--archive-timeout=.5");
strLstAddZ(argList, "check");
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
harnessCfgLoad(cfgCmdCheck, argList);
TEST_ERROR_FMT(
cmdCheck(), FileMissingError,
@ -107,13 +105,11 @@ testRun(void)
// Single standby
// -------------------------------------------------------------------------------------------------------------------------
argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAdd(argList, pg1PathOpt);
strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath()));
strLstAddZ(argList, "--archive-timeout=.5");
strLstAddZ(argList, "check");
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
harnessCfgLoad(cfgCmdCheck, argList);
// Set script
harnessPqScriptSet((HarnessPq [])
@ -131,12 +127,10 @@ testRun(void)
if (testBegin("checkDbConfig()"))
{
StringList *argList = strLstNew();
strLstAddZ(argList, "pgbackrest");
strLstAddZ(argList, "--stanza=test1");
strLstAdd(argList, pg1PathOpt);
strLstAdd(argList, strNewFmt("--repo1-path=%s/repo", testPath()));
strLstAddZ(argList, "check");
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
harnessCfgLoad(cfgCmdCheck, argList);
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, 1, PG_VERSION_92, pg1Path), "valid db config");