If, for example, you wanted to test one of Apache’s specific functions, you will need to use the proper Apache namespace: Cpanel::Easy::Apache::$mytest, where $mytest is meant to stand for the name of your test file. When you create your test file, make sure that you use the filename extensionWarning: During tests, accessing a user’s directory as the root user is extremely insecure. If you wish to access a user’s directory during an automated post-production test, you’ll need to assume the identity of that user. cPanel will not provide support for servers that have been successfully attacked as a result of poorly designed tests. To assume another user’s identity, you may use the following command:
- su $username
*.pm. You do not need to use the filename extension when specifying your namespace.
If you wish to test the functionality of PHP 4 or 5, you will need to use the namespace Cpanel::Easy::PHP$X:: $mytest, where $X stands for the major version of PHP you wish to test (4 or 5) and $mytest is meant to stand for the name of your test file. When you create your test file, make sure that you use the filename extension *.pm. You do not need to use the filename extension when specifying your namespace.
Once you have created the test file(s), you will ned to place the file into the directory that corresponds to the appropriate namespace:
package Cpanel::Easy::Apache::MyTestXYZ;
our $easyconfig = {
'name' => 'Add post restart tests for XYZ',
'note' => 'This option does not alter anything with the build, it only adds tests to be run after a successful build and restart',
'step' => {
'0' => {
'name' => 'Type A tests',
'command' => sub {
my ($easy) = @_;
# see the post_httpd_restart_tests in Cpanel::Easy source for examples)
push @{ $easy->{'_'}{'post_httpd_restart_tests'} },
{
'name' => 'A2 support',
'command' => sub {
my ( $easy, $is_fatal_boolean_sr ) = @_;
# do your tests for "A2 support" here
# if all is well:
return(1, 'ok');
# if not report it:
# return(0, q{maketest suitable error message [_1]}, 'here');
# to abort the build (YOU PROBABLY DO NOT WANT TO USE THIS)
# ${ $is_fatal_boolean_sr } = 1;
# return(0, q{maketest suitable error message [_1]}, 'here');
},
},
{
'name' => 'A5 support',
...
},
;
},
},
'1' => {
'name' => 'Type B tests',
'command' => sub {
my ($easy) = @_;
push @{ $easy->{'_'}{'post_httpd_restart_tests'} },
...
},
},
},
# doesn't make much sense to add these tests unless we have the functionality
'depends' => {
'optmods' => {
'Cpanel::Easy::Apache::XYZ' => 1, # This needs Apache's XYZ to be available
},
},
};
1;
/scripts/easyapache script.
Copyright © cPanel 2000–2011.