You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-14 23:44:58 +02:00
Major refactor of the test suite.
* Make the code more modular and object-oriented. * Multiple Docker containers can now be created for a single test to simulate more realistic environments.
This commit is contained in:
85
test/lib/pgBackRestTest/Help/HelpTest.pm
Normal file
85
test/lib/pgBackRestTest/Help/HelpTest.pm
Normal file
@ -0,0 +1,85 @@
|
||||
####################################################################################################################################
|
||||
# HelpTest.pm - Unit Tests for help
|
||||
####################################################################################################################################
|
||||
package pgBackRestTest::Help::HelpTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# 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::Backup::Common::HostBackupTest;
|
||||
use pgBackRestTest::Common::HostGroupTest;
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
use pgBackRestTest::CommonTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# helpExecute
|
||||
####################################################################################################################################
|
||||
sub helpExecute
|
||||
{
|
||||
my $strCommand = shift;
|
||||
|
||||
my $oHostGroup = hostGroupGet();
|
||||
executeTest($oHostGroup->paramGet(HOST_PARAM_BACKREST_EXE) . ' --no-config ' . $strCommand);
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# helpTestRun
|
||||
####################################################################################################################################
|
||||
sub helpTestRun
|
||||
{
|
||||
my $strTest = shift;
|
||||
my $iThreadMax = shift;
|
||||
my $bVmOut = shift;
|
||||
|
||||
# Setup test variables
|
||||
my $iRun;
|
||||
my $strModule = 'help';
|
||||
|
||||
# Print test banner
|
||||
if (!$bVmOut)
|
||||
{
|
||||
&log(INFO, 'HELP MODULE *****************************************************************');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
# Test config
|
||||
#-------------------------------------------------------------------------------------------------------------------------------
|
||||
my $strThisTest = 'help';
|
||||
|
||||
if ($strTest eq 'all' || $strTest eq $strThisTest)
|
||||
{
|
||||
$iRun = 0;
|
||||
|
||||
if (!$bVmOut)
|
||||
{
|
||||
&log(INFO, "Test help\n");
|
||||
}
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
if (testRun(++$iRun, 'base', $strModule, $strThisTest, undef, false))
|
||||
{
|
||||
helpExecute('version');
|
||||
helpExecute('help');
|
||||
helpExecute('help version');
|
||||
helpExecute('help --output=json --stanza=main info');
|
||||
helpExecute('help --output=json --stanza=main info output');
|
||||
}
|
||||
|
||||
# Cleanup
|
||||
testCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
push @EXPORT, qw(helpTestRun);
|
||||
|
||||
1;
|
Reference in New Issue
Block a user