Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33079423 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Bootstrap functional test

Before to try to optimize spot engines we need to
have some tests to bench the search duration and that
performs some checks on the results
parent cc26dde7
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -21,10 +21,24 @@ coding-rules:
  script:
    - ./manage.sh pep8_check

unittest:
unit-test:
  stage: test
  before_script:
    - ./manage.sh update_dev_packages
  script:
    - ./manage.sh unit_tests
  coverage: '/TOTAL.*\s+(\d+%)$/'

functional-test:
  stage: test
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_HOST: tcp://docker:2375/
    DOCKER_DRIVER: overlay2
  before_script:
    - docker run -id --rm -v $(pwd):/ws -e DOCKER_HOST=tcp://$(cat /etc/hosts | grep docker | cut -f1):2375/ -w /ws --name spotenv $CI_REGISTRY_IMAGE/env:latest sh
    - docker exec -i spotenv ./manage.sh update_dev_packages
  script:
    - docker exec -i spotenv ./manage.sh functional_tests
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ RUN dnf install -y\
 wget\
 python2-pip\
 npm\
 docker \
&& dnf groupinstall -y "Development Tools" \
&& pip3 install ipdb ipython \
&& pip3 install -r /requirements.txt \
+9 −2
Original line number Diff line number Diff line
@@ -41,13 +41,19 @@ pep8_check() {

unit_tests() {
    echo '[!] Running unit tests'
    PYTHONPATH="$BASE_DIR" pytest --cov=searx --disable-pytest-warnings "$BASE_DIR/tests/unit"
    PYTHONPATH="$BASE_DIR" pytest --cov=searx "$BASE_DIR/tests/unit"
}

functional_tests() {
    echo '[!] Running unit tests'
    PYTHONPATH="$BASE_DIR" pytest "$BASE_DIR/tests/functional"
}

tests() {
    set -e
    pep8_check
    unit_tests
    functional_tests
    set +e
}

@@ -133,8 +139,9 @@ Commands
    Tests
    -----
    unit_tests           - Run unit tests
    functional_tests     - Run functional tests
    pep8_check           - Pep8 validation
    tests                - Run all python tests (pep8, unit, robot_tests)
    tests                - Run all python tests (pep8, unit, functional)
"
}

pytest.ini

0 → 100644
+2 −0
Original line number Diff line number Diff line
[pytest]
addopts = -s --dockerc-build --dockerc-attach-network --disable-pytest-warnings
+1 −0
Original line number Diff line number Diff line
@@ -4,3 +4,4 @@ pycodestyle==2.4.0
mockredispy==2.9.3
pytest==4.1.0
pytest-cov==2.6.1
pytest-dockerc==1.0.5
Loading