Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align check_wal_files() code with it's test case #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

moench-tegeder
Copy link
Contributor

Test 02_wal_files.t may fail against a newly created (by the framework
in CP_Testing.pm) database (PostgreSQL 13) with

: Failed test 'Action 'wal_files' works as expected for warnings'
: at t/02_wal_files.t line 44.
: 'POSTGRES_WAL_FILES OK: DB "postgres" (host:/tmp/cptesting_socket) WAL files found: 1 | time=0.01s files=1;1
: '
: doesn't match '(?^:^POSTGRES_WAL_FILES WARNING)'

as there is exactly one WAL file and the test expects the check to raise
warning/critical alerts at one WAL file - just as the documentation of
the alert levels says "the threshold at wich a warning/critical alert is
fired", but the code in check_wal_files() checks if the number of files
is greater than the alerting threshold. Admitted that this is a corner
case, but it is annoying af when running the tests.
Fix by converting the greater '>' into 'greater-or-equal' '>=' checks.

Test 02_wal_files.t may fail against a newly created (by the framework
in CP_Testing.pm) database (PostgreSQL 13) with

:   Failed test 'Action 'wal_files' works as expected for warnings'
:   at t/02_wal_files.t line 44.
:                   'POSTGRES_WAL_FILES OK: DB "postgres" (host:/tmp/cptesting_socket) WAL files found: 1 | time=0.01s files=1;1
: '
:     doesn't match '(?^:^POSTGRES_WAL_FILES WARNING)'

as there is exactly one WAL file and the test expects the check to raise
warning/critical alerts at one WAL file - just as the documentation of
the alert levels says "the threshold at wich a warning/critical alert is
fired", but the code in check_wal_files() checks if the number of files
is _greater_ than the alerting threshold. Admitted that this is a corner
case, but it is annoying af when running the tests.
Fix by converting the greater '>' into 'greater-or-equal' '>=' checks.
Copy link

@rud rud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always neat to fix corner cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants