On Thu, 5 Nov 2020 12:46:08 GMT, Conor Cleary <ccle...@openjdk.org> wrote:

> The primary goal of this fix was to refactor 
> NetworkInterface/UniqueMacAddressesTest.java to make use of the 
> jdk.test.lib.NetworkConfiguration class instead of java.net.NetworkInterface. 
> This was due to the original failure being related to the use of the 'awdl' 
> interface on macOS, which should be skipped for functional tests. The 
> NetworkConfiguration class accounts for this when returning the list of 
> present interfaces (originally retrieved using 
> NetworkInterface.getNetworkInterfaces()) as well as for other OS specific 
> properties. The effects of these changes can be seen on L59 and L101-106.
> 
> In addition to these changes, some modifications were made to the test in the 
> interest of keeping it concise and readable but were made bearing in mind the 
> original logging of the test was already up to a good standard (and I sought 
> to keep it that way). To summarize the other changes:
> 
> - When using NetworkConfiguration::interfaces to read in a stream of 
> NetworkInterface objects, the objects are collected into a list of records 
> (see [JEP 395](https://openjdk.java.net/jeps/395)) to avoid multiple calls to 
> NetworkInterface::getHardwareAddress  (which can throw a SocketException) 
> throughout the test.
> - When checking if the MAC addresses are unique, the testMacAddressesEqual() 
> method is not called unless the interface names are different. If 
> testMacAddressesEqual() returns true, the calling method will simply return 
> instead of updating the value of a boolean variable.
> - Majority of logging was moved to the testMacAddressesEqualMethod() so that 
> only logs for comparisons are carried out. There is scope for additional 
> logging of, for example, the list of present interfaces returned by 
> createNetworkInterfaceList() if deemed necessary by review.

This pull request has now been integrated.

Changeset: f5d36e6c
Author:    Conor Cleary <ccle...@openjdk.org>
Committer: Daniel Fuchs <dfu...@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/f5d36e6c
Stats:     83 lines in 1 file changed: 17 ins; 39 del; 27 mod

8246741: NetworkInterface/UniqueMacAddressesTest: mac address uniqueness test 
failed

Reviewed-by: chegar, dfuchs

-------------

PR: https://git.openjdk.java.net/jdk/pull/1076

Reply via email to