diff --git a/bitnami/drupal/.gitmodules b/bitnami/drupal/.gitmodules new file mode 100644 index 000000000000..835835c8322b --- /dev/null +++ b/bitnami/drupal/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests"] + path = tests + url = https://github.com/bitnami/bitnami-docker-tests.git diff --git a/bitnami/drupal/test.sh b/bitnami/drupal/test.sh new file mode 100644 index 000000000000..8171e64dbb07 --- /dev/null +++ b/bitnami/drupal/test.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bats + +WELCOME_PAGE_TEXT="Welcome to My blog" + +MARIADB_IMAGE_NAME=bitnami/mariadb +MARIADB_CONTAINER_NAME=bitnami-mariadb-test + +# source the helper script +APP_NAME=drupal +SLEEP_TIME=300 +VOLUMES=/bitnami/$APP_NAME:/bitnami/apache +load tests/docker_helper + +# Cleans up all running/stopped containers and host mounted volumes +cleanup_environment() { + if docker ps -a | grep $MARIADB_CONTAINER_NAME; then + docker rm -fv $MARIADB_CONTAINER_NAME + fi + container_remove_full default +} + +# Teardown called at the end of each test +teardown() { + cleanup_environment +} + +# cleanup the environment of any leftover containers and volumes before starting the tests +cleanup_environment + +create_mariadb_container() { + docker run --name $MARIADB_CONTAINER_NAME -d $MARIADB_IMAGE_NAME + sleep 90 +} + +@test "Port 80 and 443 is exposed and accepting connections" { + create_mariadb_container + container_create default -d \ + --link $MARIADB_CONTAINER_NAME:mariadb \ + --env MARIADB_HOST=mariadb \ + --env MARIADB_PORT=3306 + + run container_exec default curl --noproxy 127.0.0.1 http://127.0.0.1:80 + [[ "$output" =~ "$WELCOME_PAGE_TEXT" ]] + + run container_exec default curl -k --noproxy 127.0.0.1 https://127.0.0.1:443 + [[ "$output" =~ "$WELCOME_PAGE_TEXT" ]] +} + diff --git a/bitnami/drupal/tests b/bitnami/drupal/tests new file mode 160000 index 000000000000..6e9148c2ea75 --- /dev/null +++ b/bitnami/drupal/tests @@ -0,0 +1 @@ +Subproject commit 6e9148c2ea750d6c249a2144cdf068e61de4e61a