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
|
*.iml
|
||||||
cover.out
|
cover.out
|
||||||
cover.*.out
|
cover.*.out
|
||||||
|
*.prom
|
||||||
|
|
|
@ -9,6 +9,8 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
||||||
done
|
done
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
|
METRICS_DIR=$(pwd)
|
||||||
|
|
||||||
# Read the absolute path to the exporter
|
# Read the absolute path to the exporter
|
||||||
postgres_exporter=$(readlink -f $1)
|
postgres_exporter=$(readlink -f $1)
|
||||||
test_binary=$(readlink -f $2)
|
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
|
trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm -v $CONTAINER_NAME; exit 1" EXIT INT TERM
|
||||||
wait_for_postgres localhost 55432
|
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 $?
|
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@localhost:55432/?sslmode=disable" $test_binary --log.level=debug || exit $?
|
||||||
|
|
||||||
# exporter_pid=$!
|
# Extract a raw metric list.
|
||||||
# trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm $CONTAINER_NAME ; kill $exporter_pid; exit 1" EXIT INT TERM
|
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@localhost:55432/?sslmode=disable" $postgres_exporter --log.level=debug --web.listen-address=:$exporter_port &
|
||||||
# wait_for_exporter
|
exporter_pid=$!
|
||||||
#
|
trap "docker logs $CONTAINER_NAME ; docker kill $CONTAINER_NAME ; docker rm -v $CONTAINER_NAME; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||||
# wget -q -O - http://localhost:$exporter_port/metrics 1> /dev/null
|
wait_for_exporter
|
||||||
# if [ "$?" != "0" ]; then
|
|
||||||
# echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
# Dump the metrics to a file.
|
||||||
# kill $exporter_pid
|
wget -q -O - http://localhost:$exporter_port/metrics 1> $METRICS_DIR/.metrics.single.$version.prom
|
||||||
# exit 1
|
if [ "$?" != "0" ]; then
|
||||||
# fi
|
echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
||||||
#
|
kill $exporter_pid
|
||||||
# kill $exporter_pid
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
kill $exporter_pid
|
||||||
docker kill $CONTAINER_NAME
|
docker kill $CONTAINER_NAME
|
||||||
docker rm -v $CONTAINER_NAME
|
docker rm -v $CONTAINER_NAME
|
||||||
trap - EXIT INT TERM
|
trap - EXIT INT TERM
|
||||||
|
@ -123,18 +129,19 @@ smoketest_postgres() {
|
||||||
wait_for_postgres $slave_ip 5432
|
wait_for_postgres $slave_ip 5432
|
||||||
|
|
||||||
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@$master_ip:5432/?sslmode=disable" $test_binary --log.level=debug || exit $?
|
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
|
DATA_SOURCE_NAME="postgresql://postgres:$POSTGRES_PASSWORD@$master_ip:5432/?sslmode=disable" $postgres_exporter --log.level=debug --web.listen-address=:$exporter_port &
|
||||||
# if [ "$?" != "0" ]; then
|
exporter_pid=$!
|
||||||
# echo "Failed on postgres $version ($DOCKER_IMAGE)" 1>&2
|
trap "docker-compose logs; docker-compose down ; docker-compose rm -v ; kill $exporter_pid; exit 1" EXIT INT TERM
|
||||||
# exit 1
|
wait_for_exporter
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# kill $exporter_pid
|
|
||||||
|
|
||||||
|
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 down
|
||||||
docker-compose rm -v
|
docker-compose rm -v
|
||||||
trap - EXIT INT TERM
|
trap - EXIT INT TERM
|
||||||
|
|
Loading…
Reference in New Issue