Skip to content

Commit

Permalink
test: cleanup @timeout to seconds since OpenRewrite converted it from…
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Jan 4, 2024
1 parent cad9f3c commit 5322892
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void tearDown() throws Exception {
}

@Test
@Timeout(1000)
@Timeout(1)
void notAvailableStartNotExistReplicationSlot() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -112,7 +112,7 @@ state, equalTo(PSQLState.UNDEFINED_OBJECT.getState())
}

@Test
@Timeout(1000)
@Timeout(1)
void receiveChangesOccursBeforeStartReplication() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -150,7 +150,7 @@ result, equalTo(wait)
}

@Test
@Timeout(1000)
@Timeout(1)
void receiveChangesAfterStartReplication() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -201,7 +201,7 @@ groupedResult, equalTo(wait)
}

@Test
@Timeout(1000)
@Timeout(1)
void startFromCurrentServerLSNWithoutSpecifyLSNExplicitly() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -233,7 +233,7 @@ void startFromCurrentServerLSNWithoutSpecifyLSNExplicitly() throws Exception {
}

@Test
@Timeout(1000)
@Timeout(1)
void afterStartStreamingDBSlotStatusActive() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -264,7 +264,7 @@ isActive, equalTo(true)
* wait new changes and until waiting messages from client ignores.</p>
*/
@Test
@Timeout(1000)
@Timeout(1)
@HaveMinimalServerVersion("11.1")
void afterCloseReplicationStreamDBSlotStatusNotActive() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;
Expand Down Expand Up @@ -292,7 +292,7 @@ isActive, equalTo(false)
}

@Test
@Timeout(1000)
@Timeout(1)
void afterCloseConnectionDBSLotStatusNotActive() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -337,7 +337,7 @@ isActive, equalTo(false)
* wait new changes and until waiting messages from client ignores.</p>
*/
@Test
@Timeout(10000)
@Timeout(10)
@HaveMinimalServerVersion("12.1")
void duringSendBigTransactionConnectionCloseSlotStatusNotActive() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;
Expand Down Expand Up @@ -392,7 +392,7 @@ isActive, equalTo(false)
* wait new changes and until waiting messages from client ignores.</p>
*/
@Test
@Timeout(60000)
@Timeout(60)
@HaveMinimalServerVersion("11.1")
void duringSendBigTransactionReplicationStreamCloseNotActive() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;
Expand Down Expand Up @@ -429,7 +429,7 @@ isActive, equalTo(false)

//todo fix, fail because backend for logical decoding not reply with CommandComplate & ReadyForQuery
@Test
@Timeout(5000)
@Timeout(5)
void repeatWalPositionTwice() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -489,7 +489,7 @@ groupedResult, equalTo(wait)
}

@Test
@Timeout(3000)
@Timeout(3)
void doesNotHavePendingMessageWhenStartFromLastLSN() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand All @@ -512,7 +512,7 @@ result, equalTo(null)
}

@Test
@Timeout(3000)
@Timeout(3)
void readPreviousChangesWithoutBlock() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -549,7 +549,7 @@ received, equalTo(wait)
}

@Test
@Timeout(3000)
@Timeout(3)
void readActualChangesWithoutBlock() throws Exception {
PGConnection pgConnection = (PGConnection) replConnection;

Expand Down Expand Up @@ -584,7 +584,7 @@ received, equalTo(wait)
}

@Test
@Timeout(10000)
@Timeout(10)
void avoidTimeoutDisconnectWithDefaultStatusInterval() throws Exception {
final int statusInterval = getKeepAliveTimeout();

Expand Down
18 changes: 9 additions & 9 deletions pgjdbc/src/test/java/org/postgresql/test/jdbc2/NotifyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void tearDown() throws SQLException {
}

@Test
@Timeout(60000)
@Timeout(60)
void testNotify() throws SQLException {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand All @@ -55,7 +55,7 @@ void testNotify() throws SQLException {
}

@Test
@Timeout(60000)
@Timeout(60)
void notifyArgument() throws Exception {
if (!TestUtil.haveMinimumServerVersion(conn, ServerVersion.v9_0)) {
return;
Expand All @@ -75,7 +75,7 @@ void notifyArgument() throws Exception {
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotify() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand Down Expand Up @@ -109,7 +109,7 @@ void asyncNotify() throws Exception {
* listener is blocking.
*/
@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithTimeout() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand All @@ -126,7 +126,7 @@ void asyncNotifyWithTimeout() throws Exception {
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithTimeoutAndMessagesAvailableWhenStartingListening() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand All @@ -145,7 +145,7 @@ void asyncNotifyWithTimeoutAndMessagesAvailableWhenStartingListening() throws Ex
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithEndlessTimeoutAndMessagesAvailableWhenStartingListening() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand All @@ -163,7 +163,7 @@ void asyncNotifyWithEndlessTimeoutAndMessagesAvailableWhenStartingListening() th
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithTimeoutAndMessagesSendAfter() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand Down Expand Up @@ -191,7 +191,7 @@ public void run() {
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithEndlessTimeoutAndMessagesSendAfter() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand Down Expand Up @@ -219,7 +219,7 @@ public void run() {
}

@Test
@Timeout(60000)
@Timeout(60)
void asyncNotifyWithTimeoutAndSocketThatBecomesClosed() throws Exception {
Statement stmt = conn.createStatement();
stmt.executeUpdate("LISTEN mynotification");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ void multipleCancels() throws Exception {
}

@Test
@Timeout(30000)
@Timeout(30)
void cancelQueryWithBrokenNetwork() throws SQLException, IOException, InterruptedException {
// check that stmt.cancel() doesn't hang forever if the network is broken

Expand Down Expand Up @@ -892,7 +892,7 @@ void cancelQueryWithBrokenNetwork() throws SQLException, IOException, Interrupte
}

@Test
@Timeout(10000)
@Timeout(10)
void closeInProgressStatement() throws Exception {
ExecutorService executor = Executors.newSingleThreadExecutor();
final Connection outerLockCon = TestUtil.openDB();
Expand Down Expand Up @@ -951,7 +951,7 @@ public Void call() throws Exception {
}

@Test
@Timeout(10000)
@Timeout(10)
void concurrentIsValid() throws Throwable {
ExecutorService executor = Executors.newCachedThreadPool();
try {
Expand Down Expand Up @@ -997,7 +997,7 @@ void concurrentIsValid() throws Throwable {
}

@Test
@Timeout(20000)
@Timeout(20)
void fastCloses() throws SQLException {
ExecutorService executor = Executors.newSingleThreadExecutor();
con.createStatement().execute("SET SESSION client_min_messages = 'NOTICE'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Iterable<Object[]> data() {

@MethodSource("data")
@ParameterizedTest(name = "networkTimeoutMillis={0}, validationTimeoutSeconds={1}, expectedMaxValidationTimeMillis={2}")
@Timeout(value = 30)
@Timeout(30)
void isValidRespectsSmallerTimeout(int networkTimeoutMillis, int validationTimeoutSeconds, int expectedMaxValidationTimeMillis) throws Exception {
try (StrangeProxyServer proxyServer = new StrangeProxyServer(TestUtil.getServer(), TestUtil.getPort())) {
final Properties props = new Properties();
Expand Down

0 comments on commit 5322892

Please sign in to comment.