docker_helper: added APP_NAME script variable, allowing other script variables to be assigned default values

This commit is contained in:
Sameer Naik
2015-11-09 18:08:41 +05:30
parent d0b884d8f3
commit fba7cd7228
2 changed files with 13 additions and 11 deletions

View File

@@ -1,11 +1,5 @@
#!/usr/bin/env bats
CONTAINER_NAME=bitnami-postgresql-test
IMAGE_NAME=${IMAGE_NAME:-bitnami/postgresql}
SLEEP_TIME=5
VOL_PREFIX=/bitnami/postgresql
HOST_VOL_PREFIX=${HOST_VOL_PREFIX:-/tmp/bitnami/$CONTAINER_NAME}
POSTGRESQL_DATABASE=test_database
POSTGRESQL_ROOT_USER=postgres
POSTGRESQL_USER=test_user
@@ -14,6 +8,7 @@ POSTGRESQL_REPLICATION_USER=repl_user
POSTGRESQL_REPLICATION_PASSWORD=repl_password
# source the helper script
APP_NAME=postgresql
load tests/docker_helper
# Link to container and execute command

View File

@@ -6,13 +6,20 @@
# The following variables should be defined in you BATS script for this helper
# script to work correctly.
#
# CONTAINER_NAME - prefix for the name of containers that will be created
# IMAGE_NAME - the docker image name
# SLEEP_TIME - time in seconds to wait for containers to start
# VOL_PREFIX - prefix of volumes inside the container
# HOST_VOL_PREFIX - prefix of volumes mounted from the host
# APP_NAME - app name
# CONTAINER_NAME - prefix for the name of containers that will be created (default: bitnami-$APP_NAME-test)
# IMAGE_NAME - the docker image name (default: bitnami/$APP_NAME)
# SLEEP_TIME - time in seconds to wait for containers to start (default: 5)
# VOL_PREFIX - prefix of volumes inside the container (default: /bitnami/$APP_NAME)
# HOST_VOL_PREFIX - prefix of volumes mounted from the host (default: /tmp/bitnami/$CONTAINER_NAME)
##
CONTAINER_NAME=bitnami-$APP_NAME-test
IMAGE_NAME=${IMAGE_NAME:-bitnami/$APP_NAME}
SLEEP_TIME=${SLEEP_TIME:-5}
VOL_PREFIX=${VOL_PREFIX:-/bitnami/$APP_NAME}
HOST_VOL_PREFIX=${HOST_VOL_PREFIX:-/tmp/bitnami/$CONTAINER_NAME}
# Creates a container whose name has the prefix $CONTAINER_NAME
# $1: name for the new container
# ${@:2}: additional arguments for docker run while starting the container