Skip to content

Commit f32af81

Browse files
authored
Merge pull request #36 from unt-libraries/fix-docker-test-env
Make minor fixes to the Docker testing environment
2 parents 80d3b67 + 9fbae4b commit f32af81

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ before_script:
77
- ./build_travis_settings.sh
88
- ./docker-compose.sh pull default-db-test sierra-db-test solr-test redis-appdata-test
99
- ./docker-compose.sh build manage-test test
10-
- ./init-dockerdata.sh test
10+
- ./init-dockerdata.sh tests
1111

1212
script: ./docker-compose.sh run --rm test

django/sierra/sierra/settings/.env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ TEST_DEFAULT_DB_HOST=localhost
7979
TEST_DEFAULT_DB_PORT=3206
8080
TEST_SOLR_PORT=8883
8181
TEST_SOLR_HOST=solr.example.com
82+
TEST_SOLRMARC_CONFIG_FILE=test_config.properties
8283
TEST_SOLR_HAYSTACK_URL=http://${TEST_SOLR_HOST}:${TEST_SOLR_PORT}/solr/haystack
8384
TEST_SOLR_BIBDATA_URL=http://${TEST_SOLR_HOST}:${TEST_SOLR_PORT}/solr/bibdata
8485
TEST_SOLR_MARC_URL=http://${TEST_SOLR_HOST}:${TEST_SOLR_PORT}/solr/marc

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ services:
169169
- redis-appdata-test
170170
volumes:
171171
- .:/project/catalog-api
172+
- ./docker_data/test/logs:/project/logs
173+
- ./docker_data/test/media:/project/media
174+
environment:
175+
- SOLRMARC_CONFIG_FILE=${TEST_SOLRMARC_CONFIG_FILE:-test_config.properties}
172176
working_dir: /project/catalog-api/
173177
networks:
174178
- testing
@@ -184,6 +188,8 @@ services:
184188
- default-db-dev
185189
volumes:
186190
- .:/project/catalog-api
191+
- ./docker_data/app/logs:/project/logs
192+
- ./docker_data/app/media:/project/media
187193
networks:
188194
- development
189195
working_dir: /project/catalog-api/django/sierra
@@ -200,11 +206,14 @@ services:
200206
- sierra-db-test
201207
volumes:
202208
- .:/project/catalog-api
209+
- ./docker_data/test/logs:/project/logs
210+
- ./docker_data/test/media:/project/media
203211
networks:
204212
- testing
205213
working_dir: /project/catalog-api/django/sierra
206214
environment:
207215
- DJANGO_SETTINGS_MODULE=sierra.settings.test
216+
- SOLRMARC_CONFIG_FILE=${TEST_SOLRMARC_CONFIG_FILE:-test_config.properties}
208217
entrypoint: wait-for-it.sh -t 30 default-db-test:3306 -- wait-for-it.sh -t 30 sierra-db-test:5432 -- /project/catalog-api/django/sierra/manage.py
209218

210219
networks:

init-dockerdata.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DDPATH=./docker_data
1111
SIERRA_FIXTURE_PATH=./django/sierra/base/fixtures
1212
SCRIPTNAME="$(basename "$0")"
1313
DEV_SERVICES=("default-db-dev" "solr-dev" "redis-celery" "redis-appdata-dev" "app" "celery-worker")
14-
TEST_SERVICES=("default-db-test" "sierra-db-test" "solr-test" "redis-appdata-test")
14+
TEST_SERVICES=("default-db-test" "sierra-db-test" "solr-test" "redis-appdata-test" "test")
1515
ALL_SERVICES=("${DEV_SERVICES[@]}" "${TEST_SERVICES[@]}")
1616

1717
### FUNCTIONS ###
@@ -29,7 +29,7 @@ function show_help {
2929
echo "-v Only run volume setup on host machine (skip migrations). Cannot be"
3030
echo " used with -m."
3131
echo "group Provide one argument to set up multiple services. Must be \"all\","
32-
echo " \"dev\", or \"test\". \"all\" sets up all services."
32+
echo " \"dev\", or \"tests\". \"all\" sets up all services."
3333
echo "service One or more service names to initialize. Note that services are set up"
3434
echo " in the order specified. Use -s to see more info about services."
3535
echo ""
@@ -75,23 +75,26 @@ function show_services {
7575
echo " The celery-worker service that runs in development. A log directory is set"
7676
echo " up. No migrations."
7777
echo ""
78-
echo "default-db-test -- test"
78+
echo "default-db-test -- tests"
7979
echo " The default Django MariaDB database for a test environment. Migrations are"
8080
echo " needed to set up the needed Django apps. This must be set up and migrated"
8181
echo " before you run initial migrations on sierra-db-test."
8282
echo ""
83-
echo "sierra-db-test -- test"
83+
echo "sierra-db-test -- tests"
8484
echo " The sierra PostGreSQL database for a test environment. Migrations are"
8585
echo " needed to install sierra test fixtures. But, before you run migrations for"
8686
echo " the first time on sierra-db-test, you must make sure that default-db-test"
8787
echo " is set up and migrated."
8888
echo ""
89-
echo "solr-test -- test"
89+
echo "solr-test -- tests"
9090
echo " Empty instance of Solr for a test environment. No migrations (yet)."
9191
echo ""
92-
echo "redis-appdata-test -- test"
92+
echo "redis-appdata-test -- tests"
9393
echo " Redis instance that stores some app data in test. No migrations (yet)."
9494
echo ""
95+
echo "test -- tests"
96+
echo " Log and media directories are set up for the test environment. No "
97+
echo " migrations."
9598
exit 1
9699
}
97100

@@ -273,7 +276,7 @@ for arg in $@; do
273276
dev)
274277
user_services+=("${DEV_SERVICES[@]}")
275278
;;
276-
test)
279+
tests)
277280
user_services+=("${TEST_SERVICES[@]}")
278281
;;
279282
*)
@@ -337,6 +340,10 @@ for service in ${user_services[@]}; do
337340
celery-worker)
338341
paths=("$DDPATH/celery_worker/logs")
339342
;;
343+
test)
344+
paths=("$DDPATH/test/logs"
345+
"$DDPATH/test/media")
346+
;;
340347
*)
341348
echo ""
342349
echo "Warning: Skipping \`$service\`. Either it is not a valid service, or it does not use data volumes."

0 commit comments

Comments
 (0)