Last updated December 24, 2014.
The Drupal.org testbot Puppet provisioning package comes with a Vagrantfile, which you can use to make a virtual machine locally.
The testbot itself is a Drupal-based test runner.
This document shows you a bit of how to use this system. In all cases the testbot runs on Debian OS as a guest machine on whatever host machine you're using; You can use Linux, MacOS, or Windows as the host machine, wherever Vagrant and Virtualbox are supported.
The goal: Run a branch test on a drupal.org project.
We'll run the tests in the Examples for Developers project as an example.
- VirtualBox v.3.2.x or higher: https://www.virtualbox.org/wiki/Downloads
- Vagrant http://downloads.vagrantup.com/
- The Internet
Phase 1: Install The Stuff
- Install VirtualBox and Vagrant. Super-duper easy.
- Open up a shell terminal on your computer.
- Get the drupaltestbot-puppet project. You'll use git, and instructions are here: https://drupal.org/project/drupaltestbot-puppet/git-instructions But basically
git clone --branch master http://git.drupal.org/project/drupaltestbot-puppet.gitis the magic incantation. Note that on a Windows host machine you will need to use
git clone -c core.autocrlf=input git://git.drupal.org/project/drupaltestbot-puppet.gitas we need a repo with *Linux* line endings, not windows line endings
vagrant upThis will cause vagrant to spend a bunch of time downloading the virtual machine image, and then starting it up and provisioning it.
If you see some errors during provisioning, here are some troubleshooting steps you can take, in ascending order of desperation:
- You can run
vagrant provision. This will cause Puppet to re-provision the machine, which might work. You can do this as many times as you wish with no ill-effect.
- To completely start from scratch again, you can run
vagrant destroyand this will demolish your project vagrant box. Then run
- if you're completely out of luck, you can try
vagrant box remove DebianWheezy64. 'DebianWheezy64' is the current box specified in the Vagrantfile. You can double check which box to remove by consulting the Vagrantfile.
- File an issue in the drupaltestbot-puppet issue queue - Attach a file showing the output of
vagrant provision(the whole thing) and give information about your specific environment.
Phase 2: Status Check
Once you've done
up and everything's all spinning along happily, you can log in to the Drupal-based test runner and see if everything's working.
The vagrant virtual machine has a web server and you can get to it by putting this into your web browser: http://172.16.2.100/ (This IP is set in the project's Vagrantfile.)
The login credentials are:
Once you're logged in, you can poke around like you would with any Drupal site.
But you really want to look at the PIFR management section: http://172.16.2.100/admin/pifr
'Client Check', which takes a while to load, and then tells you whether the machine can communicate with the various services it needs. This is useful if you think your machine can't download projects to test, for instance. Some of these will be red, but we don't care that much for our purposes.
'Configuration'. This is where you'd put credentials for this testbot if you wanted it to be in the testbot queue. This isn't what we're doing under vagrant, so just leave it all alone; the defaults are great for our purposes.
'Run Tests Locally.' This looks like what we want, right?
Phase 3: Run A Test
Once you're logged in, you can go to the 'Run Tests Locally' page: http://172.16.2.100/admin/pifr/run-test
Let's run our test. Recall that our goal is to run a branch test on Examples for Developers. There are other kinds of tests, as well, but they're left as an exercise for the reader.
Make sure the test plugin is set to 'SimpleTest.'
Set 'Test Type' to 'Project Branch/Tag.'
Click 'Next.' This takes us to the 'Customize SimpleTest Parameters' page.
Pick your favorite Drupal core version. Let's choose Drupal 8, because the Examples project for D8 doesn't have many tests to run.
For 'Project Name' enter 'examples'.
For 'Project Repository' enter the git URL for Examples. Hint: git://git.drupal.org/project/examples.git
For 'Project Branch' we'll enter the name of a branch within that git repository. For Examples, that's 8.x-1.x
Click 'Run Test.'
The test will now run, and will take some time. Unfortunately there's no real-time status display.