puppetlabs/beaker — pull request #171 by richardc (2014-03-05 21:47:14+00:00)
Title: Add a docker hypervisor

This is a quite simple hypervisor, and only supports linux flavours
currently. Many things around inter-node communications will
probably not work.

The basic approach is we spin up a new image based on an upstream
one, add a sshd to it, tag the image with the name of the host and
then create a container from it. This container should then be
usable as a system under test.

The implementation is largely based on both the existing Beaker::Vagrant
hypervisor, and docker-kitchen.
https://github.com/portertech/kitchen-docker All bugs are mine.

Still a few things to do around finding existing nodes, but for now
it makes basic enough images that you can run no tests in 11 seconds.

$ cat docker-test.yml
HOSTS:
ubuntu-12-10:
platform: ubuntu-12.10-x64
image: ubuntu:12.10
hypervisor: docker
CONFIG:
type: foss

```
$ time ruby -Ilib ./bin/beaker --hosts docker-test.yml --no-debug
{
"log_level": "info",
"trace_limit": 10,
"hosts_file": "docker-test.yml",
"options_file": null,
"type": "foss",
"provision": true,
"preserve_hosts": "never",
"root_keys": false,
"quiet": false,
"xml": false,
"color": true,
"dry_run": false,
"timeout": 300,
"fail_mode": "slow",
"timesync": false,
"repo_proxy": false,
"add_el_extras": false,
"consoleport": 443,
"pe_dir": "/opt/enterprise/dists",
"pe_version_file": "LATEST",
"pe_version_file_win": "LATEST-win",
"dot_fog": "/Users/richardc/.fog",
"ec2_yaml": "config/image_templates/ec2.yaml",
"help": false,
"ssh": {
"config": false,
"paranoid": false,
"timeout": 300,
"auth_methods": [
"publickey"
],
"port": 22,
"forward_agent": true,
"keys": [
"/Users/richardc/.ssh/id_rsa"
],
"user_known_hosts_file": "/Users/richardc/.ssh/known_hosts"
},
"HOSTS": {
"ubuntu-12-10": {
"roles": [
"master"
],
"platform": "ubuntu-12.10-x64",
"image": "ubuntu:12.10",
"hypervisor": "docker",
"extra_commands": [
"touch /tmp/foo"
]
}
},
"helper": [],
"load_path": [],
"tests": [],
"pre_suite": [],
"post_suite": [],
"install": [],
"modules": [],
"logger": "#"
}
Beaker::Hypervisor, found some docker boxes to create
Provisioning docker
provisioning ubuntu-12-10

Setup: Update /etc/hosts on master with master's ip
Add Master entry to /etc/hosts
No tests to run for suite 'pre_suite'
No tests to run for suite 'tests'
No tests to run for suite 'post_suite'
Cleanup: cleaning up after successful run
Cleaning up docker
systest completed successfully, thanks.

real 0m11.892s
user 0m0.825s
sys 0m0.115s
```