1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-14 23:44:58 +02:00

Split full module into mock and real to allow better test combinations and save time in CI.

This commit is contained in:
David Steele
2017-06-19 18:55:00 -04:00
parent f6d4457d58
commit 692b1e274a
21 changed files with 49 additions and 58 deletions

View File

@ -13,27 +13,21 @@ services:
- docker - docker
env: env:
- PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza" - PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock"
- PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package" - PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=9.1" PGB_TEST_PARAM="--module=real --db=9.1 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=9.1" PGB_TEST_PARAM="--module=full --test=real --db=9.1 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=9.0" PGB_TEST_PARAM="--module=real --db=9.0 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="co6" PGB_BUILD_PARAM="--db=9.0" PGB_TEST_PARAM="--module=full --test=real --db=9.0 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="u16" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock --no-lint"
- PGB_TEST_VM="u16" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --no-lint" - PGB_TEST_VM="u16" PGB_BUILD_PARAM="--db=9.4" PGB_TEST_PARAM="--module=real --db=9.4 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="u16" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package" - PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock --no-lint"
- PGB_TEST_VM="u16" PGB_BUILD_PARAM="--db=9.4" PGB_TEST_PARAM="--module=full --test=real --db=9.4 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=9.3" PGB_TEST_PARAM="--module=real --db=9.3 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --no-lint" - PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=8.4" PGB_TEST_PARAM="--module=real --db=8.4 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package" - PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock --no-lint"
- PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=9.3" PGB_TEST_PARAM="--module=full --test=real --db=9.3 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=9.6" PGB_TEST_PARAM="--module=real --db=9.6 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="d8" PGB_BUILD_PARAM="--db=8.4" PGB_TEST_PARAM="--module=full --test=real --db=8.4 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=9.5" PGB_TEST_PARAM="--module=real --db=9.5 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --no-lint" - PGB_TEST_VM="u14" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock --no-lint"
- PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package" - PGB_TEST_VM="u14" PGB_BUILD_PARAM="--db=9.2" PGB_TEST_PARAM="--module=real --db=9.2 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=9.6" PGB_TEST_PARAM="--module=full --test=real --db=9.6 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="u12" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --module=mock --no-lint"
- PGB_TEST_VM="co7" PGB_BUILD_PARAM="--db=9.5" PGB_TEST_PARAM="--module=full --test=real --db=9.5 --process-max=2 --no-lint --no-package" - PGB_TEST_VM="u12" PGB_BUILD_PARAM="--db=8.3" PGB_TEST_PARAM="--module=real --db=8.3 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="u14" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --no-lint"
- PGB_TEST_VM="u14" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package"
- PGB_TEST_VM="u14" PGB_BUILD_PARAM="--db=9.2" PGB_TEST_PARAM="--module=full --test=real --db=9.2 --process-max=2 --no-lint --no-package"
- PGB_TEST_VM="u12" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=common --module=help --module=config --module=storage --module=protocol --module=info --module=archive --module=backup --module=expire --module=stanza --no-lint"
- PGB_TEST_VM="u12" PGB_BUILD_PARAM="--db=none" PGB_TEST_PARAM="--vm-max=2 --module=full --test=synthetic --no-lint --no-package"
- PGB_TEST_VM="u12" PGB_BUILD_PARAM="--db=8.3" PGB_TEST_PARAM="--module=full --test=real --db=8.3 --process-max=2 --no-lint --no-package"
before_install: before_install:
- sudo apt-get -qq update && sudo apt-get install libxml-checker-perl libdbd-pg-perl libperl-critic-perl libtemplate-perl libpod-coverage-perl libtest-differences-perl libhtml-parser-perl lintian debhelper txt2man devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl python-pip - sudo apt-get -qq update && sudo apt-get install libxml-checker-perl libdbd-pg-perl libperl-critic-perl libtemplate-perl libpod-coverage-perl libtest-differences-perl libhtml-parser-perl lintian debhelper txt2man devscripts libjson-perl libio-socket-ssl-perl libxml-libxml-perl python-pip

View File

@ -186,6 +186,10 @@
<release-item> <release-item>
<p>Combine hardlink and non/compressed in synthetic tests to reduce test time and improve coverage.</p> <p>Combine hardlink and non/compressed in synthetic tests to reduce test time and improve coverage.</p>
</release-item> </release-item>
<release-item>
<p>Split <id>full</id> module into <id>mock</id> and <id>real</id> to allow better test combinations and save time in CI.</p>
</release-item>
</release-refactor-list> </release-refactor-list>
</release-test-list> </release-test-list>
</release> </release>

View File

@ -95,18 +95,18 @@ sub process
{ {
my $hVm = vmGet(); my $hVm = vmGet();
my @stryModule; my @stryModule;
my $strFullModule = undef; my $strRealModule = undef;
# Get all modules but full to break up the tests # Get all modules but full to break up the tests
foreach my $strModule (testDefModuleList()) foreach my $strModule (testDefModuleList())
{ {
if ($strModule ne 'full') if ($strModule ne 'real')
{ {
push(@stryModule, $strModule); push(@stryModule, $strModule);
} }
else else
{ {
$strFullModule = $strModule; $strRealModule = $strModule;
} }
} }
@ -119,40 +119,22 @@ sub process
join(' --module=', @stryModule) . ($bFirst ? '' : " ${strConfigNotFirst}") . "\"\n"; join(' --module=', @stryModule) . ($bFirst ? '' : " ${strConfigNotFirst}") . "\"\n";
$bFirst = false; $bFirst = false;
# Now generate full tests # Now generate real tests
my $strRealTest = undef; if (!defined($strRealModule))
if (!defined($strFullModule))
{ {
confess "${strFullModule} module not found, has the name changed?"; confess "${strRealModule} module not found, has the name changed?";
} }
foreach my $strTest (testDefModuleTestList($strFullModule)) foreach my $strTest (testDefModuleTestList($strRealModule))
{ {
if ($strTest eq 'real')
{
$strRealTest = $strTest;
foreach my $strDbVersion (sort {$b cmp $a} @{$hVm->{$strVm}{&VM_DB_MINIMAL}}) foreach my $strDbVersion (sort {$b cmp $a} @{$hVm->{$strVm}{&VM_DB_MINIMAL}})
{ {
$strConfig .= $strConfig .=
" - PGB_TEST_VM=\"${strVm}\" PGB_BUILD_PARAM=\"--db=${strDbVersion}\"" . " - PGB_TEST_VM=\"${strVm}\" PGB_BUILD_PARAM=\"--db=${strDbVersion}\"" .
" PGB_TEST_PARAM=\"--module=full --test=real --db=${strDbVersion}" . " PGB_TEST_PARAM=\"--module=${strRealModule} --db=${strDbVersion}" .
" --process-max=2 ${strConfigNotFirst} ${strConfigNotFirstOS}\"\n"; " --process-max=2 ${strConfigNotFirst} ${strConfigNotFirstOS}\"\n";
} }
} }
else
{
$strConfig .=
" - PGB_TEST_VM=\"${strVm}\" PGB_BUILD_PARAM=\"--db=none\"" .
" PGB_TEST_PARAM=\"--vm-max=2 --module=full --test=${strTest} ${strConfigNotFirst} ${strConfigNotFirstOS}\"\n";
}
}
if (!defined($strRealTest))
{
confess "${strRealTest} test not found in ${strFullModule} module, has the name changed?";
}
} }
# Configure install and script # Configure install and script

View File

@ -408,9 +408,9 @@ my $oTestDef =
}, },
] ]
}, },
# Full tests # Mock tests
{ {
&TESTDEF_NAME => 'full', &TESTDEF_NAME => 'mock',
&TESTDEF_EXPECT => true, &TESTDEF_EXPECT => true,
&TESTDEF_INDIVIDUAL => true, &TESTDEF_INDIVIDUAL => true,
&TESTDEF_PROCESS => true, &TESTDEF_PROCESS => true,
@ -418,11 +418,22 @@ my $oTestDef =
&TESTDEF_TEST => &TESTDEF_TEST =>
[ [
{ {
&TESTDEF_NAME => 'synthetic', &TESTDEF_NAME => 'all',
&TESTDEF_TOTAL => 3, &TESTDEF_TOTAL => 3,
}, },
]
},
# Real tests
{ {
&TESTDEF_NAME => 'real', &TESTDEF_NAME => 'real',
&TESTDEF_EXPECT => true,
&TESTDEF_INDIVIDUAL => true,
&TESTDEF_PROCESS => true,
&TESTDEF_TEST =>
[
{
&TESTDEF_NAME => 'all',
&TESTDEF_TOTAL => 12, &TESTDEF_TOTAL => 12,
&TESTDEF_DB => true, &TESTDEF_DB => true,
} }

View File

@ -1,7 +1,7 @@
#################################################################################################################################### ####################################################################################################################################
# FullSyntheticTest.pm - Tests for all commands that can be run against synthetic data # Test All Commands on Mock Data
#################################################################################################################################### ####################################################################################################################################
package pgBackRestTest::Module::Full::FullSyntheticTest; package pgBackRestTest::Module::Mock::MockAllTest;
use parent 'pgBackRestTest::Env::HostEnvTest'; use parent 'pgBackRestTest::Env::HostEnvTest';
#################################################################################################################################### ####################################################################################################################################

View File

@ -1,7 +1,7 @@
#################################################################################################################################### ####################################################################################################################################
# FullRealTest.pm - Tests for all commands against a real database # Test All Commands On PostgreSQL Clusters
#################################################################################################################################### ####################################################################################################################################
package pgBackRestTest::Module::Full::FullRealTest; package pgBackRestTest::Module::Real::RealAllTest;
use parent 'pgBackRestTest::Env::HostEnvTest'; use parent 'pgBackRestTest::Env::HostEnvTest';
#################################################################################################################################### ####################################################################################################################################