Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
7
box/tests/config.yml
Normal file
7
box/tests/config.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Update the composer_home_path for global installs.
|
||||
composer_home_path: "/{{ drupalvm_user }}/.composer"
|
||||
|
||||
# Don't run the 'disable firewall' tasks in tests.
|
||||
firewall_disable_firewalld: false
|
||||
firewall_disable_ufw: false
|
23
box/tests/initctl_faker
Normal file
23
box/tests/initctl_faker
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
ALIAS_CMD="$(echo ""$0"" | sed -e 's?/sbin/??')"
|
||||
|
||||
case "$ALIAS_CMD" in
|
||||
start|stop|restart|reload|status)
|
||||
exec service $1 $ALIAS_CMD
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
list )
|
||||
exec service --status-all
|
||||
;;
|
||||
reload-configuration )
|
||||
exec service $2 restart
|
||||
;;
|
||||
start|stop|restart|reload|status)
|
||||
exec service $2 $1
|
||||
;;
|
||||
\?)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
187
box/tests/run-tests.sh
Executable file
187
box/tests/run-tests.sh
Executable file
|
@ -0,0 +1,187 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# A script to run Drupal VM functional tests.
|
||||
|
||||
# Set defaults if they're not set upstream.
|
||||
CONFIG="${CONFIG:-tests/config.yml}"
|
||||
MAKEFILE="${MAKEFILE:-example.drupal.make.yml}"
|
||||
COMPOSERFILE="${COMPOSERFILE:-example.drupal.composer.json}"
|
||||
HOSTNAME="${HOSTNAME:-drupalvm.test}"
|
||||
MACHINE_NAME="${MACHINE_NAME:-drupalvm}"
|
||||
IP="${IP:-192.168.88.88}"
|
||||
DRUPALVM_DIR="${DRUPALVM_DIR:-/var/www/drupalvm}"
|
||||
DRUSH_BIN="${DRUSH_BIN:-drush}"
|
||||
TEST_INSTALLED_EXTRAS="${TEST_INSTALLED_EXTRAS:-true}"
|
||||
CONTAINER_ID="${CONTAINER_ID:-dvm-test}"
|
||||
type="${type:-tests/defaults}"
|
||||
distro="${distro:-ubuntu1604}"
|
||||
cleanup="${cleanup:-true}"
|
||||
|
||||
## Set up vars for Docker setup.
|
||||
# CentOS 7
|
||||
if [ $distro = 'centos7' ]; then
|
||||
init="/usr/lib/systemd/systemd"
|
||||
opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
# CentOS 6
|
||||
elif [ $distro = 'centos6' ]; then
|
||||
init="/sbin/init"
|
||||
opts="--privileged"
|
||||
# Ubuntu 16.04
|
||||
elif [ $distro = 'ubuntu1604' ]; then
|
||||
init="/lib/systemd/systemd"
|
||||
opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
# Ubuntu 14.04
|
||||
elif [ $distro = 'ubuntu1404' ]; then
|
||||
init="/sbin/init"
|
||||
opts="--privileged"
|
||||
# Debian 9
|
||||
elif [ $distro = 'debian9' ]; then
|
||||
init="/lib/systemd/systemd"
|
||||
opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
# Debian 8
|
||||
elif [ $distro = 'debian8' ]; then
|
||||
init="/lib/systemd/systemd"
|
||||
opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
# Fedora 24
|
||||
elif [ $distro = 'fedora24' ]; then
|
||||
init="/usr/lib/systemd/systemd"
|
||||
opts="--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
fi
|
||||
|
||||
# Set OS-specific options.
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
volume_opts='rw,cached'
|
||||
else
|
||||
volume_opts='rw'
|
||||
fi
|
||||
|
||||
# Use correct xargs command depending if it's GNU or BSD.
|
||||
if xargs --version 2>&1 | grep -s GNU >/dev/null; then
|
||||
xargs_command='xargs -r'
|
||||
else
|
||||
xargs_command='xargs'
|
||||
fi
|
||||
|
||||
# Exit on any individual command failure.
|
||||
set -e
|
||||
|
||||
# Pretty colors.
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
neutral='\033[0m'
|
||||
|
||||
# Remove test container if it already exists.
|
||||
printf "\n"${green}"Removing any existing test containers..."${neutral}"\n"
|
||||
docker ps -aq --filter name=$CONTAINER_ID | $xargs_command docker rm -f -v
|
||||
printf ${green}"...done!"${neutral}"\n"
|
||||
|
||||
# Run the container.
|
||||
printf "\n"${green}"Starting Docker container: geerlingguy/docker-$distro-ansible."${neutral}"\n"
|
||||
docker run --name=$CONTAINER_ID -d \
|
||||
--add-host "$HOSTNAME drupalvm":127.0.0.1 \
|
||||
-v $PWD:/var/www/drupalvm/:$volume_opts \
|
||||
$opts \
|
||||
geerlingguy/docker-$distro-ansible:latest \
|
||||
$init
|
||||
|
||||
# Set up directories.
|
||||
docker exec $CONTAINER_ID mkdir -p /var/www/drupalvm/drupal
|
||||
[[ ! -z "$config_dir" ]] && docker exec $CONTAINER_ID mkdir -p $config_dir || true
|
||||
|
||||
# Copy configuration into place.
|
||||
docker exec $CONTAINER_ID cp $DRUPALVM_DIR/$CONFIG ${config_dir:-$DRUPALVM_DIR}/config.yml
|
||||
docker exec $CONTAINER_ID cp $DRUPALVM_DIR/$MAKEFILE ${config_dir:-$DRUPALVM_DIR}/drupal.make.yml
|
||||
docker exec $CONTAINER_ID cp $DRUPALVM_DIR/$COMPOSERFILE ${config_dir:-$DRUPALVM_DIR}/drupal.composer.json
|
||||
[[ ! -z "$DRUPALVM_ENV" ]] && docker exec $CONTAINER_ID bash -c "cp $DRUPALVM_DIR/tests/$DRUPALVM_ENV.config.yml ${config_dir:-$DRUPALVM_DIR}/$DRUPALVM_ENV.config.yml" || true
|
||||
|
||||
# Override configuration variables with local config.
|
||||
[[ ! -z "$local_config" ]] && docker exec $CONTAINER_ID bash -c "cp $DRUPALVM_DIR/$local_config ${config_dir:-$DRUPALVM_DIR}/local.config.yml" || true
|
||||
|
||||
# Check playbook syntax.
|
||||
printf "\n"${green}"Checking playbook syntax..."${neutral}"\n"
|
||||
docker exec --tty $CONTAINER_ID env TERM=xterm ansible-playbook $DRUPALVM_DIR/provisioning/playbook.yml --syntax-check
|
||||
|
||||
# Run the setup playbook.
|
||||
printf "\n"${green}"Running the setup playbook..."${neutral}"\n"
|
||||
docker exec --tty $CONTAINER_ID env TERM=xterm ansible-playbook /var/www/drupalvm/tests/test-setup.yml
|
||||
|
||||
# Run the Drupal VM playbook.
|
||||
printf "\n"${green}"Running the Drupal VM playbook..."${neutral}"\n"
|
||||
if [ ! -z "${config_dir}" ]; then
|
||||
# Run with config_dir specified.
|
||||
docker exec $CONTAINER_ID env TERM=xterm ANSIBLE_FORCE_COLOR=true DRUPALVM_ENV=$DRUPALVM_ENV \
|
||||
ansible-playbook $DRUPALVM_DIR/provisioning/playbook.yml \
|
||||
--extra-vars="config_dir=$config_dir";
|
||||
else
|
||||
# Run without config_dir specified.
|
||||
docker exec $CONTAINER_ID env TERM=xterm ANSIBLE_FORCE_COLOR=true DRUPALVM_ENV=$DRUPALVM_ENV \
|
||||
ansible-playbook $DRUPALVM_DIR/provisioning/playbook.yml;
|
||||
fi
|
||||
|
||||
# Drupal.
|
||||
printf "\n"${green}"Running functional tests..."${neutral}"\n"
|
||||
docker exec $CONTAINER_ID curl -sSi --header Host:$HOSTNAME localhost \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q '<title>Welcome to Drupal' \
|
||||
&& (echo 'Drupal install pass' && exit 0) \
|
||||
|| (echo 'Drupal install fail' && cat /tmp/dvm-test && exit 1)
|
||||
|
||||
# Adminer.
|
||||
if [ $TEST_INSTALLED_EXTRAS = true ]; then
|
||||
docker exec $CONTAINER_ID curl -sSi --header Host:adminer.$HOSTNAME localhost \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q '<title>Login - Adminer' \
|
||||
&& (echo 'Adminer install pass' && exit 0) \
|
||||
|| (echo 'Adminer install fail' && cat /tmp/dvm-test && exit 1)
|
||||
fi
|
||||
|
||||
# Pimp My Log.
|
||||
if [ $TEST_INSTALLED_EXTRAS = true ]; then
|
||||
docker exec $CONTAINER_ID curl -sSi --header Host:pimpmylog.$HOSTNAME localhost \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q '<title>Pimp my Log' \
|
||||
&& (echo 'Pimp my Log install pass' && exit 0) \
|
||||
|| (echo 'Pimp my Log install fail' && cat /tmp/dvm-test && exit 1)
|
||||
fi
|
||||
|
||||
# MailHog.
|
||||
if [ $TEST_INSTALLED_EXTRAS = true ]; then
|
||||
docker exec $CONTAINER_ID curl -sSi localhost:8025 \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q '<title>MailHog' \
|
||||
&& (echo 'MailHog install pass' && exit 0) \
|
||||
|| (echo 'MailHog install fail' && cat /tmp/dvm-test && exit 1)
|
||||
fi
|
||||
|
||||
# Varnish.
|
||||
if [ $TEST_INSTALLED_EXTRAS = true ]; then
|
||||
docker exec $CONTAINER_ID curl -sSI --header Host:$HOSTNAME localhost:81 \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q 'Via: .* varnish' \
|
||||
&& (echo 'Varnish install pass' && exit 0) \
|
||||
|| (echo 'Varnish install fail' && cat /tmp/dvm-test && exit 1)
|
||||
fi
|
||||
|
||||
# Dashboard.
|
||||
docker exec $CONTAINER_ID curl -sSi --header Host:$IP localhost \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q "<li>$IP $HOSTNAME</li>" \
|
||||
&& (echo 'Dashboard install pass' && exit 0) \
|
||||
|| (echo 'Dashboard install fail' && cat /tmp/dvm-test && exit 1)
|
||||
|
||||
# Drush.
|
||||
docker exec $CONTAINER_ID $DRUSH_BIN @$MACHINE_NAME.$HOSTNAME status \
|
||||
| tee /tmp/dvm-test \
|
||||
| grep -q 'Drupal bootstrap.*Successful' \
|
||||
&& (echo 'Drush install pass' && exit 0) \
|
||||
|| (echo 'Drush install fail' && cat /tmp/dvm-test && exit 1)
|
||||
|
||||
# Remove test container.
|
||||
if [ $cleanup = true ]; then
|
||||
printf "\n"${green}"Cleaning up..."${neutral}"\n"
|
||||
docker rm -f $CONTAINER_ID
|
||||
printf ${green}"...done!"${neutral}"\n\n"
|
||||
else
|
||||
printf "\n"${green}"Skipping cleanup for container id: ${CONTAINER_ID}!"${neutral}"\n"
|
||||
printf ${green}"Done!"${neutral}"\n\n"
|
||||
fi
|
21
box/tests/test-setup.yml
Normal file
21
box/tests/test-setup.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Install test dependencies (RedHat).
|
||||
package: name=logrotate state=present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Copy initctl_faker into place for Ubuntu 14.04.
|
||||
copy:
|
||||
src: initctl_faker
|
||||
dest: /sbin/initctl
|
||||
mode: 0755
|
||||
force: yes
|
||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
|
||||
changed_when: false
|
7
box/tests/ubuntu-16-nginx.config.yml
Normal file
7
box/tests/ubuntu-16-nginx.config.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
drupalvm_webserver: nginx
|
||||
|
||||
# Test makefile based installation.
|
||||
drupal_build_makefile: true
|
||||
drupal_build_composer_project: false
|
||||
drupal_core_path: "/var/www/drupalvm/drupal"
|
4
box/tests/ubuntu-16-php56.config.yml
Normal file
4
box/tests/ubuntu-16-php56.config.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
php_version: "5.6"
|
||||
php_sendmail_path: "/usr/sbin/sendmail -t -i"
|
||||
installed_extras: []
|
4
box/tests/ubuntu-16-postgresql.config.yml
Normal file
4
box/tests/ubuntu-16-postgresql.config.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
drupal_db_backend: pgsql
|
||||
php_sendmail_path: "/usr/sbin/sendmail -t -i"
|
||||
installed_extras: []
|
Loading…
Add table
Add a link
Reference in a new issue