Add a timestamp to netconf cache, fix some SQL queries in NC.

This commit is contained in:
Adam Ierymenko 2015-04-17 15:21:53 -07:00
parent 417f56de2f
commit 740121504f
5 changed files with 66 additions and 27 deletions

View file

@ -720,13 +720,25 @@ static int testPhy()
static int testSqliteNetworkController()
{
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
OSUtils::rm("./selftest_network_controller.db");
try {
std::cout << "[network-controller] Generating signing identity..." << std::endl;
Identity signingId;
signingId.generate();
std::cout << "[network-controller] Creating database..." << std::endl;
SqliteNetworkController controller(signingId,"network-controller-test.db");
{
std::cout << "[network-controller] Creating database..." << std::endl;
SqliteNetworkController controller("./selftest_network_controller.db");
std::cout << "[network-controller] Closing database..." << std::endl;
}
{
std::cout << "[network-controller] Re-opening database..." << std::endl;
SqliteNetworkController controller("./selftest_network_controller.db");
std::cout << "[network-controller] Closing database..." << std::endl;
}
} catch (std::runtime_error &exc) {
std::cout << "FAIL! (unexpected exception: " << exc.what() << ")" << std::endl;
return -1;
@ -734,6 +746,9 @@ static int testSqliteNetworkController()
std::cout << "FAIL! (unexpected exception: ...)" << std::endl;
return -1;
}
OSUtils::rm("./selftest_network_controller.db");
#endif // ZT_ENABLE_NETWORK_CONTROLLER
return 0;
}
@ -818,8 +833,8 @@ int main(int argc,char **argv)
srand((unsigned int)time(0));
r |= testPhy();
r |= testHttp();
//r |= testPhy();
//r |= testHttp();
r |= testSqliteNetworkController();
r |= testCrypto();
r |= testPacket();