Skip to content

Commit e1c84cd

Browse files
Fix TestInetEndPoint to pass even when computer is offline
Description: - TestInetEndPoint was not hermetic, it required at least one network interface connected to a link and up. - There was a comment before to skip tests if the link was not up, but it was not actually skipping the test. This made it fail for me when working offline and trying to run unit tests. Testing done: - Test passes with and without link up.
1 parent d815fde commit e1c84cd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/inet/tests/TestInetEndPoint.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,13 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal)
277277

278278
err = InterfaceId::Null().GetLinkLocalAddr(&addr);
279279

280-
// We should skip the following checks if the interface does not have the Link local address
281-
ASSERT_NE(err, INET_ERROR_ADDRESS_NOT_FOUND);
280+
// We should skip the following checks if the interface does not have the Link local address.
281+
// This can happen if you don't have network interfaces connected to any link (like happened
282+
// to the author of this comment at YYZ before CSA 2025 Chicago Member Meeting).
283+
if (err == INET_ERROR_ADDRESS_NOT_FOUND)
284+
{
285+
return;
286+
}
282287

283288
EXPECT_EQ(err, CHIP_NO_ERROR);
284289
intId = InterfaceId::FromIPAddress(addr);

0 commit comments

Comments
 (0)