Creating Automated Post-Production Tests

You can add your own tests that EasyApache will run after each build. Simply create an option module (or “opt mod”) that runs the test.

Option modules are options that advanced administrators can add to the EasyApache interface. For more information about configuring opt mods, click Cpanel::Easy Framework POD on the first EasyApache screen in WHM, or enter /scripts/easyapache --perldoc from the command line.

ALERT! Warning: 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

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 extension *.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:

  • For Apache -- /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/Apache/$mytest.pm
  • For PHP4 -- /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/PHP4/$mytest.pm
  • For PHP5 -- /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/PHP5/$mytest.pm

To see how a test file should be structured, see the sample linked here.

Skipping your custom option modules/post-production tests

If need be, you are able to skip your custom option modules, including post-production tests, before build time. This can be useful for troubleshooting purposes.

To skip your custom option modules:

  1. Type the following command before build time:
    • /scripts/easyapache --skip-custom-optmods
  2. Rebuild Apache using the /scripts/easyapache script.

If you would prefer to use the WHM interface to skip these option modules:

  1. Click the Help link on the first EasyApache (Apache Update) screen.
  2. Check the Do not build any opt mods that are not included in ea3 core checkbox.
  3. Click Submit.
  4. Return to the previous screen and build the profile.

If the build completes successfully, the option modules need to be reconfigured or omitted.

Topic revision: r7 - 19 Jun 2009 - 15:27:07 - Main.MelanieSeibert
EasyApache3.CreatingTests moved from Sandbox.CreatingTests on 08 Jun 2009 - 14:47 by Main.JustinSchaefer - put it back
 

Copyright © cPanel 2000-2009.