mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Move help/version integration tests to mock/all.
Help and version are covered by unit tests, so we really just to need to make sure there is output when called from the command line.
This commit is contained in:
parent
741acfd779
commit
3b661f4ad5
@ -99,6 +99,10 @@
|
||||
<p>Move test definitions to <file>test/define.yaml</file>. The location is better because it is no longer buried in the Perl test libs. Also, the data can be easily accessed from C.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Move help/version integration tests to <id>mock/all</id>. Help and version are covered by unit tests, so we really just to need to make sure there is output when called from the command line.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Include VM type in <id>gcov</id> path to avoid conflicts between VMs with different architectures.</p>
|
||||
</release-item>
|
||||
|
@ -648,11 +648,6 @@ module:
|
||||
expect: true
|
||||
|
||||
test:
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
- name: help
|
||||
total: 1
|
||||
container: true
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
- name: all
|
||||
total: 6
|
||||
|
@ -1,6 +1,18 @@
|
||||
run 001 - rmt 0, s3 0, enc 0
|
||||
============================
|
||||
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] version
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION]
|
||||
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] help version
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - 'version' command help
|
||||
|
||||
Get version.
|
||||
|
||||
Displays installed pgBackRest version.
|
||||
|
||||
info all stanzas - no stanzas exist (db-master host)
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn info
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,215 +0,0 @@
|
||||
run 001 - base
|
||||
==============
|
||||
|
||||
> [BACKREST-BIN] version
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION]
|
||||
|
||||
> [BACKREST-BIN] help
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - General help
|
||||
|
||||
Usage:
|
||||
pgbackrest [options] [command]
|
||||
|
||||
Commands:
|
||||
archive-get Get a WAL segment from the archive.
|
||||
archive-push Push a WAL segment to the archive.
|
||||
backup Backup a database cluster.
|
||||
check Check the configuration.
|
||||
expire Expire backups that exceed retention.
|
||||
help Get help.
|
||||
info Retrieve information about backups.
|
||||
restore Restore a database cluster.
|
||||
stanza-create Create the required stanza data.
|
||||
stanza-delete Delete a stanza.
|
||||
stanza-upgrade Upgrade a stanza.
|
||||
start Allow pgBackRest processes to run.
|
||||
stop Stop pgBackRest processes from running.
|
||||
version Get version.
|
||||
|
||||
Use 'pgbackrest help [command]' for more information.
|
||||
|
||||
> [BACKREST-BIN] help version
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - 'version' command help
|
||||
|
||||
Get version.
|
||||
|
||||
Displays installed pgBackRest version.
|
||||
|
||||
> [BACKREST-BIN] help --output=json --stanza=main --repo1-host=backup info
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - 'info' command help
|
||||
|
||||
Retrieve information about backups.
|
||||
|
||||
The info command operates on a single stanza or all stanzas. Text output is the
|
||||
default and gives a human-readable summary of backups for the stanza(s)
|
||||
requested. This format is subject to change with any release.
|
||||
|
||||
For machine-readable output use --output=json. The JSON output contains far
|
||||
more information than the text output and is kept stable unless a bug is found.
|
||||
|
||||
Command Options:
|
||||
|
||||
--output output format [current=json, default=text]
|
||||
|
||||
General Options:
|
||||
|
||||
--buffer-size buffer size for file operations [default=4194304]
|
||||
--cmd-ssh path to ssh client executable [default=ssh]
|
||||
--compress-level compression level for stored files [default=6]
|
||||
--compress-level-network compression level for network transfer when
|
||||
compress=n [default=3]
|
||||
--config pgBackRest configuration file
|
||||
[default=/etc/pgbackrest.conf]
|
||||
--lock-path path where lock files are stored
|
||||
[default=/tmp/pgbackrest]
|
||||
--protocol-timeout protocol timeout [default=1830]
|
||||
--stanza defines the stanza [current=main]
|
||||
|
||||
Log Options:
|
||||
|
||||
--log-level-console level for console logging [default=warn]
|
||||
--log-level-file level for file logging [default=info]
|
||||
--log-level-stderr level for stderr logging [default=warn]
|
||||
--log-path path where log files are stored
|
||||
[default=/var/log/pgbackrest]
|
||||
--log-timestamp enable timestamp in logging [default=y]
|
||||
|
||||
Repository Options:
|
||||
|
||||
--repo-cipher-pass repository cipher passphrase
|
||||
--repo-cipher-type cipher used to encrypt the repository [default=none]
|
||||
--repo-host repository host when operating remotely via SSH
|
||||
[current=backup]
|
||||
--repo-host-cmd pgBackRest exe path on the repository host
|
||||
[default=[BACKREST-BIN]]
|
||||
--repo-host-config pgBackRest repository host configuration file
|
||||
[default=/etc/pgbackrest.conf]
|
||||
--repo-host-port repository host port when repo-host is set
|
||||
--repo-host-user repository host user when repo-host is set
|
||||
[default=pgbackrest]
|
||||
--repo-path path where backups and archive are stored
|
||||
[default=/var/lib/pgbackrest]
|
||||
--repo-s3-bucket s3 repository bucket
|
||||
--repo-s3-ca-file s3 SSL CA File
|
||||
--repo-s3-ca-path s3 SSL CA Path
|
||||
--repo-s3-endpoint s3 repository endpoint
|
||||
--repo-s3-host s3 repository host
|
||||
--repo-s3-key s3 repository access key
|
||||
--repo-s3-key-secret s3 repository secret access key
|
||||
--repo-s3-region s3 repository region
|
||||
--repo-s3-verify-ssl verify S3 server certificate [default=y]
|
||||
--repo-type type of storage used for the repository
|
||||
[default=posix]
|
||||
|
||||
Use 'pgbackrest help info [option]' for more information.
|
||||
|
||||
> [BACKREST-BIN] help --output=json --stanza=main info output
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - 'info' command - 'output' option help
|
||||
|
||||
Output format.
|
||||
|
||||
The following output types are supported:
|
||||
|
||||
* text - Human-readable summary of backup information.
|
||||
* json - Exhaustive machine-readable backup information in JSON format.
|
||||
|
||||
current: json
|
||||
default: text
|
||||
|
||||
> [BACKREST-BIN] help check
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
[BACKREST-NAME-VERSION] - 'check' command help
|
||||
|
||||
Check the configuration.
|
||||
|
||||
The check command validates that pgBackRest and the archive_command setting are
|
||||
configured correctly for archiving and backups. It detects misconfigurations,
|
||||
particularly in archiving, that result in incomplete backups because required
|
||||
WAL segments did not reach the archive. The command can be run on the database
|
||||
or the repository host. The command may also be run on the standby host,
|
||||
however, since pg_switch_xlog()/pg_switch_wal() cannot be performed on the
|
||||
standby, the command will only test the repository configuration.
|
||||
|
||||
Note that pg_create_restore_point('pgBackRest Archive Check') and
|
||||
pg_switch_xlog()/pg_switch_wal() are called to force PostgreSQL to archive a
|
||||
WAL segment. Restore points are only supported in PostgreSQL >= 9.1 so for
|
||||
older versions the check command may fail if there has been no write activity
|
||||
since the last log rotation, therefore it is recommended that activity be
|
||||
generated by the user if there have been no writes since the last WAL switch
|
||||
before running the check command.
|
||||
|
||||
Command Options:
|
||||
|
||||
--archive-check check that WAL segments are in the archive before
|
||||
backup completes [default=y]
|
||||
--archive-timeout archive timeout [default=60]
|
||||
--backup-standby backup from the standby cluster [default=n]
|
||||
--online check an online cluster [default=y]
|
||||
|
||||
General Options:
|
||||
|
||||
--buffer-size buffer size for file operations [default=4194304]
|
||||
--cmd-ssh path to ssh client executable [default=ssh]
|
||||
--compress-level compression level for stored files [default=6]
|
||||
--compress-level-network compression level for network transfer when
|
||||
compress=n [default=3]
|
||||
--config pgBackRest configuration file
|
||||
[default=/etc/pgbackrest.conf]
|
||||
--db-timeout database query timeout [default=1800]
|
||||
--neutral-umask use a neutral umask [default=y]
|
||||
--protocol-timeout protocol timeout [default=1830]
|
||||
--stanza defines the stanza
|
||||
|
||||
Log Options:
|
||||
|
||||
--log-level-console level for console logging [default=warn]
|
||||
--log-level-file level for file logging [default=info]
|
||||
--log-level-stderr level for stderr logging [default=warn]
|
||||
--log-path path where log files are stored
|
||||
[default=/var/log/pgbackrest]
|
||||
--log-timestamp enable timestamp in logging [default=y]
|
||||
|
||||
Repository Options:
|
||||
|
||||
--repo-cipher-pass repository cipher passphrase
|
||||
--repo-cipher-type cipher used to encrypt the repository [default=none]
|
||||
--repo-host repository host when operating remotely via SSH
|
||||
--repo-host-cmd pgBackRest exe path on the repository host
|
||||
--repo-host-config pgBackRest repository host configuration file
|
||||
[default=/etc/pgbackrest.conf]
|
||||
--repo-host-port repository host port when repo-host is set
|
||||
--repo-host-user repository host user when repo-host is set
|
||||
[default=pgbackrest]
|
||||
--repo-path path where backups and archive are stored
|
||||
[default=/var/lib/pgbackrest]
|
||||
--repo-s3-bucket s3 repository bucket
|
||||
--repo-s3-ca-file s3 SSL CA File
|
||||
--repo-s3-ca-path s3 SSL CA Path
|
||||
--repo-s3-endpoint s3 repository endpoint
|
||||
--repo-s3-host s3 repository host
|
||||
--repo-s3-key s3 repository access key
|
||||
--repo-s3-key-secret s3 repository secret access key
|
||||
--repo-s3-region s3 repository region
|
||||
--repo-s3-verify-ssl verify S3 server certificate [default=y]
|
||||
--repo-type type of storage used for the repository
|
||||
[default=posix]
|
||||
|
||||
Stanza Options:
|
||||
|
||||
--pg-host postgreSQL host for operating remotely via SSH
|
||||
--pg-host-cmd pgBackRest exe path on the PostgreSQL host
|
||||
--pg-host-config pgBackRest database host configuration file
|
||||
[default=/etc/pgbackrest.conf]
|
||||
--pg-host-port postgreSQL host port when pg-host is set
|
||||
--pg-host-user postgreSQL host logon user when pg-host is set
|
||||
[default=postgres]
|
||||
--pg-path postgreSQL data directory
|
||||
--pg-port postgreSQL port [default=5432]
|
||||
--pg-socket-path postgreSQL unix socket path
|
||||
|
||||
Use 'pgbackrest help check [option]' for more information.
|
@ -262,6 +262,14 @@ sub run
|
||||
$oHostDbMaster->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, 'global/' . DB_FILE_PGINTERNALINIT, 'IGNORE');
|
||||
}
|
||||
|
||||
# Help and Version. These have complete unit tests, so here just make sure there is output from the command line.
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if ($self->runCurrent() == 1)
|
||||
{
|
||||
$oHostDbMaster->executeSimple($self->backrestExe() . " version", {oLogTest => $self->expect()});
|
||||
$oHostDbMaster->executeSimple($self->backrestExe() . " help version", {oLogTest => $self->expect()});
|
||||
}
|
||||
|
||||
# Backup Info (with no stanzas)
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostDbMaster->info('no stanzas exist');
|
||||
|
@ -1,53 +0,0 @@
|
||||
####################################################################################################################################
|
||||
# Tests for help command
|
||||
####################################################################################################################################
|
||||
package pgBackRestTest::Module::Real::RealHelpTest;
|
||||
use parent 'pgBackRestTest::Common::RunTest';
|
||||
|
||||
####################################################################################################################################
|
||||
# Perl includes
|
||||
####################################################################################################################################
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
|
||||
use Exporter qw(import);
|
||||
our @EXPORT = qw();
|
||||
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::Config::Config;
|
||||
|
||||
use pgBackRestTest::Env::Host::HostBaseTest;
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# helpExecute
|
||||
####################################################################################################################################
|
||||
sub helpExecute
|
||||
{
|
||||
my $self = shift;
|
||||
my $strCommand = shift;
|
||||
|
||||
executeTest($self->backrestExe() . " $strCommand", {oLogTest => $self->expect()});
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# run
|
||||
####################################################################################################################################
|
||||
sub run
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
if ($self->begin('base'))
|
||||
{
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_VERSION));
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_HELP));
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_HELP) . ' version');
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_HELP) . ' --output=json --stanza=main --repo1-host=backup info');
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_HELP) . ' --output=json --stanza=main info output');
|
||||
$self->helpExecute(cfgCommandName(CFGCMD_HELP) . ' check');
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user