GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Rex::Test::Base(3) User Contributed Perl Documentation Rex::Test::Base(3)

Rex::Test::Base - Basic Test Module

This is a basic test module to test your code with the help of local VMs. You can place your tests in the "t" directory.

 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

Constructor if used in OO mode.

 my $test = Rex::Test::Base->new(name => "test_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.

The amount of memory the VM should use, in Megabytes.

The number of CPUs the VM should use.

Authentication options for the VM. It accepts the same parameters as "Rex::Box::Base->auth()".

The URL to a base image to be used for the test VM.

Redirect local $port to the VM's SSH port (default: 2222).

The task to run on the test VM. You can run multiple tasks by passing an array reference.

Test if the content of $file matches against $regexp.

Test if $path is present and is a directory.

Test if $file is present.

Test if $package is installed, optionally at $version.

Test if $service is running.

Test if $service is stopped.

Test if $file has properties described in hash reference $stat. List of supported checks:
group
owner
2021-07-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.