Skip to content

Commit ee010ad

Browse files
committed
Fix for tests failing on Windows and other sporadic failures.
Change-Id: Ide11dea40c83cbafabbe276b1f102bcb624327d9
1 parent 32892f1 commit ee010ad

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/test/java/testsuite/regression/MetaDataRegressionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5325,6 +5325,9 @@ public void testBug95280() throws Exception {
53255325
@Test
53265326
public void testBug104641() throws Exception {
53275327
String databaseName1 = "dbBug104641";
5328+
if (isServerRunningOnWindows()) {
5329+
databaseName1 = databaseName1.toLowerCase();
5330+
}
53285331
createDatabase(databaseName1);
53295332
createTable(databaseName1 + ".table1",
53305333
"(`CREATED` datetime DEFAULT NULL,`ID` bigint NOT NULL AUTO_INCREMENT,`LRN_ID` bigint DEFAULT '0',`USERNAME` varchar(50) NOT NULL,"

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11448,7 +11448,7 @@ public void testBug20391550() throws Exception {
1144811448
st.setQueryTimeout(2);
1144911449

1145011450
PreparedStatement ps = con.prepareStatement("update testBug20391550 set c2=? where c1=?");
11451-
assertThrows(SQLException.class, "Statement cancelled due to timeout or client request", () -> st.executeQuery("select sleep(3)"));
11451+
assertThrows(SQLException.class, "Statement cancelled due to timeout or client request", () -> st.executeQuery("select sleep(8)"));
1145211452

1145311453
assertThrows(SQLException.class, "No operations allowed after statement closed.", () -> {
1145411454
ps.setInt(2, 100);
@@ -11576,16 +11576,14 @@ public void testBug103878() throws Exception {
1157611576
PreparedStatement ps = con.prepareStatement("SHOW CREATE TABLE testBug103878");
1157711577
this.rs = ps.executeQuery();
1157811578
assertTrue(this.rs.next());
11579-
assertTrue(this.rs.getString(2).startsWith("CREATE TABLE"));
11580-
System.out.println(this.rs.getString(2));
11579+
assertTrue(StringUtils.startsWithIgnoreCase(this.rs.getString(2), "CREATE TABLE"));
1158111580
ps.close();
1158211581

1158311582
ps = con.prepareStatement("SHOW CREATE VIEW testBug103878_view");
1158411583
this.rs = ps.executeQuery();
1158511584
assertTrue(this.rs.next());
11586-
assertTrue(this.rs.getString(2).startsWith("CREATE"));
11587-
assertTrue(this.rs.getString(2).contains("testBug103878_view"));
11588-
System.out.println(this.rs.getString(2));
11585+
assertTrue(StringUtils.startsWithIgnoreCase(this.rs.getString(2), "CREATE"));
11586+
assertTrue(StringUtils.indexOfIgnoreCase(this.rs.getString(2), "testBug103878_view") >= 0);
1158911587
ps.close();
1159011588

1159111589
ps = con.prepareStatement("SHOW PROCESSLIST");
@@ -11599,8 +11597,7 @@ public void testBug103878() throws Exception {
1159911597
ps = con.prepareStatement("SHOW CREATE USER testBug103878User");
1160011598
this.rs = ps.executeQuery();
1160111599
assertTrue(this.rs.next());
11602-
assertTrue(this.rs.getString(1).startsWith("CREATE USER"));
11603-
System.out.println(this.rs.getString(1));
11600+
assertTrue(StringUtils.startsWithIgnoreCase(this.rs.getString(1), "CREATE USER"));
1160411601
ps.close();
1160511602
}
1160611603
} finally {

src/test/java/testsuite/regression/StringRegressionTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2002, 2022, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify it under
55
* the terms of the GNU General Public License, version 2.0, as published by the
@@ -35,6 +35,7 @@
3535
import java.io.ByteArrayOutputStream;
3636
import java.io.IOException;
3737
import java.io.PrintStream;
38+
import java.nio.charset.Charset;
3839
import java.sql.Clob;
3940
import java.sql.Connection;
4041
import java.util.Properties;
@@ -194,8 +195,10 @@ public void printCallStackTrace() {
194195
*/
195196
@Test
196197
public void testBug11614() throws Exception {
198+
System.out.println(Charset.defaultCharset());
199+
197200
createTable("testBug11614",
198-
"(`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `text` TEXT NOT NULL," + "PRIMARY KEY(`id`)) CHARACTER SET utf8 COLLATE utf8_general_ci");
201+
"(`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `text` TEXT NOT NULL, PRIMARY KEY(`id`)) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci");
199202

200203
Properties props = new Properties();
201204
props.setProperty(PropertyKey.sslMode.getKeyName(), SslMode.DISABLED.name());
@@ -207,7 +210,7 @@ public void testBug11614() throws Exception {
207210
try {
208211
utf8Conn = getConnectionWithProps(props);
209212

210-
utf8Conn.createStatement().executeUpdate("INSERT INTO testBug11614 (`id`,`text`) values (1,'')");
213+
utf8Conn.createStatement().executeUpdate("INSERT INTO testBug11614 (`id`,`text`) values (1,'')");
211214
this.rs = utf8Conn.createStatement().executeQuery("SELECT `text` FROM testBug11614 WHERE id=1");
212215
assertTrue(this.rs.next());
213216

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2015, 2022, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify it under
55
* the terms of the GNU General Public License, version 2.0, as published by the
@@ -1068,13 +1068,14 @@ private <EX extends Throwable> void testPooledSessions_assertFailureTimeout(Clie
10681068

10691069
@Test
10701070
public void testBug28616573() throws Exception {
1071-
RowResult res = this.session.sql(
1072-
"select @@global.mysqlx_max_connections, VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME='Mysqlx_worker_threads_active'")
1073-
.execute();
1071+
this.session.sql("FLUSH STATUS").execute();
1072+
RowResult res = this.session.sql("SELECT @@global.mysqlx_max_connections, VARIABLE_VALUE FROM performance_schema.global_status "
1073+
+ "WHERE VARIABLE_NAME='Mysqlx_worker_threads_active'").execute();
10741074
Row r = res.next();
10751075
int mysqlxMaxConnections = r.getInt(0);
10761076
int mysqlWorkerThreadsActive = Integer.parseInt(r.getString(1));
10771077
this.session.sql("SET @@global.mysqlx_max_connections=" + (mysqlWorkerThreadsActive + 2)).execute(); // allow only 2 additional connections
1078+
this.session.sql("FLUSH STATUS").execute();
10781079

10791080
Properties props = new Properties();
10801081
props.setProperty(ClientProperty.POOLING_ENABLED.getKeyName(), "true");

0 commit comments

Comments
 (0)