turbo-charged
testing with docker
rob squires
march 2014
@rob_squires
web developer
bbc
uvd
problem
test suites taking longer and longer to run
behat
symfony + nodejs
selenium
solutions
speed up scenarios
tidy up scenarios
run scenarios in parallel
parallel testing
test frameworks
acceptance
behat, cucumber ...
xunit
phpunit, rspec, jasmine, pyunit ...
...
parallel extensions
acceptance
gearman extension, parallel_test
xunit
paratest, deep test, wd parallel, testrepository
complexities
distribute tests across workers
consolidate results
environment collisions
paratest
distribute tests across workers
long running phpunit processes
consolidate results
jUnit - xml
environment collisions
$TEST_TOKEN
distribute tests across workers
long running phpunit processes
consolidate results
jUnit - xml
environment collisions
gearman extension
distribute tests across workers
gearman
consolidate results
custom reporter
environment collisions
docker?
distribute tests across workers
gearman
consolidate results
custom reporter
docker?
gearman extension
@robocoder
http://extensions.behat.org/gearman
example test suite
>>
>>
worker/client run command
docker run -i -t \
-name behat-test-client \--link gearmand:gm \image-name \./bootstrap.sh client
--link gearmand:gm
./bootstrap.sh client
bootstrap.sh
gearman_addr="GM_PORT_4730_TCP_ADDR" gearman_port="GM_PORT_4730_TCP_PORT" export BEHAT_PARAMS="extensions[VIPSoft\GearmanExtension\Extension][gearman_server]=${!gearman_addr}:${!gearman_port}" bin/behat --profile ${1}
docker + behat + gearman
in action..
gearman extension + docker
:) only host dependency is docker
:) gearman handles task management
:) scalable across hosts
:( behat only
docker-based extensions
baleen
horde
other approaches
ruby_fork
gnu parallel
gnu parallel
run commands in parallel
keeps output sequential
can control concurrency, e.g. sem
docker run -t -i $worker_cnt_image ./collector.sh > $file
for task in $(cat $file) ; do
sem --gnu -j $pCount \
docker run -t -i \
$worker_cnt_image \
./runner.sh "$task"
done
docker run -t -i $worker_cnt_image ./collector.sh > $file
for task in $(cat $file) ; do
sem --gnu -j $pCount \
docker run -t -i \
$worker_cnt_image \
./runner.sh "$task"
done
parallel 12s
gearman 9s
why the difference?
one container per feature*
gnu-parallel
the pipework is external
output is usable
roundup
docker can address parallel testing collisions
it's fairly straightforward to produce a generic solution for one container
todos
junit output
control ratio workers:test
multiple containers!!
thanks for listening!!
Title
turbo-charged-testing-with-docker
By Rob Squires
turbo-charged-testing-with-docker
- 2,392