Skip to content
Permalink
Browse files
be explicit about which JDK (#1672)
* be explicit about which JDK

* update jacoco plugin

* Just close the connection to get rid of lingering cancel requests
  • Loading branch information
davecramer committed Jan 20, 2020
1 parent c574147 commit 39c73a6ab292f3f41db4ac54d3eed3ea0651e2f5
Showing with 37 additions and 4 deletions.
  1. +9 −0 .travis.yml
  2. +5 −0 pgjdbc/pom.xml
  3. +23 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
@@ -123,6 +123,7 @@ matrix:
- COVERAGE=Y
- NO_HSTORE=Y
- PLPGSQL_EXTENSION=Y
- JDK=9
- jdk: oraclejdk8
sudo: required
addons:
@@ -133,6 +134,7 @@ matrix:
- COVERAGE=Y
- NO_HSTORE=Y
- PLPGSQL_EXTENSION=Y
- JDK=8
- jdk: oraclejdk11
sudo: required
addons:
@@ -157,6 +159,7 @@ matrix:
- COVERAGE=Y
- TEST_CLIENTS=Y
- TZ=Pacific/Chatham # flips between +12:45 and +13:45
- JDK=8
- jdk: oraclejdk8
sudo: required
addons:
@@ -177,6 +180,7 @@ matrix:
- PG_VERSION=9.5
- XA=true
- REPLICATION=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.4"
@@ -185,6 +189,7 @@ matrix:
- QUERY_MODE=extendedCacheEverything
- COVERAGE=Y
- TZ=Europe/Moscow # +03:00, no DST
- JDK=8
- jdk: oraclejdk8
sudo: required
addons:
@@ -193,6 +198,7 @@ matrix:
- PG_VERSION=10
- SSLTEST=Y
- COVERAGE=Y
- JDK=8
- jdk: openjdk7
sudo: required
addons:
@@ -227,19 +233,22 @@ matrix:
- QUERY_MODE=simple
- COVERAGE=Y
- TEST_CLIENTS=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.3"
env:
- PG_VERSION=9.3
- QUERY_MODE=extendedForPrepared
- COVERAGE=Y
- JDK=8
- jdk: oraclejdk8
addons:
postgresql: "9.4"
env:
- PG_VERSION=9.4
- NO_WAFFLE_NO_OSGI=Y
- JDK=8
- stage: release
jdk: oraclejdk8
env:
@@ -240,6 +240,11 @@
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -15,6 +15,7 @@
import org.postgresql.core.ServerVersion;
import org.postgresql.jdbc.PgStatement;
import org.postgresql.test.TestUtil;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;

import org.junit.After;
@@ -68,8 +69,8 @@ public void tearDown() throws Exception {
TestUtil.dropTable(con, "escapetest");
TestUtil.dropTable(con, "comparisontest");
TestUtil.dropTable(con, "test_lock");
con.createStatement().execute("DROP FUNCTION IF EXISTS notify_loop()");
con.createStatement().execute("DROP FUNCTION IF EXISTS notify_then_sleep()");
TestUtil.execute("DROP FUNCTION IF EXISTS notify_loop()",con);
TestUtil.execute("DROP FUNCTION IF EXISTS notify_then_sleep()",con);
con.close();
}

@@ -924,7 +925,12 @@ public void testFastCloses() throws SQLException {
public Void call() throws Exception {
int s = rnd.nextInt(10);
if (s > 8) {
Thread.sleep(s - 9);
try {
Thread.sleep(s - 9);
} catch (InterruptedException ex ) {
// don't execute the close here as this thread was cancelled below in shutdownNow
return null;
}
}
st.close();
return null;
@@ -954,7 +960,20 @@ public Void call() throws Exception {
cnt.put(sqlState, val);
}
System.out.println("[testFastCloses] total counts for each sql state: " + cnt);
executor.shutdown();
try {
executor.shutdownNow();
executor.awaitTermination(1000, TimeUnit.MILLISECONDS);
// just close the connection to avoid lingering cancel requests from above
con.close();
con = TestUtil.openDB();
} catch ( PSQLException ex ) {
// draining out any cancel
if ( !ex.getServerErrorMessage().getMessage().startsWith("canceling statement due to user request")) {
throw ex;
}
} catch ( InterruptedException ex ) {

}
}

/**

0 comments on commit 39c73a6

Please sign in to comment.