tests: Increase reliability of interfaces test (#5879)

On macOS it is possible to have interfaces that have no netmask
set, for example:

| utun1 | 100.xx.xx.xx | | | 100.xx.xx.xx     | unknown |

This causes the interfaces test to fail. This change allows the
mask field to be blank and the test to pass on systems with this
type of interface configured.

The sockaddr for this interface has an ifa_netmask with sa_family
set to zero (AF_UNSPEC) which causes getnameinfo(3) to fail.
ifconfig does return a netmask for this interface but it's not
clear if the value is at all meaningful.
This commit is contained in:
Will Newton 2019-10-26 17:36:45 +01:00 committed by Teddy Reed
parent bf25d02c86
commit a1e4191109

View File

@ -29,7 +29,7 @@ TEST_F(InterfaceAddressesTest, test_sanity) {
auto const row_map = ValidationMap{
{"interface", NonEmptyString},
{"address", verifyIpAddress},
{"mask", verifyIpAddress},
{"mask", verifyEmptyStringOrIpAddress},
{"broadcast", verifyEmptyStringOrIpAddress},
{"point_to_point", verifyEmptyStringOrIpAddress},
{"type",