Merge branch 'next' of https://github.com/elastic/elasticsearch-js into next
This commit is contained in:
2
.ci/.dockerignore
Normal file
2
.ci/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
13
.ci/Dockerfile
Normal file
13
.ci/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
ARG NODE_JS_VERSION=8
|
||||||
|
FROM node:${NODE_JS_VERSION}
|
||||||
|
|
||||||
|
# Create app directory
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Install app dependencies
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "npm", "run", "ci" ]
|
||||||
38
.ci/docker-compose.yml
Normal file
38
.ci/docker-compose.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
version: '3.2'
|
||||||
|
services:
|
||||||
|
client:
|
||||||
|
image: docker.elastic.co/clients/elasticsearch-js:${NODE_JS_VERSION:-8}
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: .ci/Dockerfile
|
||||||
|
args:
|
||||||
|
NODE_JS_VERSION: ${NODE_JS_VERSION:-8}
|
||||||
|
environment:
|
||||||
|
- "TEST_ES_SERVER=http://elasticsearch:9200"
|
||||||
|
volumes:
|
||||||
|
- ..:/usr/src/app
|
||||||
|
# This will mount the node_modules directory
|
||||||
|
# to the host machine using the buildtime directory.
|
||||||
|
- /usr/src/app/node_modules
|
||||||
|
- esvol:/tmp
|
||||||
|
networks:
|
||||||
|
- esnet
|
||||||
|
depends_on:
|
||||||
|
- elasticsearch
|
||||||
|
elasticsearch:
|
||||||
|
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-6.4.0}
|
||||||
|
volumes:
|
||||||
|
- esvol:/tmp
|
||||||
|
networks:
|
||||||
|
- esnet
|
||||||
|
environment:
|
||||||
|
- path.repo=/tmp
|
||||||
|
- "repositories.url.allowed_urls=http://*"
|
||||||
|
- node.attr.testattr=test
|
||||||
|
- bootstrap.memory_lock=false
|
||||||
|
- "discovery.zen.ping.unicast.hosts=elasticsearch"
|
||||||
|
- "http.max_content_length=5mb"
|
||||||
|
networks:
|
||||||
|
esnet:
|
||||||
|
volumes:
|
||||||
|
esvol:
|
||||||
13
.ci/run-tests
Executable file
13
.ci/run-tests
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
#
|
||||||
|
|
||||||
|
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} NODE_JS_VERSION=${NODE_JS_VERSION} docker-compose -f .ci/docker-compose.yml run client
|
||||||
10
.ci/test-matrix.yml
Normal file
10
.ci/test-matrix.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
ELASTICSEARCH_VERSION:
|
||||||
|
- 6.4.0
|
||||||
|
|
||||||
|
NODE_JS_VERSION:
|
||||||
|
- 10
|
||||||
|
- 8
|
||||||
|
- 6
|
||||||
|
|
||||||
|
exclude: ~
|
||||||
@ -19,7 +19,8 @@
|
|||||||
"lint": "standard",
|
"lint": "standard",
|
||||||
"lint:fix": "standard --fix",
|
"lint:fix": "standard --fix",
|
||||||
"generate": "node scripts/run.js",
|
"generate": "node scripts/run.js",
|
||||||
"elasticsearch": "./scripts/es-docker.sh"
|
"elasticsearch": "./scripts/es-docker.sh",
|
||||||
|
"ci": "./scripts/wait-cluster.sh && npm test && npm run test:integration"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Tomas Della Vedova",
|
"name": "Tomas Della Vedova",
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
TEST_ES_SERVER=${TEST_ES_SERVER:-"http://localhost:9200"}
|
||||||
|
|
||||||
attempt_counter=0
|
attempt_counter=0
|
||||||
max_attempts=5
|
max_attempts=5
|
||||||
url='http://localhost:9200/_cluster/health?wait_for_status=green&timeout=50s'
|
url="${TEST_ES_SERVER}/_cluster/health?wait_for_status=green&timeout=50s"
|
||||||
|
|
||||||
echo "Waiting for Elasticsearch..."
|
echo "Waiting for Elasticsearch..."
|
||||||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 55 "$url")" != "200" ]]; do
|
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 55 "$url")" != "200" ]]; do
|
||||||
|
|||||||
@ -238,7 +238,7 @@ if (require.main === module) {
|
|||||||
boolean: ['bailout'],
|
boolean: ['bailout'],
|
||||||
default: {
|
default: {
|
||||||
// node: 'http://elastic:passw0rd@localhost:9200',
|
// node: 'http://elastic:passw0rd@localhost:9200',
|
||||||
node: 'http://localhost:9200',
|
node: process.env.TEST_ES_SERVER || 'http://localhost:9200',
|
||||||
version: '6.4',
|
version: '6.4',
|
||||||
bailout: false
|
bailout: false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user