-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·40 lines (30 loc) · 1.04 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·40 lines (30 loc) · 1.04 KB
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
35
36
37
38
39
40
#!/bin/bash
set -euo pipefail
grant_superuser() {
local url="${1#*://}"
local user="${url%%:*}"
local host="${url#*@}"; host="${host%%:*}"
local port="${url#*:}"; port="${port#*:}"; port="${port%%/*}"
echo "Granting SUPERUSER to ${user} (${host}:${port})..."
PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "${host}" -p "${port}" -U postgres \
-c "ALTER ROLE ${user} SUPERUSER;"
}
grant_superuser "${DATABASE_URL}"
grant_superuser "${GEODATABASE_URL}"
echo "PG setup done."
echo "Start loading data."
GISDATA_DIR=$(python -c "import gisdata; print(gisdata.GOOD_DATA)")
TYPE="${1:-}"
DATA_DIR="${GISDATA_DIR}"
if [[ "${TYPE}" =~ ^(vector|raster|time)$ ]]; then
DATA_DIR="${GISDATA_DIR}/${TYPE}"
fi
if [[ ! -d "${MEDIA_ROOT}" ]]; then
echo "media root not available, creating..."
mkdir -p "${MEDIA_ROOT}"
fi
python -W ignore manage.py importlayers -v2 -hh "${SITEURL}" "${DATA_DIR}"
echo "Loading data done."
echo "Start test"
coverage run --branch --source=geonode manage.py test -v 3 --keepdb $@
echo "test completed."