Revise the versions on a few queries, improve query tests

* Add ability to specify the sslmode parameter when connecting to
  PostgreSQL

* Fix min versions for replication queries

* Add query-tests target to main Makefile
This commit is contained in:
James Campbell 2025-06-01 00:11:44 -04:00
parent c0e1531083
commit 80304f40d1
Signed by: james
GPG Key ID: 2287C33A40DC906A
4 changed files with 20 additions and 10 deletions

View File

@ -22,7 +22,7 @@ SUPPORTED := ubuntu-20.04 \
# These targets are the main ones to use for most things.
##
.PHONY: all clean tgz test install
.PHONY: all clean tgz test query-tests install
# Build all packages
@ -64,6 +64,10 @@ clean:
test:
cd src ; python3 -m unittest
# Run query tests
query-tests:
cd tests ; ./run-tests.sh
# Install the script at the specified base directory
install:
# Set up directories
@ -92,7 +96,7 @@ install:
# Run all of the install tests
.PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test
.PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test gentoo-install-test
install-tests: $(foreach distro_release, $(SUPPORTED), $(distro_release)-install-test)
@ -124,6 +128,11 @@ oraclelinux-%-install-test:
oraclelinux:7 \
bash -c 'yum makecache && yum install -y /output/$(PACKAGE_NAME)-$(VERSION)-1.el7.noarch.rpm'
# Run a Gentoo install test
gentoo-install-test:
# May impliment this in the future, but would require additional headaches to set up a repo
true
##
# Container targets
#

View File

@ -11,7 +11,7 @@ metrics:
discover_slots:
type: set
query:
0: SELECT slot_name, plugin, slot_type, database, false as temporary, active FROM pg_replication_slots
90400: SELECT slot_name, plugin, slot_type, database, false as temporary, active FROM pg_replication_slots
100000: SELECT slot_name, plugin, slot_type, database, temporary, active FROM pg_replication_slots
# cluster-wide metrics
@ -20,9 +20,9 @@ metrics:
query:
0: SHOW server_version_num
max_frozen_age:
type: value
type: row
query:
0: SELECT max(age(datfrozenxid)) FROM pg_database
0: SELECT max(age(datfrozenxid)), max(mxid_age(datminmxid)) FROM pg_database
# Per-database metrics
db_stats:
@ -43,7 +43,7 @@ metrics:
rep_stats:
type: row
query:
0: SELECT * FROM pg_stat_replication WHERE client_addr || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') = '{repid}'
90400: SELECT * FROM pg_stat_replication WHERE client_addr || '_' || regexp_replace(application_name, '[ ,]', '_', 'g') = '{repid}'
test_args:
repid: 127.0.0.1_test_rep
@ -57,7 +57,7 @@ metrics:
slot_stats:
type: row
query:
0: SELECT active_pid, xmin, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) AS restart_bytes, pg_xlog_location_diff(pg_current_xlog_location(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
90400: SELECT active_pid, xmin, pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) AS restart_bytes, pg_xlog_location_diff(pg_current_xlog_location(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
100000: SELECT active_pid, xmin, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS restart_bytes, pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) AS confirmed_flush_bytes FROM pg_replication_slots WHERE slot_name = '{slot}'
test_args:
slot: test_slot

View File

@ -23,7 +23,7 @@ services:
test: [ "CMD-SHELL", "pg_controldata /var/lib/postgresql/data/ | grep -q 'in production'" ]
interval: 5s
timeout: 2s
retries: 10
retries: 20
command: >
postgres -c ssl=on
-c ssl_cert_file='/etc/ssl/certs/ssl-cert-snakeoil.pem'

View File

@ -8,8 +8,9 @@ dbhost: db
dbport: 5432
dbuser: postgres
# Allow some insecure SSL parameters for the 9.2 test
ssl_ciphers: DEFAULT@SECLEVEL=1
# The SSL cipher parameters are too old in the 9.2 container, so we allow the tests
# to be run without encryption
ssl_mode: prefer
# Pull in the standard metrics
include: