-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test on Java 21 #1326
Test on Java 21 #1326
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,10 +55,18 @@ class SocketStreamHelperSpecification extends Specification { | |
|
||
// If the Java 11+ extended socket options for keep alive probes are available, check those values. | ||
if (Arrays.stream(ExtendedSocketOptions.getDeclaredFields()).anyMatch{ f -> f.getName().equals('TCP_KEEPCOUNT') }) { | ||
Method getOptionMethod = Socket.getMethod('getOption', SocketOption) | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPCOUNT').get(null)) == 9 | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPIDLE').get(null)) == 120 | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPINTERVAL').get(null)) == 10 | ||
Method getOptionMethod | ||
try { | ||
getOptionMethod = Socket.getMethod('getOption', SocketOption) | ||
} catch (NoSuchMethodException e) { | ||
// ignore, the `Socket.getOption` method was added in Java SE 9 and does not exist in Java SE 8 | ||
getOptionMethod = null | ||
} | ||
Comment on lines
56
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code assumed that if
1 Currently, Oracle mistakenly documents it as added in JDK 11, see https://docs.oracle.com/en/java/javase/21/docs/api/jdk.net/jdk/net/ExtendedSocketOptions.html#TCP_KEEPCOUNT. |
||
if (getOptionMethod != null) { | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPCOUNT').get(null)) == 9 | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPIDLE').get(null)) == 120 | ||
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPINTERVAL').get(null)) == 10 | ||
} | ||
} | ||
|
||
cleanup: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ object TestMongoClientHelper { | |
|
||
val mongoClientURI: String = { | ||
val uri = Properties.propOrElse(MONGODB_URI_SYSTEM_PROPERTY_NAME, DEFAULT_URI) | ||
if (!uri.isBlank) uri else DEFAULT_URI | ||
if (!uri.codePoints().allMatch((cp: Int) => Character.isWhitespace(cp))) uri else DEFAULT_URI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The are two reasons this hasn't been a problem in Evergreen:
|
||
} | ||
val connectionString: ConnectionString = ConnectionString(mongoClientURI) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As part of MongoDBs green sustainability drive we should review how much resources the matrix takes up and if we can keep coverage without duplicating testing. I'll open a ticket.