Skip to content

Commit

Permalink
[timseries] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nepython committed Jul 27, 2020
1 parent b85985b commit c789856
Show file tree
Hide file tree
Showing 20 changed files with 388 additions and 132 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,27 @@ addons:

services:
- docker
- redis-server
- elasticsearch

branches:
only:
- master
- dev

before_install:
# - docker run -d --name influxdb -e INFLUXDB_DB=openwisp2 -p 8086:8086 influxdb:alpine
# - docker run -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch:7.8.0
- docker-compose up -d
# - docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.0.1
- pip install -U pip wheel setuptools
- pip install $DJANGO
- pip install -U -r requirements-test.txt

install:
- pip install -e .
- pip install -e .[influxdb,elasticsearch]
- sh install-dev.sh

script:
- ./run-qa-checks
- SAMPLE_APP=1 coverage run --source=openwisp_monitoring runtests.py
- coverage report -m
- coverage run -a --source=openwisp_monitoring runtests.py

jobs:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ WORKDIR /opt/openwisp/tests/
ENV NAME=openwisp-monitoring \
PYTHONBUFFERED=1 \
INFLUXDB_HOST=influxdb \
REDIS_HOST=redis
REDIS_HOST=redis \
ELASTICSEARCH_HOST=es01
CMD ["sh", "docker-entrypoint.sh"]
EXPOSE 8000
42 changes: 34 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
depends_on:
- influxdb
- redis
- es01
- es02

influxdb:
image: influxdb:1.8-alpine
Expand All @@ -23,24 +25,45 @@ services:
INFLUXDB_USER: openwisp
INFLUXDB_USER_PASSWORD: openwisp
# clustered version of elasticsearch is used as that might be used in production
elasticsearch:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
container_name: es01
environment:
- node.name: openwisp2
- cluster.name: openwisp2
- bootstrap.memory_lock: true
- "node.name=es01"
- "discovery.seed_hosts=es02"
- "cluster.initial_master_nodes=es01,es02"
- "cluster.name=openwisp2"
- "bootstrap.memory_lock=true"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
- esdata01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
- esnet
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
container_name: es02
environment:
- "node.name=es02"
- "discovery.seed_hosts=es01"
- "cluster.initial_master_nodes=es01,es02"
- "cluster.name=openwisp2"
- "bootstrap.memory_lock=true"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- esnet

redis:
image: redis:5.0-alpine
ports:
Expand All @@ -49,7 +72,10 @@ services:

volumes:
influxdb-data: {}
esdata01:
driver: local
esdata02:
driver: local

networks:
elastic:
driver: bridge
esnet:
Loading

0 comments on commit c789856

Please sign in to comment.