Add support for running tests from a Docker container.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-05-21 00:39:40 -04:00
parent 047962d946
commit 9a5c281a8b
3 changed files with 43 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ job_docker_master:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" -f docker/Dockerfile . - docker build --pull -t "$CI_REGISTRY_IMAGE" -f docker/Dockerfile .
- docker run --rm "$CI_REGISTRY_IMAGE" run-tests
- docker push "$CI_REGISTRY_IMAGE" - docker push "$CI_REGISTRY_IMAGE"
only: only:
- master - master
@@ -24,6 +25,7 @@ job_docker_other:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -f docker/Dockerfile . - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -f docker/Dockerfile .
- docker run --rm "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" run-tests
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except: except:
- master - master

View File

@@ -0,0 +1,8 @@
#!/bin/sh
apt-get update
apt-get install -y --no-install-recommends tesseract-ocr-deu
pip install -r $DOCKER_ROOT/requirements-testing.txt
mayan-edms.py test --mayan-apps

View File

@@ -3,6 +3,7 @@
set -e set -e
echo "mayan: starting entrypoint.sh" echo "mayan: starting entrypoint.sh"
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
export DOCKER_ROOT=/root
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0 export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0 export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
@@ -57,8 +58,9 @@ pip_installs() {
os_package_installs || true os_package_installs || true
pip_installs || true pip_installs || true
if [ "$1" = 'mayan' ]; then case "$1" in
# Check if this is a new install, otherwise try to upgrade the existing
mayan) # Check if this is a new install, otherwise try to upgrade the existing
# installation on subsequent starts # installation on subsequent starts
if [ ! -f $INSTALL_FLAG ]; then if [ ! -f $INSTALL_FLAG ]; then
initialize initialize
@@ -66,6 +68,19 @@ if [ "$1" = 'mayan' ]; then
upgrade upgrade
fi fi
start start
else ;;
su mayan -c "mayan-edms.py $@";
fi run-tests) # Check if this is a new install, otherwise try to upgrade the existing
# installation on subsequent starts
if [ ! -f $INSTALL_FLAG ]; then
initialize
else
upgrade
fi
$DOCKER_ROOT/run-tests.sh
;;
*) su mayan -c "$@";
;;
esac