Remove pre-refactor config test

pull/1186/head
Stephen Shelton 4 years ago
parent 2e75e03434
commit 028e55e997
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -471,31 +471,6 @@ namespace llarp
}
}
bool
Config::LoadFromStr(string_view str)
{
// TODO: DRY
try
{
Configuration conf;
initializeConfig(conf);
ConfigParser parser;
if(!parser.LoadFromStr(str))
{
return false;
}
// TODO: hand parsed data to conf, pull out values
return true;
}
catch(const std::exception& e)
{
LogError("Error trying to init and parse config from string: ", e.what());
return false;
}
}
void
Config::initializeConfig(Configuration& conf)
{

@ -269,10 +269,6 @@ namespace llarp
bool
Load(const char* fname);
// Load a config from the given string
bool
LoadFromStr(string_view str);
std::string
generateBaseClientConfig();

@ -13,7 +13,6 @@ set(CATCH_EXE catchAll)
# Old gtest-based tests; new tests should use Catch2, instead.
list(APPEND GTEST_SRC
config/test_llarp_config_config.cpp
config/test_llarp_config_ini.cpp
crypto/test_llarp_crypto_types.cpp
crypto/test_llarp_crypto.cpp

@ -1,108 +0,0 @@
#include <config/config.hpp>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
using namespace llarp;
using namespace ::testing;
TEST(Config, smoke)
{
Config config;
(void)config;
SUCCEED();
}
TEST(Config, sample_config)
{
std::string text = R"(
[router]
# number of crypto worker threads
threads=4
# path to store signed RC
contact-file=/home/lokinet/1/self.signed
# path to store transport private key
transport-privkey=/home/lokinet/1/transport.private
# path to store identity signing key
ident-privkey=/home/lokinet/1/identity.private
# encryption key for onion routing
encryption-privkey=/home/lokinet/1/encryption.private
# uncomment following line to set router nickname to 'lokinet'
netid=bunny
[logging]
level=info
# uncomment for logging to file
#type=file
#file=/path/to/logfile
# uncomment for syslog logging
#type=syslog
# admin api (disabled by default)
[api]
enabled=false
#authkey=insertpubkey1here
#authkey=insertpubkey2here
#authkey=insertpubkey3here
bind=127.0.0.1:1190
# system settings for privileges and such
[system]
user=lokinet
group=lokinet
pidfile=/home/lokinet/1/lokinet.pid
# dns provider configuration section
[dns]
# resolver
upstream=1.1.1.1
bind=127.0.1.1:53
# network database settings block
[netdb]
# directory for network database skiplist storage
dir=/home/lokinet/1/netdb
# bootstrap settings
[bootstrap]
# add a bootstrap node's signed identity to the list of nodes we want to bootstrap from
# if we don't have any peers we connect to this router
add-node=/home/lokinet/1/bootstrap.signed
# snapps configuration section
[services]# uncomment next line to enable a snapp
#example-snapp=/home/lokinet/1/snapp-example.ini
[bind]
eth0=5501
[network]
ifname=cluster-1
ifaddr=10.101.0.1/16
)";
Config config;
ASSERT_TRUE(config.LoadFromStr(text));
{
using kv = NetworkConfig::NetConfig::value_type;
ASSERT_THAT(config.network.netConfig(),
UnorderedElementsAre(kv("ifname", "cluster-1"),
kv("ifaddr", "10.101.0.1/16")));
}
{
const auto& links = config.links.inboundLinks();
ASSERT_EQ(links.size(), 1);
ASSERT_EQ(links[0].interface, "eth0");
ASSERT_EQ(links[0].addressFamily, AF_INET);
ASSERT_EQ(links[0].port, 5501);
}
ASSERT_THAT(config.bootstrap.routers,
ElementsAre("/home/lokinet/1/bootstrap.signed"));
}
Loading…
Cancel
Save