[check_postgres] failure of make test in

Christoph Berg christoph.berg at credativ.de
Mon Jul 10 15:07:03 UTC 2017


Re: Kevin Brannen 2017-07-07 <CE782658D4A193498ABF0FD938CD77BE26BE872B at EFJDFWMB01.EFJDFW.local>
> As for t/02_dbstats.t, I think this is the test defaulting somewhere it shouldn't. The error about DB "nms" is the telling point because that is my default DB. I think the test program needs to set --dbname or something. Hmm, or maybe it's using the env-var PGDATABASE when it should ignore that? Yep, that's it, I unset PGDATABASE and the test worked. Here the patch for you:
> 
> 
> 
> $ diff -u t/02_dbstats.t t/02_dbstats.t.new
> 
> --- t/02_dbstats.t      2017-07-07 12:04:39.000000000 -0500
> 
> +++ t/02_dbstats.t.new  2017-07-07 14:05:14.000000000 -0500
> 
> @@ -12,6 +12,8 @@
> 
>  use vars qw/$dbh $result $t $host $dbname/;
> 
> +$ENV{PGDATABASE} = undef;  # prevent user's default DB from influencing the test

Hi,

thanks for debugging that, good catch!

I'd rather not change all individual t/* files to include that line,
so instead I put an "env -i" into the suggested testsuite call in
README.md and README.dev.


Re: Kevin Brannen 2017-07-07 <CE782658D4A193498ABF0FD938CD77BE26BE8754 at EFJDFWMB01.EFJDFW.local>
> Christoph,
> 
> My apologies for not including a patch for the other file. I didn't even think about fixing it until after I sent you the other email. Here's what works on my server:
> 
> $ git diff
> diff --git a/t/01_validate_range.t b/t/01_validate_range.t
> index 849a0b3..f387197 100644
> --- a/t/01_validate_range.t
> +++ b/t/01_validate_range.t
> @@ -147,16 +147,16 @@ SIZE: {
>          critical => '42 exobytes'
>      );
>      ($w, $c) = check_postgres::validate_range({ type => 'size' });
> -    is $w, 1.15292150460685e+18, 'Should have warning == 1 exobytes';
> -    is $c, 4.84227031934876e+19, 'Should have critical == 42 exobytes';
> +    is $w, 0+1024**6, 'Should have warning == 1 exobytes';
> +    is $c, 42*1024**6, 'Should have critical == 42 exobytes';

I'm not sure what's happening there - the tests pass just fine on 32
bit Debian/sid for me.

>  INTEGER: {
> 
> For reasons I don't quite understand, I had to do "0+1024**6", without the addition trick then the value goes into scientific notation, which causes the check to fail. With the addition, then it stays as a whole integer. Zettabytes does not need that as it's always too big and so always goes into scientific notation, but I left it there for consistency.

That's an artifact of Perl internally converting ints to/from floats I
guess.

> $ perl t/02_same_schema.t
> 1..76
> sh: warning: setlocale: LC_ALL: cannot change locale (en): No such file or directory

LC_ALL=C should work, see README.dev (the new "env -i make test"
should fix that as well).

> #     "search_path" is not set on all databases:
> #       Exists on:  1
> #       Missing on: 2, 3
> #
> # '
> #     doesn't match '(?^:^POSTGRES_SAME_SCHEMA OK)'
> 
> And so on and so on for 73 more tests. Based on the error, are you assuming that "search_path" won't be set? If so, then you need to unset it or set it to what you need for the session only. I'd offer a patch but I'm not sure what the test program is expecting.

Does that prevail if you "make clean" first? The test databases are
only created once and might not be up to date if something went wrong
in earlier runs.

Christoph


More information about the Check_postgres mailing list