[Pkg-postgresql-public] Bug#881695: powa-archivist: autopkgtests does not seem to fail on all errors

Niels Thykier niels at thykier.net
Tue Nov 14 07:10:35 UTC 2017


Source: powa-archivist
Version: 3.1.1
Severity: minor

Hi,

I spotted two possible mistakes by reviewing the d/tests for
powa-archivist.

 0) debian/tests/control lists "postgresql-contrib-9.6, postgresql-9.6-powa"
    as dependencies but builds a postgresql-10 package.

 1) debian/tests/control states that stderr will not cause the test
    to fail.  IOW, the test MUST give a non-zero exit code for the
    test to fail.

 2) The test "create-extension" runs a command in a shell loop without
    setting "set -e" or doing an "|| exit 1" after each command.
    A second iteration can override the exit code from the previous
    iteration.

In the concrete case, the only case where 2) is an issue is if the
tests is actually run in an environment with multiple supported
postgres versions.  Or (more likely) the test code is cargo-culted
into another project where multiple iterations are more likely.  While
the "cargo-culting" project is certainly responsible in the latter
case, we might as well kill the issue at the root.


Findings
========

d/tests/control:
            vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
"""
Depends: @, postgresql-contrib-9.6, postgresql-9.6-powa
Tests: create-extension
Restrictions: allow-stderr
"""
              ^^^^^^^^^^^^
I.e. stderr messages will not cause a failure.

d/tests/create-extension:
"""
#!/bin/sh

for v in $(pg_buildext supported-versions); do
	pg_virtualenv -v $v -o "shared_preload_libraries=powa,pg_stat_statements" \
		psql <<-EOF
		CREATE EXTENSION pg_stat_statements;
		CREATE EXTENSION btree_gist;
		CREATE EXTENSION powa;
	EOF
done
"""

Note the missing "set -e" or "|| exit" for the pg_virtualenv cmd.  In
the same spirit, I wonder if psql should be run with "-v
ON_ERROR_STOP=1".


Thanks,
~Niels



More information about the Pkg-postgresql-public mailing list