[pgjdbc/pgjdbc] ad7345: Clean up some tests and fix IsValidTest race condi...

From: Sehrope Sarkuni <noreply(at)github(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: [pgjdbc/pgjdbc] ad7345: Clean up some tests and fix IsValidTest race condi...
Date: 2019-10-24 14:45:50
Message-ID: pgjdbc/pgjdbc/push/refs/heads/master/0fd453-ad7345@github.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: ad734574726eb0decf5178071c87a1b513e484f2
https://github.com/pgjdbc/pgjdbc/commit/ad734574726eb0decf5178071c87a1b513e484f2
Author: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Date: 2019-10-24 (Thu, 24 Oct 2019)

Changed paths:
M pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java

Log Message:
-----------
Clean up some tests and fix IsValidTest race condition (#1581)

* test: Add some helpers to TestUtil

Adds some helpers to TestUtil to deal with boiler plate of executinga query
and disgarding the results, fetching the backend process id, terminating a
backend process, and fetching the current transaction state.

* test: Clean up IsValidTest

Cleans up IsValidTest and removes a race condition when checking whether
terminated connections are marked as invalid. Also splits out the transaction
state test into three separate ones to better identify what's being tested.

* test: Change CopyTest to use TestUtil backend pid helpers

This also changes the connection termination to use a non-privileged
connection.

* test: Change ConnectionPoolTest to use backend pid TestUtil helpers

This also changes the pg_terminate_backend(...) call to use a non-privileged connection
as a regular user can terminate their own connection.

* fix: Use super user to terminate backend processes in tests

Older versions of the server (<=9.1) restrict calling pg_terminate_backend(...)
to super users so always use that in test helper.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2019-10-28 11:47:44 [pgjdbc/pgjdbc] 7c5912: Add simple test to make sure we can load a key (#1...
Previous Message Torsten Brodbeck 2019-10-24 13:45:20 [pgjdbc/pgjdbc] 0fd453: fix camel case writing of 'cleanupSavepoints' (#1587)