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/datagram-transport.t.cpp b/tests/daemon/face/datagram-transport.t.cpp
index 4e88ff2..d86f669 100644
--- a/tests/daemon/face/datagram-transport.t.cpp
+++ b/tests/daemon/face/datagram-transport.t.cpp
@@ -26,8 +26,6 @@
#include "unicast-udp-transport-fixture.hpp"
#include "multicast-udp-transport-fixture.hpp"
-#include "transport-test-common.hpp"
-
#include <boost/mpl/vector.hpp>
namespace nfd::tests {
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index 5c57341..e44c73c 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.cpp
@@ -25,9 +25,9 @@
#include "face/internal-face.hpp"
-#include "transport-test-common.hpp"
#include "tests/key-chain-fixture.hpp"
#include "tests/daemon/global-io-fixture.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
diff --git a/tests/daemon/face/multicast-ethernet-transport.t.cpp b/tests/daemon/face/multicast-ethernet-transport.t.cpp
index bff61c7..2791ca7 100644
--- a/tests/daemon/face/multicast-ethernet-transport.t.cpp
+++ b/tests/daemon/face/multicast-ethernet-transport.t.cpp
@@ -23,12 +23,12 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "ethernet-fixture.hpp"
#include "common/global.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
+
namespace nfd::tests {
using namespace nfd::face;
diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp
index 959ca9c..4c984f4 100644
--- a/tests/daemon/face/multicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
@@ -43,7 +44,7 @@
{
protected:
void
- initialize(ip::address address)
+ initialize(const shared_ptr<const ndn::net::NetworkInterface>& netif, const ip::address& address)
{
ip::address mcastAddr;
if (address.is_v4()) {
@@ -53,19 +54,19 @@
else {
// the group FF0X::114 is reserved for experimentation at all scope levels (RFC 4727)
auto v6Addr = ip::address_v6::from_string("FF01::114");
- v6Addr.scope_id(address.to_v6().scope_id());
+ v6Addr.scope_id(netif->getIndex());
mcastAddr = v6Addr;
}
mcastEp = udp::endpoint(mcastAddr, 7373);
remoteMcastEp = udp::endpoint(mcastAddr, 8383);
MulticastUdpTransport::openRxSocket(remoteSockRx, mcastEp, address);
- MulticastUdpTransport::openTxSocket(remoteSockTx, udp::endpoint(address, 0), nullptr, true);
+ MulticastUdpTransport::openTxSocket(remoteSockTx, udp::endpoint(address, 0), &*netif, true);
udp::socket sockRx(g_io);
udp::socket sockTx(g_io);
MulticastUdpTransport::openRxSocket(sockRx, remoteMcastEp, address);
- MulticastUdpTransport::openTxSocket(sockTx, udp::endpoint(address, txPort), nullptr, true);
+ MulticastUdpTransport::openTxSocket(sockTx, udp::endpoint(address, txPort), &*netif, true);
face = make_unique<Face>(make_unique<DummyLinkService>(),
make_unique<MulticastUdpTransport>(mcastEp, std::move(sockRx), std::move(sockTx),
diff --git a/tests/daemon/face/multicast-udp-transport.t.cpp b/tests/daemon/face/multicast-udp-transport.t.cpp
index efdd4f2..2457e6d 100644
--- a/tests/daemon/face/multicast-udp-transport.t.cpp
+++ b/tests/daemon/face/multicast-udp-transport.t.cpp
@@ -23,8 +23,6 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "multicast-udp-transport-fixture.hpp"
#include <boost/mpl/vector.hpp>
@@ -34,12 +32,7 @@
using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
-
-using MulticastUdpTransportFixtureWithAddress =
- IpTransportFixture<MulticastUdpTransportFixture, AddressFamily::Any,
- AddressScope::Global, MulticastInterface::Yes>;
-
-BOOST_FIXTURE_TEST_SUITE(TestMulticastUdpTransport, MulticastUdpTransportFixtureWithAddress)
+BOOST_AUTO_TEST_SUITE(TestMulticastUdpTransport)
using MulticastUdpTransportFixtures = boost::mpl::vector<
IpTransportFixture<MulticastUdpTransportFixture, AddressFamily::V4, AddressScope::Global, MulticastInterface::Yes>,
@@ -63,7 +56,12 @@
BOOST_CHECK_GT(this->transport->getSendQueueCapacity(), 0);
}
-BOOST_AUTO_TEST_CASE(PersistencyChange)
+using MulticastUdpTransportFixtureWithAddress = IpTransportFixture<MulticastUdpTransportFixture,
+ AddressFamily::Any,
+ AddressScope::LinkLocal,
+ MulticastInterface::Yes>;
+
+BOOST_FIXTURE_TEST_CASE(PersistencyChange, MulticastUdpTransportFixtureWithAddress)
{
TRANSPORT_TEST_INIT();
diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp
index ad5e4cf..451f21c 100644
--- a/tests/daemon/face/null-face.t.cpp
+++ b/tests/daemon/face/null-face.t.cpp
@@ -27,7 +27,7 @@
#include "face/null-transport.hpp"
#include "tests/daemon/global-io-fixture.hpp"
-#include "transport-test-common.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
diff --git a/tests/daemon/face/stream-transport.t.cpp b/tests/daemon/face/stream-transport.t.cpp
index 2acacfb..c827900 100644
--- a/tests/daemon/face/stream-transport.t.cpp
+++ b/tests/daemon/face/stream-transport.t.cpp
@@ -26,8 +26,6 @@
#include "tcp-transport-fixture.hpp"
#include "unix-stream-transport-fixture.hpp"
-#include "transport-test-common.hpp"
-
#include <boost/asio/read.hpp>
#include <boost/mpl/vector.hpp>
diff --git a/tests/daemon/face/tcp-channel.t.cpp b/tests/daemon/face/tcp-channel.t.cpp
index 9f838c4..8937f5b 100644
--- a/tests/daemon/face/tcp-channel.t.cpp
+++ b/tests/daemon/face/tcp-channel.t.cpp
@@ -44,7 +44,7 @@
SKIP_IF_IP_UNAVAILABLE(address);
// do not listen
- auto channel = this->makeChannel(typename IpAddressFromFamily<F::value>::type());
+ auto channel = this->makeChannel(IpAddressTypeFromFamily<F::value>());
channel->connect(tcp::Endpoint(address, 7040), {},
[this] (const shared_ptr<nfd::Face>&) {
BOOST_FAIL("Connect succeeded when it should have failed");
diff --git a/tests/daemon/face/tcp-transport-fixture.hpp b/tests/daemon/face/tcp-transport-fixture.hpp
index 2ea4a2b..1d1d5ac 100644
--- a/tests/daemon/face/tcp-transport-fixture.hpp
+++ b/tests/daemon/face/tcp-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
@@ -64,7 +65,7 @@
}
void
- initialize(ip::address address,
+ initialize(const shared_ptr<const ndn::net::NetworkInterface>&, const ip::address& address,
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
{
tcp::endpoint remoteEp(address, 7070);
diff --git a/tests/daemon/face/tcp-transport.t.cpp b/tests/daemon/face/tcp-transport.t.cpp
index 3d86064..9e52dfd 100644
--- a/tests/daemon/face/tcp-transport.t.cpp
+++ b/tests/daemon/face/tcp-transport.t.cpp
@@ -23,8 +23,6 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "tcp-transport-fixture.hpp"
#include <boost/mpl/vector.hpp>
diff --git a/tests/daemon/face/tcp-udp-channel.t.cpp b/tests/daemon/face/tcp-udp-channel.t.cpp
index 6a29660..cd57b80 100644
--- a/tests/daemon/face/tcp-udp-channel.t.cpp
+++ b/tests/daemon/face/tcp-udp-channel.t.cpp
@@ -40,7 +40,7 @@
{
using Fixture = F;
static constexpr AddressFamily ADDRESS_FAMILY = AF;
- using Address = typename IpAddressFromFamily<AF>::type;
+ using Address = IpAddressTypeFromFamily<AF>;
};
using FixtureAndAddressList = boost::mpl::vector<
diff --git a/tests/daemon/face/test-ip.cpp b/tests/daemon/face/test-ip.cpp
index 593797e..2cf01c9 100644
--- a/tests/daemon/face/test-ip.cpp
+++ b/tests/daemon/face/test-ip.cpp
@@ -84,6 +84,12 @@
boost::asio::ip::address
getTestIp(AddressFamily family, AddressScope scope, MulticastInterface mcast)
{
+ return std::get<boost::asio::ip::address>(getTestInterfaceAndIp(family, scope, mcast));
+}
+
+std::tuple<shared_ptr<const ndn::net::NetworkInterface>, boost::asio::ip::address>
+getTestInterfaceAndIp(AddressFamily family, AddressScope scope, MulticastInterface mcast)
+{
for (const auto& interface : collectNetworkInterfaces()) {
if (!interface->isUp() ||
!matchTristate(mcast, interface->canMulticast())) {
@@ -97,7 +103,7 @@
static_cast<int>(scope) == static_cast<int>(address.getScope())) &&
(scope != AddressScope::Loopback ||
address.getIp().is_loopback())) {
- return address.getIp();
+ return {interface, address.getIp()};
}
}
}
diff --git a/tests/daemon/face/test-ip.hpp b/tests/daemon/face/test-ip.hpp
index c2bb8ca..9fb57ab 100644
--- a/tests/daemon/face/test-ip.hpp
+++ b/tests/daemon/face/test-ip.hpp
@@ -30,6 +30,7 @@
#include <boost/asio/ip/address.hpp>
#include <ndn-cxx/net/network-address.hpp>
+#include <ndn-cxx/net/network-interface.hpp>
namespace nfd::tests {
@@ -61,8 +62,6 @@
std::ostream&
operator<<(std::ostream& os, MulticastInterface mcast);
-/** \brief Derives IP address type from AddressFamily
- */
template<AddressFamily AF>
struct IpAddressFromFamily;
@@ -78,18 +77,36 @@
using type = boost::asio::ip::address_v6;
};
-/** \brief Get an IP address from any available network interface
- * \param family the desired address family
- * \param scope the desired address scope
- * \param mcast specifies if the address can, must, or must not be chosen from a multicast-capable interface
- * \return an IP address, either boost::asio::ip::address_v4 or boost::asio::ip::address_v6
- * \retval unspecified address, if no appropriate address is available
+/**
+ * \brief Derives IP address type from AddressFamily
*/
-boost::asio::ip::address
+template<AddressFamily AF>
+using IpAddressTypeFromFamily = typename IpAddressFromFamily<AF>::type;
+
+/**
+ * \brief Get an IP address from any available network interface, satisfying the given requirements
+ * \param family the desired address family
+ * \param scope the desired address scope
+ * \param mcast specifies if the address can, must, or must not be chosen from a multicast-capable interface
+ * \return an IP address, either boost::asio::ip::address_v4 or boost::asio::ip::address_v6
+ * \retval unspecified address, if no appropriate address is available
+ */
+[[nodiscard]] boost::asio::ip::address
getTestIp(AddressFamily family = AddressFamily::Any,
AddressScope scope = AddressScope::Any,
MulticastInterface mcast = MulticastInterface::Any);
+/**
+ * \brief Get a network interface and an IP address on it that satisfy the given requirements
+ * \param family the desired address family
+ * \param scope the desired address scope
+ * \param mcast specifies if the address can, must, or must not be chosen from a multicast-capable interface
+ */
+[[nodiscard]] std::tuple<shared_ptr<const ndn::net::NetworkInterface>, boost::asio::ip::address>
+getTestInterfaceAndIp(AddressFamily family = AddressFamily::Any,
+ AddressScope scope = AddressScope::Any,
+ MulticastInterface mcast = MulticastInterface::Any);
+
} // namespace nfd::tests
/** \brief Skip the rest of the test case if \p address is unavailable
diff --git a/tests/daemon/face/test-netif.cpp b/tests/daemon/face/test-netif.cpp
index 1a2752b..68b66cd 100644
--- a/tests/daemon/face/test-netif.cpp
+++ b/tests/daemon/face/test-netif.cpp
@@ -28,6 +28,9 @@
namespace nfd::tests {
+using ndn::net::NetworkInterface;
+using ndn::net::NetworkMonitor;
+
std::vector<shared_ptr<const NetworkInterface>>
enumerateNetworkInterfaces(NetworkMonitor& netmon)
{
diff --git a/tests/daemon/face/test-netif.hpp b/tests/daemon/face/test-netif.hpp
index a1e354e..9e32d60 100644
--- a/tests/daemon/face/test-netif.hpp
+++ b/tests/daemon/face/test-netif.hpp
@@ -28,30 +28,25 @@
#include "core/common.hpp"
-#include <ndn-cxx/net/network-address.hpp>
#include <ndn-cxx/net/network-interface.hpp>
#include <ndn-cxx/net/network-monitor.hpp>
namespace nfd::tests {
-using ndn::net::NetworkAddress;
-using ndn::net::NetworkInterface;
-using ndn::net::NetworkMonitor;
-
/** \brief Enumerate network interfaces using the given NetworkMonitor
* \param netmon a NetworkMonitor constructed on the global io_service.
* \note This function is blocking
* \note Signals are supported if caller keeps \p netmon running
*/
-std::vector<shared_ptr<const NetworkInterface>>
-enumerateNetworkInterfaces(NetworkMonitor& netmon);
+std::vector<shared_ptr<const ndn::net::NetworkInterface>>
+enumerateNetworkInterfaces(ndn::net::NetworkMonitor& netmon);
/** \brief Collect information about network interfaces
* \param allowCached if true, previously collected information can be returned
* \note This function is blocking if \p allowCached is false or no previous information exists
* \warning Signals are not triggered on returned NetworkInterfaces because NetworkMonitor is not running
*/
-std::vector<shared_ptr<const NetworkInterface>>
+std::vector<shared_ptr<const ndn::net::NetworkInterface>>
collectNetworkInterfaces(bool allowCached = true);
} // namespace nfd::tests
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
diff --git a/tests/daemon/face/udp-channel.t.cpp b/tests/daemon/face/udp-channel.t.cpp
index d36e2f5..b95ac78 100644
--- a/tests/daemon/face/udp-channel.t.cpp
+++ b/tests/daemon/face/udp-channel.t.cpp
@@ -44,7 +44,7 @@
SKIP_IF_IP_UNAVAILABLE(address);
this->listen(address,1452);
- auto ch1 = this->makeChannel(typename IpAddressFromFamily<F::value>::type(), 0, 1232);
+ auto ch1 = this->makeChannel(IpAddressTypeFromFamily<F::value>(), 0, 1232);
connect(*ch1);
BOOST_CHECK_EQUAL(this->limitedIo.run(2, 1_s), LimitedIo::EXCEED_OPS);
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 5d9613e..41a5dfd 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -34,6 +34,7 @@
using face::UdpChannel;
using face::UdpFactory;
+using ndn::net::NetworkInterface;
class UdpFactoryFixture : public FaceSystemFactoryFixture<UdpFactory>
{
@@ -79,11 +80,11 @@
if (localAddress.is_v4()) {
BOOST_ASSERT(!netifsV4.empty());
- return factory.createMulticastFace(netifsV4.front(), localAddress, mcastEndpoint);
+ return factory.createMulticastFace(*netifsV4.front(), localAddress, mcastEndpoint);
}
else {
BOOST_ASSERT(!netifsV6.empty());
- return factory.createMulticastFace(netifsV6.front(), localAddress, mcastEndpoint);
+ return factory.createMulticastFace(*netifsV6.front(), localAddress, mcastEndpoint);
}
}
@@ -120,7 +121,7 @@
hasAddressFamily(const NetworkInterface& netif, ndn::net::AddressFamily af)
{
return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
- [af] (const NetworkAddress& a) { return a.getFamily() == af; });
+ [af] (const auto& a) { return a.getFamily() == af; });
}
/** \brief determine whether a UDP multicast face is created on \p netif
@@ -130,7 +131,7 @@
{
auto ip = boost::asio::ip::address::from_string(face.getLocalUri().getHost());
return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
- [ip] (const NetworkAddress& a) { return a.getIp() == ip; });
+ [ip] (const auto& a) { return a.getIp() == ip; });
}
protected:
diff --git a/tests/daemon/face/unicast-ethernet-transport.t.cpp b/tests/daemon/face/unicast-ethernet-transport.t.cpp
index 54c262d..6e4dd6b 100644
--- a/tests/daemon/face/unicast-ethernet-transport.t.cpp
+++ b/tests/daemon/face/unicast-ethernet-transport.t.cpp
@@ -23,12 +23,12 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "ethernet-fixture.hpp"
#include "common/global.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
+
namespace nfd::tests {
using namespace nfd::face;
diff --git a/tests/daemon/face/unicast-udp-transport-fixture.hpp b/tests/daemon/face/unicast-udp-transport-fixture.hpp
index e7fb76d..7ec4896 100644
--- a/tests/daemon/face/unicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/unicast-udp-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
@@ -43,7 +44,7 @@
{
protected:
void
- initialize(ip::address address,
+ initialize(const shared_ptr<const ndn::net::NetworkInterface>&, const ip::address& address,
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
{
udp::socket sock(g_io);
@@ -61,7 +62,7 @@
}
void
- remoteConnect(ip::address address = ip::address_v4::loopback())
+ remoteConnect(const ip::address& address = ip::address_v4::loopback())
{
udp::endpoint remoteEp(address, 7070);
remoteSocket.open(remoteEp.protocol());
diff --git a/tests/daemon/face/unicast-udp-transport.t.cpp b/tests/daemon/face/unicast-udp-transport.t.cpp
index bb5605e..e69904a 100644
--- a/tests/daemon/face/unicast-udp-transport.t.cpp
+++ b/tests/daemon/face/unicast-udp-transport.t.cpp
@@ -23,8 +23,6 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "unicast-udp-transport-fixture.hpp"
#include <boost/mpl/vector.hpp>
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index 9603247..d95be2c 100644
--- a/tests/daemon/face/unix-stream-transport-fixture.hpp
+++ b/tests/daemon/face/unix-stream-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
#include <boost/filesystem.hpp>
@@ -87,7 +88,7 @@
{
}
- std::pair<bool, std::string>
+ [[nodiscard]] std::tuple<bool, std::string>
checkPreconditions() const
{
return {true, ""};
diff --git a/tests/daemon/face/unix-stream-transport.t.cpp b/tests/daemon/face/unix-stream-transport.t.cpp
index 41acb0b..692f601 100644
--- a/tests/daemon/face/unix-stream-transport.t.cpp
+++ b/tests/daemon/face/unix-stream-transport.t.cpp
@@ -23,8 +23,6 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "unix-stream-transport-fixture.hpp"
namespace nfd::tests {
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index a396530..15d1a57 100644
--- a/tests/daemon/face/websocket-channel.t.cpp
+++ b/tests/daemon/face/websocket-channel.t.cpp
@@ -41,16 +41,14 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(Uri, F, AddressFamilies)
{
- using Address = typename IpAddressFromFamily<F::value>::type;
- websocket::Endpoint ep(Address::loopback(), 20070);
+ websocket::Endpoint ep(IpAddressTypeFromFamily<F::value>::loopback(), 20070);
auto channel = this->makeChannel(ep.address(), ep.port());
BOOST_CHECK_EQUAL(channel->getUri(), FaceUri(ep, "ws"));
}
BOOST_AUTO_TEST_CASE_TEMPLATE(Listen, F, AddressFamilies)
{
- using Address = typename IpAddressFromFamily<F::value>::type;
- auto channel = this->makeChannel(Address());
+ auto channel = this->makeChannel(IpAddressTypeFromFamily<F::value>());
BOOST_CHECK_EQUAL(channel->isListening(), false);
channel->listen(nullptr);
diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp
index 2e1e61e..eed4923 100644
--- a/tests/daemon/face/websocket-transport-fixture.hpp
+++ b/tests/daemon/face/websocket-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
@@ -86,10 +87,12 @@
client.connect(con);
}
- /** \brief initialize both server and client, and have each other connected, create Transport
+ /**
+ * \brief Initialize both server and client, and have each other connected, create Transport
*/
void
- initialize(ip::address address,
+ initialize(const shared_ptr<const ndn::net::NetworkInterface>&,
+ const ip::address& address,
time::milliseconds pingInterval = 10_s,
time::milliseconds pongTimeout = 1_s)
{
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index e8733b2..23d15f0 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -23,8 +23,6 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "transport-test-common.hpp"
-
#include "websocket-transport-fixture.hpp"
#include <boost/mpl/vector.hpp>
@@ -67,7 +65,7 @@
TRANSPORT_TEST_CHECK_PRECONDITIONS();
auto mappedAddr = ip::address_v6::v4_mapped(this->address.to_v4());
BOOST_REQUIRE(mappedAddr.is_v4_mapped());
- WebSocketTransportFixture::initialize(mappedAddr);
+ WebSocketTransportFixture::initialize(this->interface, mappedAddr);
checkStaticPropertiesInitialized(*this->transport);