RFR: 8304286: java/net/SocketOption/OptionsTest.java failing after JDK-8302659
Daniel Jeliński
djelinski at openjdk.org
Thu Mar 16 19:01:11 UTC 2023
On Thu, 16 Mar 2023 18:27:29 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Please review this change that fixes and reenables OptionsTest on Windows.
>>
>> The test is checking that the values retrieved from getOption match the values set by an earlier call to setOption. The `IP_MULTICAST_IF` option was tested with the first network interface for which `supportsMulticast` returned true. JDK-8302659 changed the network interface iteration order and the test started failing.
>>
>> The proposed change is to verify if the interface is actually usable for multicasting before using it in set/get test. Test passed on all platforms.
>
> test/jdk/java/net/SocketOption/OptionsTest.java line 115:
>
>> 113: } catch (SocketException ex) {
>> 114: // continue
>> 115: }
>
> isn't that going to hide bugs that the test would have detected?
I don't think so; if all interfaces are skipped, the test will fail - setting a null interface is not permitted.
Other multicast-related tests do similar things:
- `java/net/MulticastSocket/TestInterfaces.java` [skips interfaces that throw an exception](https://github.com/openjdk/jdk/blob/master/test/jdk/java/net/MulticastSocket/TestInterfaces.java#L103)
- `NetworkConfiguration.multicastInterfaces` [skips interfaces that don't have a network address](https://github.com/openjdk/jdk/blob/master/test/lib/jdk/test/lib/NetworkConfiguration.java#L198); we can't do that here because we're testing with a security manager and can't retrieve addresses.
-------------
PR: https://git.openjdk.org/jdk/pull/13061
More information about the net-dev
mailing list