64 lines
1.6 KiB
Bash
Executable File
64 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Runs the client tests via Docker with the expectation that the required
|
|
# environment variables have already been exported before running this script.
|
|
#
|
|
# The required environment variables include:
|
|
#
|
|
# - $ELASTICSEARCH_VERSION
|
|
# - $NODE_JS_VERSION
|
|
# - $TEST_SUITE
|
|
#
|
|
|
|
set -eo pipefail
|
|
|
|
ELASTICSEARCH_VERSION=${STACK_VERSION}
|
|
|
|
docker build \
|
|
--file .ci/Dockerfile \
|
|
--tag elastic/elasticsearch-js \
|
|
--build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
|
|
.
|
|
|
|
NODE_NAME="es1"
|
|
repo=$(pwd)
|
|
testnodecrt="/.ci/certs/testnode.crt"
|
|
testnodekey="/.ci/certs/testnode.key"
|
|
cacrt="/.ci/certs/ca.crt"
|
|
|
|
elasticsearch_image="elasticsearch"
|
|
elasticsearch_url="https://elastic:changeme@${NODE_NAME}:9200"
|
|
if [[ $TEST_SUITE != "xpack" ]]; then
|
|
elasticsearch_image="elasticsearch"
|
|
elasticsearch_url="http://${NODE_NAME}:9200"
|
|
fi
|
|
|
|
docker network create esnet
|
|
|
|
docker run \
|
|
--rm \
|
|
--env "node.attr.testattr=test" \
|
|
--env "path.repo=/tmp" \
|
|
--env "repositories.url.allowed_urls=http://snapshot.*" \
|
|
--env "discovery.zen.ping.unicast.hosts=${NODE_NAME}" \
|
|
--env "xpack.security.enabled=false" \
|
|
--env "xpack.monitoring.enabled=false" \
|
|
--env "xpack.ml.enabled=false" \
|
|
--env ES_JAVA_OPTS="-Xms1g -Xmx1g" \
|
|
--network=esnet \
|
|
--name=$NODE_NAME \
|
|
--detach \
|
|
docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION}
|
|
|
|
docker run \
|
|
--network=esnet \
|
|
--env "TEST_ES_SERVER=${elasticsearch_url}" \
|
|
--volume $(pwd):/usr/src/app \
|
|
--volume /usr/src/app/node_modules \
|
|
--name elasticsearch-js \
|
|
--rm \
|
|
elastic/elasticsearch-js \
|
|
npm run test:integration
|
|
|