Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
infra
spot
Commits
ce092d6e
Commit
ce092d6e
authored
Jan 12, 2019
by
Nicolas Gelot
Browse files
Include coverage of functional tests
parent
741cc323
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
ce092d6e
...
...
@@ -3,6 +3,7 @@ image: $CI_REGISTRY_IMAGE/env:latest
stages
:
-
build
-
test
-
report
front-end
:
stage
:
build
...
...
@@ -27,7 +28,10 @@ unit-test:
-
./manage.sh update_dev_packages
script
:
-
./manage.sh unit_tests
coverage
:
'
/TOTAL.*\s+(\d+%)$/'
artifacts
:
paths
:
-
coverage
expire_in
:
1 hour
functional-test
:
stage
:
test
...
...
@@ -42,3 +46,16 @@ functional-test:
-
docker exec -i spotenv ./manage.sh update_dev_packages
script
:
-
docker exec -i spotenv ./manage.sh functional_tests
artifacts
:
paths
:
-
coverage
expire_in
:
1 hour
coverage
:
stage
:
report
script
:
-
./manage.sh coverage
dependencies
:
-
unit-test
-
functional-test
coverage
:
'
/TOTAL.*\s+(\d+%)$/'
Dockerfile
View file @
ce092d6e
...
...
@@ -6,8 +6,6 @@ EXPOSE 8888
WORKDIR
/usr/local/searx
CMD
["python", "searx/webapp.py"]
RUN
adduser
-D
-h
/usr/local/searx
-s
/bin/sh searx searx
COPY
requirements.txt ./requirements.txt
RUN
apk
-U
add
\
...
...
@@ -22,6 +20,7 @@ RUN apk -U add \
ca-certificates
\
&&
pip
install
--upgrade
pip
\
&&
pip
install
--no-cache
-r
requirements.txt
\
&&
pip
install
--no-cache
coverage
\
&&
apk del
\
build-base
\
libffi-dev
\
...
...
@@ -34,10 +33,6 @@ RUN apk -U add \
COPY
searx /usr/local/searx/searx
RUN
chown
-R
searx:searx /usr/local/searx
USER
searx
RUN
sed
-i
"s/127.0.0.1/0.0.0.0/g"
searx/settings.yml
STOPSIGNAL
SIGINT
docker-compose-coverage.yml
0 → 100644
View file @
ce092d6e
version
:
'
3.6'
services
:
spot
:
entrypoint
:
-
coverage
-
run
-
--source=searx
command
:
-
searx/webapp.py
volumes
:
-
coverage:/coverage
environment
:
COVERAGE_FILE
:
/coverage/func
volumes
:
coverage
:
name
:
spot-coverage
manage.sh
View file @
ce092d6e
...
...
@@ -8,6 +8,7 @@ set -e
# subshell
PYTHONPATH
=
"
$BASE_DIR
"
SEARX_DIR
=
"
$BASE_DIR
/searx"
COV_DIR
=
"
$BASE_DIR
/coverage"
ACTION
=
"
$1
"
...
...
@@ -41,12 +42,26 @@ pep8_check() {
unit_tests
()
{
echo
'[!] Running unit tests'
PYTHONPATH
=
"
$BASE_DIR
"
pytest
--cov
=
searx
"
$BASE_DIR
/tests/unit"
mkdir
-p
"
$COV_DIR
"
chmod
a+w
"
$COV_DIR
"
PYTHONPATH
=
"
$BASE_DIR
"
COVERAGE_FILE
=
"
$COV_DIR
"
/unit pytest
--cov
=
searx
"
$BASE_DIR
/tests/unit"
}
functional_tests
()
{
echo
'[!] Running unit tests'
PYTHONPATH
=
"
$BASE_DIR
"
pytest
"
$BASE_DIR
/tests/functional"
mkdir
-p
"
$COV_DIR
"
chmod
a+w
"
$COV_DIR
"
PYTHONPATH
=
"
$BASE_DIR
"
COMPOSE_FILE
=
docker-compose.yml:docker-compose-coverage.yml
\
pytest
"
$BASE_DIR
/tests/functional"
docker run
-itd
--rm
--name
tmp-vol
-v
spot-coverage:/coverage alpine
docker
cp
tmp-vol:/coverage/func
$COV_DIR
docker stop tmp-vol
}
coverage
()
{
sed
-i
's!/usr/local/searx!'
$BASE_DIR
'!g'
"
$COV_DIR
"
/func
coverage3 combine coverage/func coverage/unit
coverage3 report
}
tests
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment