Skip to content

Commit

Permalink
Update integration tests in real/all that use test points.
Browse files Browse the repository at this point in the history
Test points are not supported by the new C code so these will be replaced with unit tests.

The fact that the tests still pass even when the changes aren't made mid-backup (except application_name) shows how weak they were in the first place.

Even so, this does represent a regression in (soon to be be removed) Perl coverage.
  • Loading branch information
dwsteele committed Nov 26, 2019
1 parent b145c72 commit 82df7e6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 41 deletions.
4 changes: 2 additions & 2 deletions test/expect/real-all-001.log
Expand Up @@ -70,7 +70,7 @@ full backup - fail on backup lock exists (db-master host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -116,7 +116,7 @@ incr backup - fail on archive_mode=always (db-master host)
------------------------------------------------------------------------------------------------------------------------------------

incr backup - update during backup (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
4 changes: 2 additions & 2 deletions test/expect/real-all-002.log
Expand Up @@ -6,7 +6,7 @@ stanza-create db - main create stanza info files (db-master host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -158,7 +158,7 @@ check db - verify check command on standby (db-standby host)
------------------------------------------------------------------------------------------------------------------------------------

incr backup - update during backup (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
4 changes: 2 additions & 2 deletions test/expect/real-all-003.log
Expand Up @@ -6,7 +6,7 @@ stanza-create db - main create stanza info files (db-standby host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (db-standby host)
> [CONTAINER-EXEC] db-standby [BACKREST-BIN] --config=[TEST_PATH]/db-standby/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-standby [BACKREST-BIN] --config=[TEST_PATH]/db-standby/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -158,7 +158,7 @@ archive-copy=y
start-fast=y

incr backup - update during backup (db-standby host)
> [CONTAINER-EXEC] db-standby [BACKREST-BIN] --config=[TEST_PATH]/db-standby/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] db-standby [BACKREST-BIN] --config=[TEST_PATH]/db-standby/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
4 changes: 2 additions & 2 deletions test/expect/real-all-004.log
Expand Up @@ -94,7 +94,7 @@ stanza-upgrade db - upgrade stanza files online (backup host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -165,7 +165,7 @@ start all stanzas (db-master host)
------------------------------------------------------------------------------------------------------------------------------------

incr backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
4 changes: 2 additions & 2 deletions test/expect/real-all-005.log
Expand Up @@ -6,7 +6,7 @@ stanza-create db - main create stanza info files (backup host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -220,7 +220,7 @@ check db - verify check command on standby (db-standby host)
------------------------------------------------------------------------------------------------------------------------------------

incr backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
4 changes: 2 additions & 2 deletions test/expect/real-all-006.log
Expand Up @@ -94,7 +94,7 @@ stanza-upgrade db - upgrade stanza files online (backup host)
------------------------------------------------------------------------------------------------------------------------------------

full backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --buffer-size=16384 --type=full --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down Expand Up @@ -160,7 +160,7 @@ archive-copy=y
start-fast=y

incr backup - update during backup (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup --test --test-delay=1 --test-point=manifest-build=y
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stop-auto --buffer-size=32768 --delta --stanza=db backup
------------------------------------------------------------------------------------------------------------------------------------

+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
Expand Down
37 changes: 8 additions & 29 deletions test/lib/pgBackRestTest/Module/Real/RealAllTest.pm
Expand Up @@ -397,17 +397,14 @@ sub run
}
}

my $oExecuteBackup = $oHostBackup->backupBegin(
CFGOPTVAL_BACKUP_TYPE_FULL, 'update during backup',
{strTest => TEST_MANIFEST_BUILD, fTestDelay => $fTestDelay,
strOptionalParam => ' --' . cfgOptionName(CFGOPT_BUFFER_SIZE) . '=16384'});

$oHostDbMaster->sqlExecute("update test set message = '$strFullMessage'");

# Required to set hint bits to be sent to the standby to make the heap match on both sides
$oHostDbMaster->sqlSelectOneTest('select message from test', $strFullMessage);

my $strFullBackup = $oHostBackup->backupEnd(CFGOPTVAL_BACKUP_TYPE_FULL, $oExecuteBackup);
my $strFullBackup = $oHostBackup->backup(
CFGOPTVAL_BACKUP_TYPE_FULL, 'update during backup',
{strOptionalParam => ' --' . cfgOptionName(CFGOPT_BUFFER_SIZE) . '=16384'});

# Enabled async archiving
$oHostBackup->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_ARCHIVE_ASYNC) => 'y'}});
Expand Down Expand Up @@ -621,34 +618,16 @@ sub run
$oHostDbMaster->sqlSelectOne("select pg_start_backup('test backup that will be restarted', true)");
}

# Exercise --delta checksum option
$oExecuteBackup = $oHostBackup->backupBegin(
CFGOPTVAL_BACKUP_TYPE_INCR, 'update during backup',
{strTest => TEST_MANIFEST_BUILD, fTestDelay => $fTestDelay,
strOptionalParam => '--' . cfgOptionName(CFGOPT_STOP_AUTO) . ' --' . cfgOptionName(CFGOPT_BUFFER_SIZE) . '=32768' .
' --delta'});

# Drop a table
$oHostDbMaster->sqlExecute('drop table test_remove');
$oHostDbMaster->sqlWalRotate();
$oHostDbMaster->sqlExecute("update test set message = '$strIncrMessage'", {bCommit => true});

# Check that application name is set
if ($oHostDbMaster->pgVersion() >= PG_VERSION_APPLICATION_NAME)
{
my $strApplicationNameExpected = PROJECT_NAME . ' [' . cfgCommandName(CFGCMD_BACKUP) . ']';
my $strApplicationName = $oHostDbMaster->sqlSelectOne(
"select application_name from pg_stat_activity where application_name like '" . PROJECT_NAME . "%'");

if (!defined($strApplicationName) || $strApplicationName ne $strApplicationNameExpected)
{
confess &log(ERROR,
"application name '" . (defined($strApplicationName) ? $strApplicationName : '[null]') .
"' does not match '" . $strApplicationNameExpected . "'");
}
}

my $strIncrBackup = $oHostBackup->backupEnd(CFGOPTVAL_BACKUP_TYPE_INCR, $oExecuteBackup);
# Exercise --delta checksum option
my $strIncrBackup = $oHostBackup->backup(
CFGOPTVAL_BACKUP_TYPE_INCR, 'update during backup',
{strOptionalParam =>
'--' . cfgOptionName(CFGOPT_STOP_AUTO) . ' --' . cfgOptionName(CFGOPT_BUFFER_SIZE) . '=32768 --delta'});

# Ensure the check command runs properly with a tablespace unless there is a bogus host
if (!$oHostBackup->bogusHost())
Expand Down

0 comments on commit 82df7e6

Please sign in to comment.