-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-tests.sh
executable file
·80 lines (56 loc) · 1.99 KB
/
run-tests.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
PYTHON="${PYTHON:-python3.12}"
set -e
OAREPO_VERSION="${OAREPO_VERSION:-12}"
BUILDER_VENV=.venv-builder
if test -d $BUILDER_VENV ; then
rm -rf $BUILDER_VENV
fi
$PYTHON -m venv $BUILDER_VENV
. $BUILDER_VENV/bin/activate
pip install -U setuptools pip wheel
pip install -U oarepo-model-builder oarepo-model-builder-files
if test -d records2 ; then
rm -rf records2
fi
oarepo-compile-model ./tests/records2.yaml --output-directory records2 --profile record,files -vvv
pip install -U oarepo-model-builder-drafts oarepo-model-builder-drafts-files
if test -d thesis ; then
rm -rf thesis
fi
oarepo-compile-model ./tests/thesis.yaml --output-directory thesis -vvv
VENV=".venv"
if test -d $VENV ; then
rm -rf $VENV
fi
$PYTHON -m venv $VENV
. $VENV/bin/activate
pip install -U setuptools pip wheel
pip install "oarepo[tests]==${OAREPO_VERSION}.*"
pip install -e ".[tests]"
pip install -e records2
pip install pytest-invenio
# pip install -e records
pip install -e thesis
pip uninstall -y uritemplate
pip install uritemplate
invenio index destroy --force --yes-i-know || true
## run OOM separately as it needs its own configuration of logging
pytest -m "not oom" tests
pytest -m "oom" tests
test -d $VENV/var/instance || mkdir $VENV/var/instance
POSTGRES_HOST="${POSTGRES_HOST:-localhost}"
cat tests/records2_async_data/invenio.cfg | sed "s/POSTGRES_HOST/${POSTGRES_HOST}/g" > $VENV/var/instance/invenio.cfg
invenio db destroy --yes-i-know || true
invenio db init create
invenio index destroy --force --yes-i-know || true
invenio index init
invenio oarepo cf init
invenio files location create --default default file:////tmp/data
celery -A invenio_app.celery worker -l INFO -c 1 &
CELERY_PID=$!
trap "kill $CELERY_PID" EXIT
sleep 5
python3 tests/records2_async_data/generate_async_data_for_import.py /tmp/sample-records-for-import 100
invenio oarepo fixtures load --no-system-fixtures /tmp/sample-records-for-import --on-background --bulk-size 10
python3 tests/records2_async_data/check_async_data_loaded.py 100