Have smoketests output representative samples of metrics.
Future: build the current master and produce a comparison.
This commit is contained in:
parent
53b9d9cea7
commit
f6e4292bc5
|
@ -8,4 +8,4 @@ postgres_exporter_integration_test
|
|||
*.iml
|
||||
cover.out
|
||||
cover.*.out
|
||||
|
||||
*.prom
|
||||
|
|
|
@ -9,6 +9,8 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
|||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
METRICS_DIR=$(pwd)
|
||||
|
||||
# Read the absolute path to the exporter
|
||||
postgres_exporter=$(readlink -f $1)
|
||||
test_binary=$(readlink -f $2)
|
||||
|
@ -80,20 +82,24 @@ smoketest_postgres() {
|
|||
trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm -v $CONTAINER_NAME; exit 1" EXIT INT TERM
|
||||
wait_for_postgres localhost 55432
|
||||
|
||||
# Run the test binary.
|
||||
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@localhost:55432/?sslmode=disable" $test_binary --log.level=debug || exit $?
|
||||
|
||||
# exporter_pid=$!
|
||||
# trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm $CONTAINER_NAME ; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||
# wait_for_exporter
|
||||
#
|
||||
# wget -q -O - http://localhost:$exporter_port/metrics 1> /dev/null
|
||||
# if [ "$?" != "0" ]; then
|
||||
# echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
||||
# kill $exporter_pid
|
||||
# exit 1
|
||||
# fi
|
||||
#
|
||||
# kill $exporter_pid
|
||||
# Extract a raw metric list.
|
||||
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@localhost:55432/?sslmode=disable" $postgres_exporter --log.level=debug --web.listen-address=:$exporter_port &
|
||||
exporter_pid=$!
|
||||
trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm -v $CONTAINER_NAME; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||
wait_for_exporter
|
||||
|
||||
# Dump the metrics to a file.
|
||||
wget -q -O - http://localhost:$exporter_port/metrics 1> $METRICS_DIR/.metrics.single.$version.prom
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
||||
kill $exporter_pid
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kill $exporter_pid
|
||||
docker kill $CONTAINER_NAME
|
||||
docker rm -v $CONTAINER_NAME
|
||||
trap - EXIT INT TERM
|
||||
|
@ -123,18 +129,19 @@ smoketest_postgres() {
|
|||
wait_for_postgres $slave_ip 5432
|
||||
|
||||
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@$master_ip:5432/?sslmode=disable" $test_binary --log.level=debug || exit $?
|
||||
# exporter_pid=$!
|
||||
# trap "docker-compose logs; docker-compose down ; docker-compose rm -v ; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||
# wait_for_exporter
|
||||
|
||||
# wget -q -O - http://localhost:$exporter_port/metrics 1> /dev/null
|
||||
# if [ "$?" != "0" ]; then
|
||||
# echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
||||
# exit 1
|
||||
# fi
|
||||
#
|
||||
# kill $exporter_pid
|
||||
|
||||
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@$master_ip:5432/?sslmode=disable" $postgres_exporter --log.level=debug --web.listen-address=:$exporter_port &
|
||||
exporter_pid=$!
|
||||
trap "docker-compose logs; docker-compose down ; docker-compose rm -v ; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||
wait_for_exporter
|
||||
|
||||
wget -q -O - http://localhost:$exporter_port/metrics 1> $METRICS_DIR/.metrics.replicated.$version.prom
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kill $exporter_pid
|
||||
docker-compose down
|
||||
docker-compose rm -v
|
||||
trap - EXIT INT TERM
|
||||
|
|
Loading…
Reference in New Issue