candlepin/candlepin — pull request #646 by dgoodwin (2014-07-17 17:54:49+00:00)
Title: Add docker containers for running spec and unit tests.

This will hopefully give us a solid way to run jenkins tests without a lot of
environment overhead, the container takes care of all the ruby/devel setup, and
a completely clean environment for every run. We can also now run multiple spec
tests jobs on one host system as there's no more fighting over a specific host
port.

Includes a candlepin checkout at /candlepin with all current ruby and java deps
installed to dramatically cut down on the time and bandwidth. Everything should
get updated when we run so changing deps should not be a problem, but it may be
a good idea to rebuild these from time to time. (script included see
rebuild.sh)

You can mount your host's dev checkout as a volume at /candlepin-dev when you
run if you'd like to run tests against code you're working on. I hope to add
oracle / mysql containers soon, which would mean you don't necessarily need to
set all of these up on your main system anymore.

candlepin-base container just sets up the development environment without a
database and is capable of running the unit tests successfully. It uses
supervisor to manage postgres and tomcat services as systemd is not container
friendly yet.

candlepin-postgresql layers on top of base and adds in postgresql setup,
default command runs the rspec tests. A slightly modified version of
postgresql-setup is included as the stock one in F20 tries to read values from
systemd which we don't have here.

Option included to open a shell once tests are complete, or you could skip
the tests to just get a shell into the dev environment you setup.

You can pull these images if on vpn from:
docker pull docker.usersys.redhat.com/dgoodwin/candlepin-postgresql

Run unit tests against latest master:
docker run -i -P -t --rm docker.usersys.redhat.com/dgoodwin/candlepin-postgresql cp-test -u

Run spec tests against your current git checkout:
docker run -v /home/dgoodwin/src/candlepin:/candlepin-dev -i -P -t --rm docker.usersys.redhat.com/dgoodwin/candlepin-postgresql cp-test -r

Run bash in a live tomcat/postgresql environment, you can combine this option to leave a shell open after tests complete:
docker run -i -P -t --rm docker.usersys.redhat.com/dgoodwin/candlepin-postgresql cp-test -s

Oracle / MySQL containers to follow.

Fedora 20 users, watch out, docker is pretty busted right now if you're on kernel-3.15.4-200.fc20.x86_64. Reboot onto kernel-3.14.6-200.fc20.x86_64 and you're golden. ( https://bugzilla.redhat.com/show_bug.cgi?id=1119849 )