Rex::Test::Base - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation
NAMERex::Test::Base − Basic Test Module
DESCRIPTIONThis is a basic test module to test your code with the help of local VMs. You can place your tests in the ‟t” directory.
EXAMPLE use Rex::Test::Base;
use Data::Dumper;
use Rex −base;
test {
my $t = shift;
$t−>name("ubuntu test");
$t−>base_vm("http://box.rexify.org/box/ubuntu−server−12.10−amd64.ova");
$t−>vm_auth(user => "root", password => "box");
$t−>run_task("setup");
$t−>has_package("vim");
$t−>has_package("ntp");
$t−>has_package("unzip");
$t−>has_file("/etc/ntp.conf");
$t−>has_service_running("ntp");
$t−>has_content("/etc/passwd", qr{root:x:0:}ms);
run "ls −l";
$t−>ok($? == 0, "ls −l returns success.");
$t−>finish;
};
1; # last line
METHODS
new(name => $test_name)Constructor if used in OO mode. my $test = Rex::Test::Base−>new(name => "test_name");
name($name)The name of the test. A VM called $name will be created for each test. If the VM already exists, Rex will try to reuse it.
memory($amount)The amount of memory the VM should use, in Megabytes.
cpus($number)The number of CPUs the VM should use.
vm_auth(%auth)Authentication options for the VM. It accepts the same parameters as Rex::Box::Base−>auth().
base_vm($vm)The URL to a base image to be used for the test VM.
redirect_port($port)Redirect local $port to the VM's SSH port (default: 2222).
run_task($task)The task to run on the test VM. You can run multiple tasks by passing an array reference.
TEST METHODS
has_content($file, $regexp)Test if the content of $file matches against $regexp.
has_dir($path)Test if $path is present and is a directory.
has_file($file)Test if $file is present.
has_package($package, $version)Test if $package is installed, optionally at $version.
has_service_running($service)Test if $service is running.
has_service_stopped($service)Test if $service is stopped.
has_stat($file, $stat)Test if $file has properties described in hash reference $stat. List of supported checks: group owner 0
Johanes Gumabo
Data Size : 13,686 byte
man-Rex::Test::Base.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 174,656
Visitor ID : :
Visitor IP : 3.142.36.215 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Rex::Test::Base.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Rex::Test::Base.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Rex::Test::Base.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Rex::Test::Base.3pm|43|'br══─}─══ |'br══─}─══
)