On Fri, Dec 6, 2013 at 12:02 PM, Peter Eisentraut <pete...@gmx.net> wrote:
> On Thu, 2013-12-05 at 17:12 +0900, Michael Paquier wrote:
>> IMHO, the regression test suite would gain in consistency and
>> portability if we do not refer to data that is database-dependent.
>
> I once did some similar fixes (e3d9dceef62e072cf9a433ae6c74a1c5a10d94d3)
> but then didn't pursue it any longer, because it would restrict what we
> could actually test.  I don't remember what I was trying to do there,
> but why do you need to run the tests in a different database?
I don't know, but by looking at this test code I could guess that
using a custom database name (that also changed depending on the
environment used) made errors easier to track. So, I just went ahead,
cleaned up our code to use "regression" and made things a bit smarter
for the environment information.

For the documentation patch, I propose the attached to avoid future
confusions. Comments? It might make sense to back-patch as well.

Also... An advice for the archives and other people here: never update
test output dynamically and use the existing ones. I wouldn't even
recommend adding new outputs to the existing tests except if you want
to make your maintenance a pain as you would need to track new tests
and update accordingly. Even better, submit patches if new outputs
make sense, or write new tests and break things independently as much
as you want.
-- 
Michael
commit 0e40cb47189062433b99c1e33e75a096c7c97dd8
Author: Michael Paquier <mich...@otacoo.com>
Date:   Fri Dec 6 13:13:23 2013 +0900

    Addition of in-core test suite restrictions in documentation
    
    Mention in the documentation of regression tests limitations related to
    the database where tests are run as well as possible inconsistencies
    for server parameters.

diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 2b95587..719210b 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -257,6 +257,24 @@ gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
     platforms, and only when run in a database that uses UTF-8 encoding.
    </para>
   </sect2>
+
+  <sect2>
+   <title>Restrictions</title>
+
+   <para>
+    Regression tests should be run on a database named <literal>regression</>
+    to prevent failures of tests using directly or indirectly the current
+    database name in output results. <literal>regression</> is the default
+    database name for tests on core, and contrib modules use
+    <literal>contrib_regression</> as default.
+   </para>
+
+   <para>
+    Parameters able to change the output of queries like enable/disable flags
+    described in <xref linkend="runtime-config-query-enable"> for
+    <command>EXPLAIN</> should use default values as well.
+   </para>
+  </sect2>
   </sect1>
 
   <sect1 id="regress-evaluation">
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to