tests: fix UDP multicast transport tests with IPv6
A valid scope id is always required on the multicast address
Change-Id: Ic676fcde0ee50daf75eb38c137e3cb917f43699f
diff --git a/tests/daemon/face/transport-test-common.hpp b/tests/daemon/face/transport-test-common.hpp
index 34133a1..c257a04 100644
--- a/tests/daemon/face/transport-test-common.hpp
+++ b/tests/daemon/face/transport-test-common.hpp
@@ -61,29 +61,35 @@
protected:
IpTransportFixture()
{
+ std::tie(interface, address) = getTestInterfaceAndIp(AF, AS, MC);
+
BOOST_TEST_MESSAGE("Testing with AddressFamily=" << AF <<
" AddressScope=" << AS <<
" MulticastInterface=" << MC <<
- " TestIp=" << address);
+ " TestInterface=" << (interface == nullptr ? "N/A" : interface->getName()) <<
+ " TestIp=" << (address.is_unspecified() ? "N/A" : address.to_string()));
}
- [[nodiscard]] std::pair<bool, std::string>
+ [[nodiscard]] std::tuple<bool, std::string>
checkPreconditions() const
{
- return {!address.is_unspecified(), "no appropriate IP address available"};
+ return {interface != nullptr && !address.is_unspecified(),
+ "no appropriate interface or IP address available"};
}
template<typename... Args>
void
initialize(Args&&... args)
{
- TransportFixtureBase::initialize(address, std::forward<Args>(args)...);
+ TransportFixtureBase::initialize(interface, address, std::forward<Args>(args)...);
}
protected:
static constexpr AddressFamily addressFamily = AF;
static constexpr AddressScope addressScope = AS;
- const boost::asio::ip::address address = getTestIp(AF, AS, MC);
+
+ shared_ptr<const ndn::net::NetworkInterface> interface;
+ boost::asio::ip::address address;
};
} // namespace nfd::tests