check_postgres icon indicating copy to clipboard operation
check_postgres copied to clipboard

align check_wal_files() code with it's test case

Open moench-tegeder opened this issue 3 years ago • 0 comments

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.

moench-tegeder avatar Sep 29 '21 21:09 moench-tegeder