forked from influxdata/influxdb-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-and-test.sh
executable file
·55 lines (47 loc) · 1.61 KB
/
compile-and-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
#
# script to start influxdb and compile influxdb-java with all tests.
#
set -e
DEFAULT_INFLUXDB_VERSION="1.6"
DEFAULT_MAVEN_JAVA_VERSION="3-jdk-11-slim"
INFLUXDB_VERSION="${INFLUXDB_VERSION:-$DEFAULT_INFLUXDB_VERSION}"
MAVEN_JAVA_VERSION="${MAVEN_JAVA_VERSION:-$DEFAULT_MAVEN_JAVA_VERSION}"
echo "Run tests with maven:${MAVEN_JAVA_VERSION} on influxdb-${INFLUXDB_VERSION}"
docker kill influxdb || true
docker rm influxdb || true
docker pull influxdb:${INFLUXDB_VERSION}-alpine || true
docker run \
--detach \
--name influxdb \
--publish 8086:8086 \
--publish 8089:8089/udp \
--volume ${PWD}/influxdb.conf:/etc/influxdb/influxdb.conf \
influxdb:${INFLUXDB_VERSION}-alpine
echo "Starting Nginx"
docker kill nginx || true
docker rm nginx || true
docker run \
--detach \
--name nginx \
--publish 8080:8080 \
--publish 8080:8080/udp \
--volume ${PWD}/src/test/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \
--link influxdb:influxdb \
nginx:stable-alpine nginx '-g' 'daemon off;'
echo "Running tests"
PROXY_API_URL=http://nginx:8080/influx-api/
PROXY_UDP_PORT=8080
docker run -it --rm \
--volume ${PWD}:/usr/src/mymaven \
--volume ${PWD}/.m2:/root/.m2 \
--workdir /usr/src/mymaven \
--link=influxdb \
--link=nginx \
--env INFLUXDB_VERSION=${INFLUXDB_VERSION} \
--env INFLUXDB_IP=influxdb \
--env PROXY_API_URL=${PROXY_API_URL} \
--env PROXY_UDP_PORT=${PROXY_UDP_PORT} \
maven:${MAVEN_JAVA_VERSION} mvn clean install
docker kill influxdb || true
docker kill nginx || true