forked from OpenGov-OpenData/ckanext-datajson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·34 lines (30 loc) · 994 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Setup and run extension tests. This script should be run in a _clean_ CKAN
# environment. e.g.:
#
# $ docker-compose run --rm app ./test.sh
#
set -o errexit
set -o pipefail
# Wrapper for paster/ckan.
# CKAN 2.9 replaces paster with ckan CLI. This wrapper abstracts which comand
# is called.
#
# In order to keep the parsing simple, the first argument MUST be
# --plugin=plugin-name. The config option -c is assumed to be
# test.ini because the argument ordering matters to paster and
# ckan, and again, we want to keep the parsing simple.
function ckan_wrapper () {
if command -v paster > /dev/null; then
paster "$@" -c test.ini
else
shift # drop the --plugin= argument
ckan -c test.ini "$@"
fi
}
# Database is listening, but still unavailable. Just keep trying...
while ! ckan_wrapper --plugin=ckan db init; do
echo Retrying in 5 seconds...
sleep 5
done
pytest --ckan-ini=test.ini --cov=ckanext.datajson --disable-warnings ckanext/datajson/tests/