Skip to content

Commit

Permalink
Build update and cleanup (elastic#1640)
Browse files Browse the repository at this point in the history
* Update Redis tests to 3.2.0
* Simplify docker-entrypoint.sh file
  • Loading branch information
ruflin authored and andrewkroh committed May 13, 2016
1 parent ce1ae88 commit c138b6c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 55 deletions.
2 changes: 1 addition & 1 deletion libbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ logstash:
- ${PWD}/build/test.env

redis:
image: redis:3.0.7
image: redis:3.2.0

# This host name is fixed because of the certificate
sredis: # stunnel proxy for redis
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mysql:
- MYSQL_ROOT_PASSWORD=test

redis:
image: redis:3.0.7
image: redis:3.2.0

zookeeper:
image: jplock/zookeeper:3.4.8
58 changes: 11 additions & 47 deletions metricbeat/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env bash
set -e

waitForApache() {
echo -n "Waiting for apache(${APACHE_HOST}:${APACHE_PORT}) to start."
# Wait for. Params: host, port, service
waitFor() {
echo -n "Waiting for ${3}(${1}:${2}) to start."
for ((i=1; i<=90; i++)) do
if nc -vz ${APACHE_HOST} ${APACHE_PORT} 2>/dev/null; then
if nc -vz ${1} ${2} 2>/dev/null; then
echo
echo "Apache is ready!"
echo "${3} is ready!"
return 0
fi

Expand All @@ -16,51 +17,14 @@ waitForApache() {
done

echo
echo >&2 'Apache is not available'
echo >&2 "Address: ${APACHE_HOST}:${APACHE_PORT}"
}

waitForRedis() {
echo -n "Waiting for redis(${REDIS_HOST}:${REDIS_PORT}) to start."
for ((i=1; i<=90; i++)) do
if nc -vz ${REDIS_HOST} ${REDIS_PORT} 2>/dev/null; then
echo
echo "Redis is ready!"
return 0
fi

((i++))
echo -n '.'
sleep 1
done

echo
echo >&2 'Redis is not available'
echo >&2 "Address: ${REDIS_HOST}:${REDIS_PORT}"
}


waitForMySQL() {
echo -n "Waiting for mysql(${MYSQL_HOST}:${MYSQL_PORT}) to start."
for ((i=1; i<=90; i++)) do
if nc -vz ${MYSQL_HOST} ${MYSQL_PORT} 2>/dev/null; then
echo
echo "MYSQL_HOST is ready!"
return 0
fi
echo >&2 '${3} is not available'
echo >&2 "Address: ${1}:${2}"

((i++))
echo -n '.'
sleep 1
done

echo
echo >&2 'MySQL is not available'
echo >&2 "Address: ${MYSQL_HOST}:${MYSQL_PORT}"
}

# Main
waitForApache
waitForRedis
waitForMySQL
waitFor ${APACHE_HOST} ${APACHE_PORT} Apache
waitFor ${REDIS_HOST} ${REDIS_PORT} Redis
waitFor ${MYSQL_HOST} ${MYSQL_PORT} MySQL
waitFor ${ZOOKEEPER_HOST} ${ZOOKEEPER_PORT} Zookeeper
exec "$@"
2 changes: 1 addition & 1 deletion metricbeat/docs/developer-guide/testing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ existing docker modules and can be added as simple as redis:
[source,yaml]
----
redis:
image: redis:3.0.7
image: redis:3.2.0
----

To make sure the service is running before the tests are started, the
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docs/modules/redis/info.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Below is an example document generated by this metricset.
"redis_git_dirty": "0",
"redis_git_sha1": "00000000",
"redis_mode": "standalone",
"redis_version": "3.0.7",
"redis_version": "3.2.0",
"run_id": "8e1659f076c248591812705a24e545257ee6e090",
"tcp_port": "6379",
"uptime_in_days": "20",
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/redis/info/_beat/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"redis_git_dirty": "0",
"redis_git_sha1": "00000000",
"redis_mode": "standalone",
"redis_version": "3.0.7",
"redis_version": "3.2.0",
"run_id": "8e1659f076c248591812705a24e545257ee6e090",
"tcp_port": "6379",
"uptime_in_days": "20",
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/redis/info/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Package info fetches Redis server information and statistics using the Redis
INFO command.
The current implementation is tested with redis 3.0.7
The current implementation is tested with redis 3.2.0
More details on all the fields provided by the redis info command can be found here: http://redis.io/commands/INFO
`info.go` uses the Redis `INFO default` command for stats. This allows us to fetch all metrics at once and filter out
Expand Down Expand Up @@ -78,7 +78,7 @@ The document sent to elasticsearch has the following structure:
"redis_git_dirty": "0",
"redis_git_sha1": "00000000",
"redis_mode": "standalone",
"redis_version": "3.0.7",
"redis_version": "3.2.0",
"run_id": "8e1659f076c248591812705a24e545257ee6e090",
"tcp_port": "6379",
"uptime_in_days": "20",
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/redis/info/info_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

const (
password = "foobared"
version = "3.0.7"
version = "3.2.0"
)

var redisHost = redis.GetRedisEnvHost() + ":" + redis.GetRedisEnvPort()
Expand Down

0 comments on commit c138b6c

Please sign in to comment.