add elasticsearch service to gitlab

This commit is contained in:
Victor Shyba 2021-03-30 15:43:41 -03:00 committed by Lex Berezhny
parent 1e28e21ab5
commit 46dd389d0d
3 changed files with 11 additions and 4 deletions

View file

@ -1,5 +1,11 @@
default: default:
image: python:3.7 image: python:3.7
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
variables:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
#cache: #cache:
@ -41,13 +47,14 @@ test:datanetwork-integration:
stage: test stage: test
script: script:
- pip install tox-travis - pip install tox-travis
- tox -e datanetwork --recreate - ELASTIC_HOST=elasticsearch tox -e datanetwork --recreate
test:blockchain-integration: test:blockchain-integration:
stage: test stage: test
script: script:
- curl "http://elasticsearch:9200/_cat/health"
- pip install tox-travis - pip install tox-travis
- tox -e blockchain - ELASTIC_HOST=elasticsearch tox -e blockchain
test:other-integration: test:other-integration:
stage: test stage: test
@ -55,7 +62,7 @@ test:other-integration:
- apt-get update - apt-get update
- apt-get install -y --no-install-recommends ffmpeg - apt-get install -y --no-install-recommends ffmpeg
- pip install tox-travis - pip install tox-travis
- tox -e other - ELASTIC_HOST=elasticsearch tox -e other
test:json-api: test:json-api:
stage: test stage: test

View file

@ -54,7 +54,6 @@ class SearchIndex:
self.sync_client = AsyncElasticsearch(hosts, timeout=self.sync_timeout) self.sync_client = AsyncElasticsearch(hosts, timeout=self.sync_timeout)
self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout) self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout)
while True: while True:
self.logger.info("DOITDOITDOIT\n\n\n\n%s:%i\n\n\n", self._elastic_host, self._elastic_port)
try: try:
await self.sync_client.cluster.health(wait_for_status='yellow') await self.sync_client.cluster.health(wait_for_status='yellow')
break break

View file

@ -6,6 +6,7 @@ extras = test
changedir = {toxinidir}/tests changedir = {toxinidir}/tests
setenv = setenv =
HOME=/tmp HOME=/tmp
ELASTIC_HOST=localhost
commands = commands =
pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \ pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \
--global-option=fetch \ --global-option=fetch \