forked from cyverse/atmosphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for running tests in Docker container.
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
# BEWARE! This script: | ||
# - Drops two databases | ||
# - Deletes a user | ||
# - Overwrites your variables.ini, local.py, secrets.py, etc. | ||
# - Forcibly updates packages in your virtual environment | ||
# | ||
# Read it. | ||
|
||
# Usage: | ||
# 0. Start a bash session in your atmosphere docker container | ||
# (docker exec -it <container_name> /bin/bash) | ||
# 1. ./run_tests_like_travis.sh [cyverse|jetstream] | ||
|
||
set -e | ||
set -x | ||
|
||
# Install pre-dependencies | ||
apt-get update && apt-get install -y postgresql | ||
|
||
DISTRIBUTION=${1:-cyverse} | ||
VENV_PATH=/opt/env/atmo-test | ||
ATMO_PATH=/opt/dev/atmosphere | ||
SUDO_POSTGRES='' # Leave empty if sudo not required to run dropdb, createdb & psql | ||
PIP_TOOLS_VERSION=1.9.0 | ||
|
||
cd $ATMO_PATH | ||
if [ ! -d "$VENV_PATH" ]; then | ||
virtualenv "$VENV_PATH"; | ||
fi | ||
source $VENV_PATH/bin/activate | ||
|
||
# pip install -U pip setuptools pip-tools=="$PIP_TOOLS_VERSION" | ||
# pip-sync dev_requirements.txt | ||
pip install -r dev_requirements.txt | ||
echo "DROP DATABASE IF EXISTS atmosphere_db" | ./manage.py dbshell | ||
echo "DROP DATABASE IF EXISTS test_atmosphere_db" | ./manage.py dbshell | ||
echo "DROP USER IF EXISTS atmosphere_db_user" | ./manage.py dbshell | ||
echo "CREATE USER atmosphere_db_user WITH PASSWORD 'atmosphere_db_pass' CREATEDB;" | ./manage.py dbshell | ||
echo "CREATE DATABASE atmosphere_db WITH OWNER atmosphere_db_user;" | ./manage.py dbshell | ||
|
||
|
||
mv ./variables.ini ./variables.ini.bak | ||
cp ./variables.ini.dist ./variables.ini | ||
patch variables.ini variables_for_testing_${DISTRIBUTION}_docker.ini.patch | ||
./configure | ||
# ./travis/check_properly_generated_requirements.sh | ||
|
||
# python manage.py test --keepdb | ||
rm -f rerun_failing.features | ||
python manage.py behave --keepdb --tags ~@skip-if-${DISTRIBUTION} | ||
mv ./variables.ini.bak ./variables.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- variables.ini.dist 2019-05-31 21:38:20.029217819 +0000 | ||
+++ variables.ini 2019-05-31 21:45:15.413243671 +0000 | ||
@@ -40,7 +40,7 @@ | ||
DATABASE_ENGINE = django.db.backends.postgresql_psycopg2 # postgres only (for now) | ||
DATABASE_USER = atmosphere_db_user # psql_user | ||
DATABASE_PASSWORD = atmosphere_db_pass # psql_password | ||
-DATABASE_HOST = localhost # remote.postgres-server.com | ||
+DATABASE_HOST = postgres # remote.postgres-server.com | ||
DATABASE_PORT = 5432 | ||
DATABASE_CONN_MAX_AGE = 60 # in seconds | ||
DEBUG = True # Boolean required | ||
@@ -58,7 +58,10 @@ | ||
LOGSTASH_PORT = # 8000 | ||
METRIC_SERVER = # atmosphere-metrics.server.com | ||
SELF_SIGNED_CERT = False # Boolean required | ||
-TESTING = False # Boolean required | ||
+TESTING = True # Boolean required | ||
+TEST_RUNNER_USER = # Nothing | ||
+TEST_RUNNER_PASS = # Nothing | ||
+DJANGO_JENKINS = False | ||
#local.py - site configuration | ||
AUTO_CREATE_NEW_ACCOUNTS = False # Boolean required | ||
AUTO_CREATE_NEW_PROJECTS = False # Boolean required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- variables.ini.dist 2019-05-31 20:42:48.909010495 +0000 | ||
+++ variables.ini 2019-05-31 21:30:15.025187633 +0000 | ||
@@ -40,7 +40,7 @@ | ||
DATABASE_ENGINE = django.db.backends.postgresql_psycopg2 # postgres only (for now) | ||
DATABASE_USER = atmosphere_db_user # psql_user | ||
DATABASE_PASSWORD = atmosphere_db_pass # psql_password | ||
-DATABASE_HOST = localhost # remote.postgres-server.com | ||
+DATABASE_HOST = postgres # remote.postgres-server.com | ||
DATABASE_PORT = 5432 | ||
DATABASE_CONN_MAX_AGE = 60 # in seconds | ||
DEBUG = True # Boolean required | ||
@@ -58,12 +58,15 @@ | ||
LOGSTASH_PORT = # 8000 | ||
METRIC_SERVER = # atmosphere-metrics.server.com | ||
SELF_SIGNED_CERT = False # Boolean required | ||
-TESTING = False # Boolean required | ||
+TESTING = True # Boolean required | ||
+TEST_RUNNER_USER = # Nothing | ||
+TEST_RUNNER_PASS = # Nothing | ||
+DJANGO_JENKINS = False | ||
#local.py - site configuration | ||
AUTO_CREATE_NEW_ACCOUNTS = False # Boolean required | ||
AUTO_CREATE_NEW_PROJECTS = False # Boolean required | ||
ALLOCATION_SOURCE_COMPUTE_ALLOWED = 168 # Boolean required | ||
-USE_JETSTREAM_PLUGIN = False # Boolean required | ||
+USE_JETSTREAM_PLUGIN = True # Boolean required | ||
TIME_ZONE = # America/Phoenix | ||
SITE_NAME = # CyVerse | ||
ORG_NAME = # CyVerse |