From c61acb559170ad3983ecf6f5268d5e7f56301e02 Mon Sep 17 00:00:00 2001 From: Iuga Mihai Date: Mon, 28 Mar 2022 15:40:24 +0300 Subject: [PATCH] improve github actions --- .github/workflows/pr-integration-tests.yml | 8 ++++++-- Makefile | 2 +- docker-compose.yml | 5 +++++ scripts/script.sh | 10 ++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-integration-tests.yml b/.github/workflows/pr-integration-tests.yml index 607aa8eb..7757d5ba 100644 --- a/.github/workflows/pr-integration-tests.yml +++ b/.github/workflows/pr-integration-tests.yml @@ -23,5 +23,9 @@ jobs: - name: Get dependencies run: | go get -v -t -d ./... - - name: Integration tests - run: make integration-tests + - name: Run integration tests with Elasticsearch v7.16.2 + run: make integration-tests 7.16.2 + - name: Run integration tests with Elasticsearch v8.1.1 + run: make integration-tests 8.1.1 + - name: Run integration tests with Elasticsearch latest version + run: make integration-tests latest diff --git a/Makefile b/Makefile index 06b1c420..f573f7cf 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test: integration-tests: @echo " > Running integration tests" - cd scripts && ./script.sh start + cd scripts && ./script.sh start ${ES_VERSION} go test -v ./integrationtests -tags integrationtests cd scripts && ./script.sh delete cd scripts && ./script.sh stop diff --git a/docker-compose.yml b/docker-compose.yml index 041c0233..7243725c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,11 @@ services: image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0 environment: - "discovery.type=single-node" + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 networks: - es-net ports: diff --git a/scripts/script.sh b/scripts/script.sh index 92fcc38e..96ed78c8 100755 --- a/scripts/script.sh +++ b/scripts/script.sh @@ -1,10 +1,16 @@ IMAGE_NAME=elastic-container +DEFAULT_ES_VERSION=7.16.2 start() { - docker pull docker.elastic.co/elasticsearch/elasticsearch:7.16.2 + ES_VERSION=$1 + if [ -z "${ES_VERSION}" ]; then + ES_VERSION=${DEFAULT_ES_VERSION} + fi + + docker pull docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION} docker rm ${IMAGE_NAME} 2> /dev/null - docker run -d --name "${IMAGE_NAME}" -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.10.0 + docker run -d --name "${IMAGE_NAME}" -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION} # Wait elastic cluster to start echo "Waiting Elasticsearch cluster to start..."