lokinet/test/exit/test_llarp_exit_context.cpp
Thomas Winget d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
2019-07-02 11:02:20 -04:00

32 lines
865 B
C++

#include <exit/context.hpp>
#include <router/router.hpp>
#include <gtest/gtest.h>
struct ExitTest : public ::testing::Test
{
ExitTest() : r(nullptr, nullptr, nullptr)
{
}
llarp::Router r;
};
TEST_F(ExitTest, AddMultipleIP)
{
llarp::PubKey pk;
pk.Randomize();
llarp::PathID_t firstPath, secondPath;
firstPath.Randomize();
secondPath.Randomize();
llarp::exit::Context::Config_t conf;
conf.emplace("exit", "true");
conf.emplace("type", "null");
conf.emplace("ifaddr", "10.0.0.1/24");
ASSERT_TRUE(r.exitContext().AddExitEndpoint("test-exit", conf));
ASSERT_TRUE(r.exitContext().ObtainNewExit(pk, firstPath, true));
ASSERT_TRUE(r.exitContext().ObtainNewExit(pk, secondPath, true));
ASSERT_TRUE(r.exitContext().FindEndpointForPath(firstPath)->LocalIP()
== r.exitContext().FindEndpointForPath(secondPath)->LocalIP());
}