pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Test suite fails on non-default configuration
4+ messages / 3 participants
[nested] [flat]

* Test suite fails on non-default configuration
@ 2011-04-18 21:28  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: Kevin Grittner @ 2011-04-18 21:28 UTC (permalink / raw)
  To: pgsql-jdbc

I just built a new jar file from a checkout of CVS HEAD, and (after
fixing up the UNICODE versus UTF8 issue) the unit tests still failed
on me:
 
runtest:
    [junit] Testsuite: org.postgresql.test.jdbc2.Jdbc2TestSuite
    [junit] Tests run: 293, Failures: 1, Errors: 0, Time elapsed:
35.78 sec
    [junit]
    [junit] Testcase:
testTransactionIsolation(org.postgresql.test.jdbc2.ConnectionTest): 
     FAILED
    [junit] expected:<2> but was:<8>
    [junit] junit.framework.AssertionFailedError: expected:<2> but
was:<8>
    [junit]     at
org.postgresql.test.jdbc2.ConnectionTest.testTransactionIsolation(
ConnectionTest.java:210)
    [junit]
    [junit]
    [junit] Test org.postgresql.test.jdbc2.Jdbc2TestSuite FAILED
 
The cause is that the cluster I was running against has a
non-default postgresql.conf file -- default_transaction_isolation is
set to serializable, which runs afoul of this:
 
    public void testTransactionIsolation() throws Exception
    {
        con = TestUtil.openDB();

        // PostgreSQL defaults to READ COMMITTED
        assertEquals(Connection.TRANSACTION_READ_COMMITTED,
                     con.getTransactionIsolation());
 
Should the unit tests really be failing based on configuration
options?
 
-Kevin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Test suite fails on non-default configuration
@ 2011-04-18 23:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2011-04-18 23:12 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: pgsql-jdbc

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>         // PostgreSQL defaults to READ COMMITTED
>         assertEquals(Connection.TRANSACTION_READ_COMMITTED,
>                      con.getTransactionIsolation());
 
> Should the unit tests really be failing based on configuration
> options?

Well, for a comparison point, you can certainly make the server's
regression tests fail too if you whack the configuration around enough.
I agree that the above seems perhaps overly fragile, but I don't think
you can expect to have a general principle that the JDBC tests should
pass regardless of configuration.  It's more a question of how painful
is it to support any particular nondefault configuration choice, and
does it seem worth it based on real-world usage of the choice.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Test suite fails on non-default configuration
@ 2011-04-19 01:29  Kris Jurka <books@ejurka.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Kris Jurka @ 2011-04-19 01:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>; pgsql-jdbc



On Mon, 18 Apr 2011, Tom Lane wrote:

> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>>         // PostgreSQL defaults to READ COMMITTED
>>         assertEquals(Connection.TRANSACTION_READ_COMMITTED,
>>                      con.getTransactionIsolation());
>
>> Should the unit tests really be failing based on configuration
>> options?
>
> Well, for a comparison point, you can certainly make the server's
> regression tests fail too if you whack the configuration around enough.
> I agree that the above seems perhaps overly fragile, but I don't think
> you can expect to have a general principle that the JDBC tests should
> pass regardless of configuration.  It's more a question of how painful
> is it to support any particular nondefault configuration choice, and
> does it seem worth it based on real-world usage of the choice.
>

Exactly.  In this case the tests were assuming too much for no real 
purpose.  I've checked in a fix to work with any default isolation level.

Kris Jurka





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Test suite fails on non-default configuration
@ 2011-04-19 16:02  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  parent: Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Kevin Grittner @ 2011-04-19 16:02 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc

Kris Jurka <books@ejurka.com> wrote:
 
> In this case the tests were assuming too much for no real purpose.
 
Yeah, in that case it didn't seem to be testing much beyond whether
that configuration option had been changed from its default.
 
> I've checked in a fix to work with any default isolation level.
 
Thanks!
 
-Kevin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-04-19 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 21:28 Test suite fails on non-default configuration Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-18 23:12 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-04-19 01:29   ` Kris Jurka <books@ejurka.com>
2011-04-19 16:02     ` Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox