Skip to content

Commit

Permalink
completed regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbe committed Jun 15, 2022
1 parent 9bf8198 commit 0d0bda8
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
- name: Install extra build dependencies
run: sudo apt-get install -y golang
- name: Build
run: go generate && go build
run: make REVISION="xxxx" BRANCH="ci" VERSION="unittest" BUILD_USER="ci" BUILD_DATE="0000-00-00"
- name: Test on PostgreSQL ${{ matrix.pg }}
run: if ! make installcheck; then cat regression.diffs; exit 1; fi
2 changes: 1 addition & 1 deletion expected/all_0.out
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ go_memstats_sys_bytes
go_threads
# HELP pg_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pg_exporter was built.
# TYPE pg_exporter_build_info gauge
pg_exporter_build_info{branch="",goversion="",revision="",version=""}
pg_exporter_build_info{branch="ci",goversion="",revision="xxxx",version="unittest"}
# HELP postgresql_archiver_archived_count_total Number of WAL files that have been successfully archived
# TYPE postgresql_archiver_archived_count_total counter
postgresql_archiver_archived_count_total
Expand Down
2 changes: 1 addition & 1 deletion expected/all_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ go_memstats_sys_bytes
go_threads
# HELP pg_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pg_exporter was built.
# TYPE pg_exporter_build_info gauge
pg_exporter_build_info{branch="",goversion="",revision="",version=""}
pg_exporter_build_info{branch="ci",goversion="",revision="xxxx",version="unittest"}
# HELP postgresql_archiver_archived_count_total Number of WAL files that have been successfully archived
# TYPE postgresql_archiver_archived_count_total counter
postgresql_archiver_archived_count_total
Expand Down
2 changes: 1 addition & 1 deletion expected/all_2.out
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ go_memstats_sys_bytes
go_threads
# HELP pg_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pg_exporter was built.
# TYPE pg_exporter_build_info gauge
pg_exporter_build_info{branch="",goversion="",revision="",version=""}
pg_exporter_build_info{branch="ci",goversion="",revision="xxxx",version="unittest"}
# HELP postgresql_archiver_archived_count_total Number of WAL files that have been successfully archived
# TYPE postgresql_archiver_archived_count_total counter
postgresql_archiver_archived_count_total
Expand Down
2 changes: 1 addition & 1 deletion expected/all_3.out
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ go_memstats_sys_bytes
go_threads
# HELP pg_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pg_exporter was built.
# TYPE pg_exporter_build_info gauge
pg_exporter_build_info{branch="",goversion="",revision="",version=""}
pg_exporter_build_info{branch="ci",goversion="",revision="xxxx",version="unittest"}
# HELP postgresql_archiver_archived_count_total Number of WAL files that have been successfully archived
# TYPE postgresql_archiver_archived_count_total counter
postgresql_archiver_archived_count_total
Expand Down
23 changes: 22 additions & 1 deletion expected/all_4.out
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ go_memstats_sys_bytes
go_threads
# HELP pg_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pg_exporter was built.
# TYPE pg_exporter_build_info gauge
pg_exporter_build_info{branch="",goversion="",revision="",version=""}
pg_exporter_build_info{branch="ci",goversion="",revision="xxxx",version="unittest"}
# HELP postgresql_archiver_archived_count_total Number of WAL files that have been successfully archived
# TYPE postgresql_archiver_archived_count_total counter
postgresql_archiver_archived_count_total
Expand Down Expand Up @@ -151,6 +151,9 @@ postgresql_bgwriter_maxwritten_clean_total
# HELP postgresql_bgwriter_stats_reset Time at which these statistics were last reset
# TYPE postgresql_bgwriter_stats_reset counter
postgresql_bgwriter_stats_reset
# HELP postgresql_database_active_time_total Time spent executing SQL statements in this database, in milliseconds
# TYPE postgresql_database_active_time_total counter
postgresql_database_active_time_total{database="contrib_regression",database_id=""}
# HELP postgresql_database_backends Number of backends currently connected to this database
# TYPE postgresql_database_backends gauge
postgresql_database_backends{database="contrib_regression",database_id=""}
Expand Down Expand Up @@ -190,6 +193,9 @@ postgresql_database_deadlocks_total{database="contrib_regression",database_id=""
# HELP postgresql_database_frozen_xid All transaction IDs before this one have been replaced with a permanent transaction ID in this database
# TYPE postgresql_database_frozen_xid counter
postgresql_database_frozen_xid{database="contrib_regression"}
# HELP postgresql_database_idle_in_transaction_time_total Time spent idling while in a transaction in this database, in milliseconds
# TYPE postgresql_database_idle_in_transaction_time_total counter
postgresql_database_idle_in_transaction_time_total{database="contrib_regression",database_id=""}
# HELP postgresql_database_min_mxid All multixact IDs before this one have been replaced with a transaction ID in this database
# TYPE postgresql_database_min_mxid counter
postgresql_database_min_mxid{database="contrib_regression"}
Expand All @@ -208,6 +214,21 @@ postgresql_database_rows_returned_total{database="contrib_regression",database_i
# HELP postgresql_database_rows_updated_total Number of rows updated by queries in this database
# TYPE postgresql_database_rows_updated_total counter
postgresql_database_rows_updated_total{database="contrib_regression",database_id=""}
# HELP postgresql_database_session_time_total Time spent by database sessions in this database, in milliseconds
# TYPE postgresql_database_session_time_total counter
postgresql_database_session_time_total{database="contrib_regression",database_id=""}
# HELP postgresql_database_sessions_abandoned_count Number of database sessions to this database that were terminated because connection to the client was lost
# TYPE postgresql_database_sessions_abandoned_count counter
postgresql_database_sessions_abandoned_count{database="contrib_regression",database_id=""}
# HELP postgresql_database_sessions_count Total number of sessions established to this database
# TYPE postgresql_database_sessions_count counter
postgresql_database_sessions_count{database="contrib_regression",database_id=""}
# HELP postgresql_database_sessions_fatal_count Number of database sessions to this database that were terminated by fatal errors
# TYPE postgresql_database_sessions_fatal_count counter
postgresql_database_sessions_fatal_count{database="contrib_regression",database_id=""}
# HELP postgresql_database_sessions_killed_count Number of database sessions to this database that were terminated by operator intervention
# TYPE postgresql_database_sessions_killed_count counter
postgresql_database_sessions_killed_count{database="contrib_regression",database_id=""}
# HELP postgresql_database_stats_reset Time at which these statistics were last reset
# TYPE postgresql_database_stats_reset counter
postgresql_database_stats_reset{database="contrib_regression",database_id=""}
Expand Down
2 changes: 1 addition & 1 deletion expected/start.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ show unix_socket_directories \gset
\setenv PGHOST :unix_socket_directories
select current_database() as database \gset
\setenv PGDATABASE :database
\! ./pg-exporter --log.level=warn & echo $! > pid; sleep 0.1
\! ./bin/pg_exporter --log.level=warn & echo $! > pid; sleep 0.1
\! curl -sf localhost:9135/metrics | grep postgresql_up
# HELP postgresql_up Whether the PostgreSQL server is up.
# TYPE postgresql_up gauge
Expand Down
38 changes: 38 additions & 0 deletions expected/stat_database_4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
select current_setting('server_version_num')::int / 10000 >= 10 as is_pg_10;
is_pg_10
----------
t
(1 row)

\! curl -sf localhost:9135/metrics | grep "^postgresql_database_" | sed -e 's/database_id="[0-9]*"/database_id=""/' -e 's/ \([1-9]\|0\.\).*/ NNN/'
postgresql_database_active_time_total{database="contrib_regression",database_id=""} NNN
postgresql_database_backends{database="contrib_regression",database_id=""} NNN
postgresql_database_blk_read_seconds_total{database="contrib_regression",database_id=""} 0
postgresql_database_blk_write_seconds_total{database="contrib_regression",database_id=""} 0
postgresql_database_blocks_hit_total{database="contrib_regression",database_id=""} NNN
postgresql_database_blocks_read_total{database="contrib_regression",database_id=""} NNN
postgresql_database_conflicts_confl_bufferpin_total{database="contrib_regression",database_id=""} 0
postgresql_database_conflicts_confl_deadlock_total{database="contrib_regression",database_id=""} 0
postgresql_database_conflicts_confl_lock_total{database="contrib_regression",database_id=""} 0
postgresql_database_conflicts_confl_snapshot_total{database="contrib_regression",database_id=""} 0
postgresql_database_conflicts_confl_tablespace_total{database="contrib_regression",database_id=""} 0
postgresql_database_conflicts_total{database="contrib_regression",database_id=""} 0
postgresql_database_deadlocks_total{database="contrib_regression",database_id=""} 0
postgresql_database_frozen_xid{database="contrib_regression"} NNN
postgresql_database_idle_in_transaction_time_total{database="contrib_regression",database_id=""} 0
postgresql_database_min_mxid{database="contrib_regression"} NNN
postgresql_database_rows_deleted_total{database="contrib_regression",database_id=""} 0
postgresql_database_rows_fetched_total{database="contrib_regression",database_id=""} NNN
postgresql_database_rows_inserted_total{database="contrib_regression",database_id=""} 0
postgresql_database_rows_returned_total{database="contrib_regression",database_id=""} NNN
postgresql_database_rows_updated_total{database="contrib_regression",database_id=""} 0
postgresql_database_session_time_total{database="contrib_regression",database_id=""} NNN
postgresql_database_sessions_abandoned_count{database="contrib_regression",database_id=""} 0
postgresql_database_sessions_count{database="contrib_regression",database_id=""} NNN
postgresql_database_sessions_fatal_count{database="contrib_regression",database_id=""} 0
postgresql_database_sessions_killed_count{database="contrib_regression",database_id=""} 0
postgresql_database_stats_reset{database="contrib_regression",database_id=""} NNN
postgresql_database_temp_bytes_total{database="contrib_regression",database_id=""} 0
postgresql_database_temp_files_total{database="contrib_regression",database_id=""} 0
postgresql_database_xact_commited_total{database="contrib_regression",database_id=""} NNN
postgresql_database_xact_rolledback_total{database="contrib_regression",database_id=""} 0
2 changes: 1 addition & 1 deletion sql/start.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ show unix_socket_directories \gset
select current_database() as database \gset
\setenv PGDATABASE :database

\! ./pg-exporter --log.level=warn & echo $! > pid; sleep 0.1
\! ./bin/pg_exporter --log.level=warn & echo $! > pid; sleep 0.1

\! curl -sf localhost:9135/metrics | grep postgresql_up

0 comments on commit 0d0bda8

Please sign in to comment.