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

Commit a73f7468 authored by Gaël Duval's avatar Gaël Duval 🏄🏼
Browse files

Merge branch 'nicofonk/tests' into 'master'

Add basic functional test

See merge request e/cloud/my-spot!24
parents ff600724 ce092d6e
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ image: $CI_REGISTRY_IMAGE/env:latest
stages:
 - build
 - test
 - report

front-end:
  stage: build
@@ -21,10 +22,40 @@ coding-rules:
  script:
    - ./manage.sh pep8_check

unittest:
unit-test:
  stage: test
  before_script:
    - ./manage.sh update_dev_packages
  script:
    - ./manage.sh unit_tests
  artifacts:
    paths:
      - coverage
    expire_in: 1 hour

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
  artifacts:
    paths:
      - coverage
    expire_in: 1 hour

coverage:
  stage: report
  script:
    - ./manage.sh coverage
  dependencies:
    - unit-test
    - functional-test
  coverage: '/TOTAL.*\s+(\d+%)$/'
+2 −7
Original line number Diff line number Diff line
@@ -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 \
@@ -32,11 +31,7 @@ RUN apk -U add \
    ca-certificates \
 && rm -f /var/cache/apk/*

COPY . .

RUN chown -R searx:searx *

USER searx
COPY searx /usr/local/searx/searx

RUN sed -i "s/127.0.0.1/0.0.0.0/g" searx/settings.yml

+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 \
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ with one command.

- Run the docker-compose **up** command to start the project ``docker-compose up --build``
- Getting the ip of the spot service and go to http://<spot-ip>:8888
- Or you can use the command line ``curl -X POST -F 'category=general' -F 'language=en-US' -F 'q=lequipe' -F 'time_range=' -F 'output=json' http://<spot-ip>:8888/``

.. note::  Here the command to get the IP of the spot service
 ``docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-spot_spot_1``
+18 −0
Original line number Diff line number Diff line
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
Loading