Skip to content

Commit 36c448a

Browse files
committed
Fix for tests failing after changes in MySQL 9.3.0.
Change-Id: Ib6bbf3f617e0f91c671916ed185ef2db379e4eeb
1 parent 7ed2d27 commit 36c448a

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/test/java/testsuite/regression/StatementRegressionTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12107,10 +12107,11 @@ public void testBug96900() throws Exception {
1210712107
Supplier<Integer> sessionCount = () -> {
1210812108
try {
1210912109
this.stmt.execute("FLUSH STATUS");
12110+
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
1211012111
this.rs = this.stmt.executeQuery("SHOW GLOBAL STATUS LIKE 'threads_connected'");
1211112112
this.rs.next();
1211212113
return this.rs.getInt(2);
12113-
} catch (SQLException e) {
12114+
} catch (Exception e) {
1211412115
throw new RuntimeException(e.getMessage(), e);
1211512116
}
1211612117
};
@@ -12126,7 +12127,7 @@ public void testBug96900() throws Exception {
1212612127

1212712128
new Thread(() -> {
1212812129
try {
12129-
testStmt.executeQuery("SELECT SLEEP(600)");
12130+
testStmt.executeQuery("SELECT SLEEP(60)");
1213012131
} catch (Throwable e) {
1213112132
e.printStackTrace();
1213212133
}
@@ -12137,11 +12138,9 @@ public void testBug96900() throws Exception {
1213712138
assertEquals(1, sessionCount.get() - initialSessionCount);
1213812139

1213912140
testStmt.cancel();
12140-
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
1214112141
assertEquals(1, sessionCount.get() - initialSessionCount);
1214212142

1214312143
testConn.close();
12144-
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
1214512144
assertEquals(0, sessionCount.get() - initialSessionCount);
1214612145
}
1214712146

@@ -12157,10 +12156,11 @@ public void testBug99260() throws Exception {
1215712156
Supplier<Integer> sessionCount = () -> {
1215812157
try {
1215912158
this.stmt.execute("FLUSH STATUS");
12159+
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
1216012160
this.rs = this.stmt.executeQuery("SHOW GLOBAL STATUS LIKE 'threads_connected'");
1216112161
this.rs.next();
1216212162
return this.rs.getInt(2);
12163-
} catch (SQLException e) {
12163+
} catch (Exception e) {
1216412164
throw new RuntimeException(e.getMessage(), e);
1216512165
}
1216612166
};
@@ -12170,20 +12170,17 @@ public void testBug99260() throws Exception {
1217012170
props.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
1217112171

1217212172
Connection testConn = getConnectionWithProps(props);
12173-
12174-
int initialSessionCount = sessionCount.get();
12175-
1217612173
Statement testStmt = testConn.createStatement();
1217712174
testStmt.setQueryTimeout(1);
12175+
int initialSessionCount = sessionCount.get();
1217812176
for (int i = 0; i < 5; i++) {
1217912177
assertThrows(MySQLTimeoutException.class, "Statement cancelled due to timeout or client request", () -> {
1218012178
testStmt.executeQuery("SELECT SLEEP(30)");
1218112179
return null;
1218212180
});
1218312181
// The difference between the `initialSessionCount` and the current session count would be greater than one if connections external to this test are
1218412182
// created in between. Chances for this to happen in a controlled or development environment are very low and can be neglected.
12185-
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
12186-
assertEquals(0, sessionCount.get() - initialSessionCount);
12183+
assertTrue(sessionCount.get() - initialSessionCount < 1);
1218712184
}
1218812185

1218912186
testConn.close();

src/test/java/testsuite/x/devapi/CollectionFindTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3044,7 +3044,8 @@ public void testCollectionFindBasic() throws Exception {
30443044
doc = docs.next();
30453045
assertEquals((long) (i + 1), (long) ((JsonNumber) doc.get("f3")).getInteger());
30463046
assertEquals(((JsonNumber) doc.get("f3")).getInteger(), ((JsonNumber) doc.get("tmp1")).getInteger());
3047-
assertEquals(new BigDecimal("0.500000000"), ((JsonNumber) doc.get("tmp2")).getBigDecimal());
3047+
assertEquals(new BigDecimal(mysqlVersionMeetsMinimum(ServerVersion.parseVersion("9.3.0")) ? "0.5000" : "0.500000000"),
3048+
((JsonNumber) doc.get("tmp2")).getBigDecimal());
30483049

30493050
i++;
30503051
}

0 commit comments

Comments
 (0)