This repo contains a recipe for making a Docker containers for Drupal patch testing, using Linux, Apache, PHP and MySQL/sqlite.
This is part of the core code powering the future version of Drupal automated-testing infrastructure at http://qa.drupal.org .
a) Test patches on your local box or http://qa.drupal.org
b) Test multiple patches and multiple modules at once.
c) Test any Drupal version.
d) Get realtime output.
e) Choose mysql, sqlite (more comming soon)
f) Choose PHP5.3/5.4/5.5
g) Test offline.
h) It's really really easy!
git clone {thisrepo}
cd modernizing_testbot__dockerfiles
sudo ./build_all.sh cleanup
This will not run natively since it's a Virtualbox VM and you need to install Vagrant.
git clone {thisrepo}
cd modernizing_testbot__dockerfiles
vagrant up
sudo TESTGROUPS="Action,Bootstrap" DRUPALBRANCH="8.x" PATCH="/path/to/your.patch,." ./run.sh
See more examples bellow on: "6- RUN EXAMPLES"
curl get.docker.io | sudo sh -x
git clone {thisrepo}
cd modernizing_testbot__dockerfiles
cd distributed/database/mysql
sudo ./build.sh
cd distributed/database/mysql
sudo ./run-server.sh
cd distributed/apachephp/
sudo ./build.sh 5.4
Results will be available at:
{USERHOME}/testbotdata/BUILD_{DATE}/results
and at the live running terminal
Run 'search_api' module tests, with one patch against D8 and git sandbox:
sudo TESTGROUPS="--module 'search_api'" \
DEPENDENCIES_GIT="http://git.drupal.org/sandbox/daeron/2091893.git,master" \
PATCH="https://drupal.org/files/issues/2232253-3.patch,modules/2091893" \
DRUPALBRANCH="8.x" \
./run.sh
Run Action and Node tests, 2 LOCAL patches, using 4 CPUs, against D8:
cd distributed/apachephp/
sudo \
TESTGROUPS="Action,Node" \
CONCURRENCY="4" \
DRUPALBRANCH="8.x" \
PATCH="/tmp/1942178-config-schema-user-28.patch,.;/tmp/1942178-config-schema-30.patch,." \
./run.sh
Run all tests using 4 CPUs, 1 core patch, 1 tgz module, against D8:
cd distributed/apachephp/
sudo \
TESTGROUPS="--all" \
CONCURRENCY="4" \
DRUPALBRANCH="8.x" \
DEPENDENCIES_TGZ="http://ftp.drupal.org/files/projects/admin_menu-8.x-3.x-dev.tar.gz"
PATCH="https://drupal.org/files/issues/1942178-config-schema-user-28.patch,." \
./run.sh
Run all tests using 6 CPUs, 2 patches and 2 modules on D7.26:
cd distributed/apachephp/
sudo \
TESTGROUPS="--all" \
CONCURRENCY="6" \
DRUPALBRANCH="7.26" \
DEPENDENCIES="flag,payment" \
PATCH="https://drupal.org/files/issues/flag_fix_global_flag_uid_2087797_3.patch,sites/all/modules/flag;https://drupal.org/files/issues/payment_2114785_8.patch,sites/all/modules/payment" \
./run.sh
And that's it.
DRUPALBRANCH="8.x"
DRUPALVERSION=""
IDENTIFIER="build_$(date +%Y_%m_%d_%H%M%S)" # Only [a-z0-9-_.] allowed
REPODIR="$HOME/testbotdata"
UPDATEREPO="false" # true to force repos update
BUILDSDIR="$REPODIR"
WORKSPACE="$BUILDSDIR/$IDENTIFIER/"
DEPENDENCIES="" # module1,module2,module2...
DEPENDENCIES_GIT="" # gitrepo1,branch;gitrepo2,branch;...
DEPENDENCIES_TGZ="" # module1_url.tgz,module1_url.tgz,...
PATCH="" # patch_url,apply_dir;patch_url,apply_dir;...
DBUSER="drupaltestbot"
DBPASS="drupaltestbotpw"
DBTYPE="mysql"
DBLINK="--link=drupaltestbot-db:db"
CMD="" # Eg. enter container shell with CMD="/bin/bash"
VERBOSE="false" # true will give verbose
PHPVERSION="5.4"
CONCURRENCY="4" # How many cpus to use per run
TESTGROUPS="--class 'Drupal\block\Tests\NonDefaultBlockAdminTest'" #TESTS TO RUN eg.--all
RUNSCRIPT="php ./scripts/run-tests.sh --php /usr/bin/php --url 'http://localhost' --color --concurrency ${CONCURRENCY} --xml '/var/workspace/results' ${TESTGROUPS} "
sudo \
DRUPALBRANCH="8.x" \
RUNSCRIPT="/usr/bin/php ./core/scripts/run-tests.sh --list" \
./run.sh
If you need to remove the old web image just run this sequence:
sudo docker images | grep "drupal/testbot-web" | awk '{print $3}' | xargs -n1 -I {} sudo docker rm {}
a) Results will be saved at: {USERHOME}/testbotdata/BUILD_{DATE}/results/ so you can delete testbotdata/BUILD_{DATE} after you collect your information
b) Docker generates several runs: While i am developing i use this to rm all old instances
sudo docker ps -a | awk '{print $1}' | xargs -n1 -I {} sudo docker rm {}
.
├── build_all.sh
├── D7TestGroupsClasses.txt
├── D8TestGroupsClasses.txt
├── distributed
│ ├── apachephp
│ │ ├── build.sh
│ │ ├── conf
│ │ │ ├── apache2
│ │ │ │ └── vhost.conf
│ │ │ ├── php5
│ │ │ │ ├── apache2.ini
│ │ │ │ ├── apc.ini
│ │ │ │ └── cli.ini
│ │ │ ├── scripts
│ │ │ │ ├── foreground.sh
│ │ │ │ └── start.sh
│ │ │ └── supervisor
│ │ │ └── supervisord.conf
│ │ ├── Dockerfile -> Dockerfile-PHP5.4
│ │ ├── Dockerfile-PHP5.3
│ │ ├── Dockerfile-PHP5.4
│ │ ├── Dockerfile-PHP5.5
│ │ └── run.sh
│ └── database
│ └── mysql
│ ├── build.sh
│ ├── conf
│ │ └── startup.sh
│ ├── Dockerfile
│ ├── run-client.sh
│ ├── run-server.sh
│ └── stop-server.sh
├── patch.p1
├── provision.sh
├── README.md
├── run.sh -> ./distributed/apachephp/run.sh
├── supervisord
│ ├── build.sh
│ ├── default
│ ├── Dockerfile
│ ├── php-cli.ini
│ ├── php.ini
│ ├── run.sh
│ └── supervisord.conf
└── Vagrantfile
###CREDITS: jthorson ricardoamaro nickschuch beejeebus dasrecht
Feel free to fork and contribute to this code. :)
- Fork the repo
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request