diff options
author | Tomek Mrugalski <tomek@isc.org> | 2021-07-23 17:04:59 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2021-07-26 09:10:32 +0200 |
commit | b50f4d50256ade2fe64de2d3b0410ac420475707 (patch) | |
tree | 34dea2143b67cb297d1bcc4ea32b4ca2bc8261ab /src/bin/netconf | |
parent | [#1987] fix Makefile error about check-hashes.sh (diff) | |
download | kea-b50f4d50256ade2fe64de2d3b0410ac420475707.tar.xz kea-b50f4d50256ade2fe64de2d3b0410ac420475707.zip |
[#1077] Log UT failures in YANG and NETCONF
- Reimplemented !1328 (was easier to do it from scratch than
solve a massive conflict.
Diffstat (limited to 'src/bin/netconf')
-rw-r--r-- | src/bin/netconf/tests/control_socket_unittests.cc | 8 | ||||
-rw-r--r-- | src/bin/netconf/tests/get_config_unittest.cc | 16 | ||||
-rw-r--r-- | src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc | 40 | ||||
-rw-r--r-- | src/bin/netconf/tests/netconf_controller_unittests.cc | 4 | ||||
-rw-r--r-- | src/bin/netconf/tests/netconf_process_unittests.cc | 4 | ||||
-rw-r--r-- | src/bin/netconf/tests/netconf_unittests.cc | 72 | ||||
-rw-r--r-- | src/bin/netconf/tests/parser_unittests.cc | 8 |
7 files changed, 76 insertions, 76 deletions
diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc index 5ce429e444..cbc024f17b 100644 --- a/src/bin/netconf/tests/control_socket_unittests.cc +++ b/src/bin/netconf/tests/control_socket_unittests.cc @@ -104,7 +104,7 @@ TEST(StdoutControlSocketTest, configTest) { StdoutControlSocketPtr scs(new StdoutControlSocket(cfg)); ASSERT_TRUE(scs); ConstElementPtr answer; - ASSERT_NO_THROW(answer = scs->configTest(ConstElementPtr(), "foo")); + ASSERT_NO_THROW_LOG(answer = scs->configTest(ConstElementPtr(), "foo")); // Check answer. ASSERT_TRUE(answer); @@ -123,7 +123,7 @@ TEST(StdoutControlSocketTest, configSet) { ASSERT_TRUE(tscs); ConstElementPtr json = Element::fromJSON("{ \"bar\": 1 }"); ConstElementPtr answer; - ASSERT_NO_THROW(answer = tscs->configSet(json, "foo")); + ASSERT_NO_THROW_LOG(answer = tscs->configSet(json, "foo")); // Check answer. ASSERT_TRUE(answer); @@ -577,7 +577,7 @@ public: // If the thread is ready to go, start the listener. if (listener_) { - ASSERT_NO_THROW(listener_->start()); + ASSERT_NO_THROW_LOG(listener_->start()); } } @@ -598,7 +598,7 @@ public: // Thread has terminated. We can stop the HTTP // listener safely. if (listener_) { - ASSERT_NO_THROW(listener_->stop()); + ASSERT_NO_THROW_LOG(listener_->stop()); } } diff --git a/src/bin/netconf/tests/get_config_unittest.cc b/src/bin/netconf/tests/get_config_unittest.cc index 9640ac428a..a6b1734963 100644 --- a/src/bin/netconf/tests/get_config_unittest.cc +++ b/src/bin/netconf/tests/get_config_unittest.cc @@ -232,13 +232,13 @@ TEST_F(NetconfGetCfgTest, simple) { // get the simple configuration std::string simple_file = string(CFG_EXAMPLES) + "/" + "simple-dhcp4.json"; std::string config; - ASSERT_NO_THROW(config = readFile(simple_file)); + ASSERT_NO_THROW_LOG(config = readFile(simple_file)); // get the expected configuration std::string expected_file = std::string(NETCONF_TEST_DATA_DIR) + "/" + "get_config.json"; std::string expected; - ASSERT_NO_THROW(expected = readFile(expected_file)); + ASSERT_NO_THROW_LOG(expected = readFile(expected_file)); // execute the sample configuration ASSERT_TRUE(executeConfiguration(config, "simple config")); @@ -246,26 +246,26 @@ TEST_F(NetconfGetCfgTest, simple) { // unparse it NetconfConfigPtr context = srv_->getNetconfConfig(); ConstElementPtr unparsed; - ASSERT_NO_THROW(unparsed = context->toElement()); + ASSERT_NO_THROW_LOG(unparsed = context->toElement()); // dump if wanted else check if (generate_action) { std::cerr << "// Generated Configuration (remove this line)\n"; - ASSERT_NO_THROW(expected = prettyPrint(unparsed)); + ASSERT_NO_THROW_LOG(expected = prettyPrint(unparsed)); prettyPrint(unparsed, std::cerr, 0, 4); std::cerr << "\n"; } else { // get the expected config using the netconf syntax parser ElementPtr jsond; - ASSERT_NO_THROW(jsond = parseNETCONF(expected, true)); + ASSERT_NO_THROW_LOG(jsond = parseNETCONF(expected, true)); // get the expected config using the generic JSON syntax parser ElementPtr jsonj; - ASSERT_NO_THROW(jsonj = parseJSON(expected)); + ASSERT_NO_THROW_LOG(jsonj = parseJSON(expected)); // the generic JSON parser does not handle comments EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj))); // replace the path by its actual value ConstElementPtr ca; - ASSERT_NO_THROW(ca = jsonj->get("Netconf")); + ASSERT_NO_THROW_LOG(ca = jsonj->get("Netconf")); ASSERT_TRUE(ca); pathReplacer(ca); // check that unparsed and updated expected values match @@ -285,7 +285,7 @@ TEST_F(NetconfGetCfgTest, simple) { // is it a fixed point? NetconfConfigPtr context2 = srv_->getNetconfConfig(); ConstElementPtr unparsed2; - ASSERT_NO_THROW(unparsed2 = context2->toElement()); + ASSERT_NO_THROW_LOG(unparsed2 = context2->toElement()); ASSERT_TRUE(unparsed2); EXPECT_TRUE(isEquivalent(unparsed, unparsed2)); } diff --git a/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc b/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc index 9304bffd6a..4b50a8178e 100644 --- a/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc +++ b/src/bin/netconf/tests/netconf_cfg_mgr_unittests.cc @@ -40,11 +40,11 @@ TEST(NetconfCfgMgr, construction) { boost::scoped_ptr<NetconfCfgMgr> cfg_mgr; // Verify that configuration manager constructions without error. - ASSERT_NO_THROW(cfg_mgr.reset(new NetconfCfgMgr())); + ASSERT_NO_THROW_LOG(cfg_mgr.reset(new NetconfCfgMgr())); // Verify that the context can be retrieved and is not null. NetconfConfigPtr context; - ASSERT_NO_THROW(context = cfg_mgr->getNetconfConfig()); + ASSERT_NO_THROW_LOG(context = cfg_mgr->getNetconfConfig()); EXPECT_TRUE(context); // Verify that the manager can be destructed without error. @@ -56,7 +56,7 @@ TEST(NetconfCfgMgr, getContext) { NetconfCfgMgr cfg_mgr; NetconfConfigPtr ctx; - ASSERT_NO_THROW(ctx = cfg_mgr.getNetconfConfig()); + ASSERT_NO_THROW_LOG(ctx = cfg_mgr.getNetconfConfig()); ASSERT_TRUE(ctx); } @@ -96,7 +96,7 @@ TEST(NetconfCfgMgr, contextServer) { // Now check the values returned EXPECT_EQ(1, ctx.getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx.getCfgServersMap()->at("d2")); + ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("d2")); EXPECT_EQ(server1, ctx.getCfgServersMap()->at("d2")); EXPECT_THROW(ctx.getCfgServersMap()->at("dhcp4"), std::out_of_range); @@ -105,7 +105,7 @@ TEST(NetconfCfgMgr, contextServer) { // Should be possible to retrieve two servers EXPECT_EQ(2, ctx.getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx.getCfgServersMap()->at("dhcp6")); + ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("dhcp6")); EXPECT_EQ(server1, ctx.getCfgServersMap()->at("d2")); EXPECT_EQ(server2, ctx.getCfgServersMap()->at("dhcp6")); @@ -113,8 +113,8 @@ TEST(NetconfCfgMgr, contextServer) { EXPECT_NO_THROW(ctx.getCfgServersMap()->insert(make_pair("dhcp4", server3))); EXPECT_NO_THROW(ctx.getCfgServersMap()->insert(make_pair("ca", server4))); EXPECT_EQ(4, ctx.getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx.getCfgServersMap()->at("dhcp4")); - ASSERT_NO_THROW(ctx.getCfgServersMap()->at("ca")); + ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(ctx.getCfgServersMap()->at("ca")); EXPECT_EQ(server3, ctx.getCfgServersMap()->at("dhcp4")); EXPECT_EQ(server4, ctx.getCfgServersMap()->at("ca")); } @@ -162,10 +162,10 @@ TEST(NetconfCfgMgr, contextGlobals) { " \"alist\": [ 1, 2, 3 ],\n" " \"abool\": true\n" "}\n"; - ASSERT_NO_THROW(global_cfg = Element::fromJSON(global_cfg_str)); + ASSERT_NO_THROW_LOG(global_cfg = Element::fromJSON(global_cfg_str)); // Extract globals from the config. - ASSERT_NO_THROW(ctx.extractConfiguredGlobals(global_cfg)); + ASSERT_NO_THROW_LOG(ctx.extractConfiguredGlobals(global_cfg)); // Now see if the extract was correct. globals = ctx.getConfiguredGlobals(); @@ -439,7 +439,7 @@ TEST_F(NetconfParserTest, configParseEmptyCfgServer) { ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(1, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP4_SERVER, server->getModel()); @@ -460,7 +460,7 @@ TEST_F(NetconfParserTest, configParseDefaults) { ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(1, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP4_SERVER, server->getModel()); @@ -485,7 +485,7 @@ TEST_F(NetconfParserTest, configParseServerDhcp4) { ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(1, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP4_SERVER, server->getModel()); @@ -508,7 +508,7 @@ TEST_F(NetconfParserTest, configParseServerD2) { ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(1, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("d2")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("d2")); CfgServerPtr server = ctx->getCfgServersMap()->at("d2"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP_DDNS, server->getModel()); @@ -530,7 +530,7 @@ TEST_F(NetconfParserTest, configParseServerDhcp6) { ASSERT_TRUE(ctx); ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(1, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp6")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp6")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp6"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP6_SERVER, server->getModel()); @@ -551,7 +551,7 @@ TEST_F(NetconfParserTest, configParse4Servers) { ASSERT_TRUE(ctx->getCfgServersMap()); EXPECT_EQ(4, ctx->getCfgServersMap()->size()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP4_SERVER, server->getModel()); @@ -564,7 +564,7 @@ TEST_F(NetconfParserTest, configParse4Servers) { EXPECT_EQ("/tmp/socket-v4", socket->getName()); EXPECT_EQ("http://127.0.0.1:8000/", socket->getUrl().toText()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("dhcp6")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("dhcp6")); server = ctx->getCfgServersMap()->at("dhcp6"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP6_SERVER, server->getModel()); @@ -577,7 +577,7 @@ TEST_F(NetconfParserTest, configParse4Servers) { EXPECT_EQ("/tmp/socket-v6", socket->getName()); EXPECT_EQ("http://127.0.0.1:8000/", socket->getUrl().toText()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("d2")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("d2")); server = ctx->getCfgServersMap()->at("d2"); ASSERT_TRUE(server); EXPECT_EQ(KEA_DHCP_DDNS, server->getModel()); @@ -590,7 +590,7 @@ TEST_F(NetconfParserTest, configParse4Servers) { EXPECT_EQ("/tmp/socket-d2", socket->getName()); EXPECT_EQ("http://127.0.0.1:8000/", socket->getUrl().toText()); - ASSERT_NO_THROW(ctx->getCfgServersMap()->at("ca")); + ASSERT_NO_THROW_LOG(ctx->getCfgServersMap()->at("ca")); server = ctx->getCfgServersMap()->at("ca"); ASSERT_TRUE(server); EXPECT_EQ(KEA_CTRL_AGENT, server->getModel()); @@ -703,7 +703,7 @@ TEST_F(NetconfParserTest, comments) { // There is a DHCP4 server. ASSERT_TRUE(netconf_ctx->getCfgServersMap()); - ASSERT_NO_THROW(netconf_ctx->getCfgServersMap()->at("dhcp4")); + ASSERT_NO_THROW_LOG(netconf_ctx->getCfgServersMap()->at("dhcp4")); CfgServerPtr server = netconf_ctx->getCfgServersMap()->at("dhcp4"); ASSERT_TRUE(server); @@ -715,7 +715,7 @@ TEST_F(NetconfParserTest, comments) { EXPECT_EQ("\"dhcp4 server\"", ctx4->get("comment")->str()); // There is a DHCP6 server. - ASSERT_NO_THROW(netconf_ctx->getCfgServersMap()->at("dhcp6")); + ASSERT_NO_THROW_LOG(netconf_ctx->getCfgServersMap()->at("dhcp6")); server = netconf_ctx->getCfgServersMap()->at("dhcp6"); ASSERT_TRUE(server); diff --git a/src/bin/netconf/tests/netconf_controller_unittests.cc b/src/bin/netconf/tests/netconf_controller_unittests.cc index 6ae4a6bc7f..8159ea22b9 100644 --- a/src/bin/netconf/tests/netconf_controller_unittests.cc +++ b/src/bin/netconf/tests/netconf_controller_unittests.cc @@ -90,7 +90,7 @@ TEST_F(NetconfControllerTest, basicInstanceTesting) { // it has the correct type. DControllerBasePtr& controller = DControllerTest::getController(); ASSERT_TRUE(controller); - ASSERT_NO_THROW(boost::dynamic_pointer_cast<NetconfController>(controller)); + ASSERT_NO_THROW_LOG(boost::dynamic_pointer_cast<NetconfController>(controller)); // Verify that controller's app name is correct. EXPECT_TRUE(checkAppName(NetconfController::netconf_app_name_)); @@ -139,7 +139,7 @@ TEST_F(NetconfControllerTest, commandLineArgs) { // Tests application process creation and initialization. // Verifies that the process can be successfully created and initialized. TEST_F(NetconfControllerTest, initProcessTesting) { - ASSERT_NO_THROW(initProcess()); + ASSERT_NO_THROW_LOG(initProcess()); EXPECT_TRUE(checkProcess()); } diff --git a/src/bin/netconf/tests/netconf_process_unittests.cc b/src/bin/netconf/tests/netconf_process_unittests.cc index c16b7e7233..9cce4cf485 100644 --- a/src/bin/netconf/tests/netconf_process_unittests.cc +++ b/src/bin/netconf/tests/netconf_process_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -52,7 +52,7 @@ TEST(NetconfProcess, construction) { // Verify that the constructor succeeds with a valid io_service lcl_io_service.reset(new IOService()); - ASSERT_NO_THROW(NetconfProcess("TestProcess", lcl_io_service)); + ASSERT_NO_THROW_LOG(NetconfProcess("TestProcess", lcl_io_service)); // Verify tha the configuration is accessible after construction. NetconfProcess netconf_process("TestProcess", lcl_io_service); diff --git a/src/bin/netconf/tests/netconf_unittests.cc b/src/bin/netconf/tests/netconf_unittests.cc index ceaa2fc818..cd6ee6293c 100644 --- a/src/bin/netconf/tests/netconf_unittests.cc +++ b/src/bin/netconf/tests/netconf_unittests.cc @@ -411,7 +411,7 @@ TEST_F(NetconfAgentLogTest, checkModules) { // Run checkModules but it will be indirectly checked as // emitting nothing. - ASSERT_NO_THROW(agent_->checkModules()); + ASSERT_NO_THROW_LOG(agent_->checkModules()); // Remove kea-dhcp6-server. const string& module = "kea-dhcp6-server"; @@ -419,7 +419,7 @@ TEST_F(NetconfAgentLogTest, checkModules) { if (it6 != agent_->modules_.end()) { agent_->modules_.erase(it6); } - ASSERT_NO_THROW(agent_->checkModules()); + ASSERT_NO_THROW_LOG(agent_->checkModules()); ostringstream mmsg; mmsg << "NETCONF_MODULE_MISSING_WARN Missing module " << module << " in sysrepo"; @@ -428,7 +428,7 @@ TEST_F(NetconfAgentLogTest, checkModules) { // Add it back with a bad revision. const string& bad_revision = "2018-07-14"; agent_->modules_.insert(make_pair(module, bad_revision)); - ASSERT_NO_THROW(agent_->checkModules()); + ASSERT_NO_THROW_LOG(agent_->checkModules()); ostringstream rmsg; rmsg << "NETCONF_MODULE_REVISION_WARN Module " << module << " does NOT have the right revision: expected " @@ -455,9 +455,9 @@ TEST_F(NetconfAgentLogTest, logChanges) { "10.0.2.0/24", SR_STRING_T, true } }); // Load initial YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree0, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree0, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Subscribe configuration changes. @@ -525,9 +525,9 @@ TEST_F(NetconfAgentLogTest, logChanges2) { "10.0.2.0/24", SR_STRING_T, true } }); // Load initial YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree0, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree0, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Subscribe configuration changes. @@ -633,12 +633,12 @@ TEST_F(NetconfAgentTest, keaConfig) { ASSERT_EQ(1, requests_.size()); const string& request_str = requests_[0]; ConstElementPtr request; - ASSERT_NO_THROW(request = Element::fromJSON(request_str)); + ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); string expected_str = "{\n" "\"command\": \"config-get\"\n" "}"; ConstElementPtr expected; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*request)); // Alternative showing more for debugging... // EXPECT_EQ(prettyPrint(expected), prettyPrint(request)); @@ -647,14 +647,14 @@ TEST_F(NetconfAgentTest, keaConfig) { ASSERT_EQ(1, responses_.size()); const string& response_str = responses_[0]; ConstElementPtr response; - ASSERT_NO_THROW(response = Element::fromJSON(response_str)); + ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); expected_str = "{\n" "\"result\": 0,\n" "\"arguments\": {\n" " \"comment\": \"empty\"\n" " }\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*response)); } @@ -676,9 +676,9 @@ TEST_F(NetconfAgentTest, yangConfig) { "10.0.2.0/24", SR_STRING_T, true } }); // Load YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Netconf configuration. @@ -734,7 +734,7 @@ TEST_F(NetconfAgentTest, yangConfig) { ASSERT_EQ(1, requests_.size()); const string& request_str = requests_[0]; ConstElementPtr request; - ASSERT_NO_THROW(request = Element::fromJSON(request_str)); + ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); string expected_str = "{\n" "\"command\": \"config-set\",\n" "\"arguments\": {\n" @@ -753,7 +753,7 @@ TEST_F(NetconfAgentTest, yangConfig) { " }\n" "}"; ConstElementPtr expected; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); sortSubnets(expected); sortSubnets(request); @@ -763,11 +763,11 @@ TEST_F(NetconfAgentTest, yangConfig) { ASSERT_EQ(1, responses_.size()); const string& response_str = responses_[0]; ConstElementPtr response; - ASSERT_NO_THROW(response = Element::fromJSON(response_str)); + ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); expected_str = "{\n" "\"result\": 0\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*response)); } @@ -812,7 +812,7 @@ TEST_F(NetconfAgentTest, subscribeConfig) { // Try subscribeConfig. EXPECT_EQ(0, agent_->subscriptions_.size()); - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); EXPECT_EQ(0, agent_->subscriptions_.size()); EXPECT_NO_THROW(agent_->subscribeConfig(service_pair)); EXPECT_EQ(1, agent_->subscriptions_.size()); @@ -839,9 +839,9 @@ TEST_F(NetconfAgentTest, update) { "10.0.2.0/24", SR_STRING_T, true } }); // Load initial YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree0, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree0, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Netconf configuration. @@ -918,7 +918,7 @@ TEST_F(NetconfAgentTest, update) { ASSERT_EQ(1, requests_.size()); const string& request_str = requests_[0]; ConstElementPtr request; - ASSERT_NO_THROW(request = Element::fromJSON(request_str)); + ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); string expected_str = "{\n" "\"command\": \"config-set\",\n" "\"arguments\": {\n" @@ -937,7 +937,7 @@ TEST_F(NetconfAgentTest, update) { " }\n" "}"; ConstElementPtr expected; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); sortSubnets(expected); sortSubnets(request); @@ -947,11 +947,11 @@ TEST_F(NetconfAgentTest, update) { ASSERT_EQ(1, responses_.size()); const string& response_str = responses_[0]; ConstElementPtr response; - ASSERT_NO_THROW(response = Element::fromJSON(response_str)); + ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); expected_str = "{\n" "\"result\": 0\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*response)); } @@ -974,9 +974,9 @@ TEST_F(NetconfAgentTest, validate) { "10.0.2.0/24", SR_STRING_T, true } }); // Load initial YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree0, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree0, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Netconf configuration. @@ -1056,7 +1056,7 @@ TEST_F(NetconfAgentTest, validate) { ASSERT_LE(1, requests_.size()); string request_str = requests_[0]; ConstElementPtr request; - ASSERT_NO_THROW(request = Element::fromJSON(request_str)); + ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); string expected_str = "{\n" "\"command\": \"config-test\",\n" "\"arguments\": {\n" @@ -1075,7 +1075,7 @@ TEST_F(NetconfAgentTest, validate) { " }\n" "}"; ConstElementPtr expected; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); sortSubnets(expected); sortSubnets(request); @@ -1084,7 +1084,7 @@ TEST_F(NetconfAgentTest, validate) { // Check that the fakse server received the second request. ASSERT_EQ(2, requests_.size()); request_str = requests_[1]; - ASSERT_NO_THROW(request = Element::fromJSON(request_str)); + ASSERT_NO_THROW_LOG(request = Element::fromJSON(request_str)); expected_str = "{\n" "\"command\": \"config-set\",\n" "\"arguments\": {\n" @@ -1102,7 +1102,7 @@ TEST_F(NetconfAgentTest, validate) { " }\n" " }\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); sortSubnets(expected); sortSubnets(request); @@ -1112,19 +1112,19 @@ TEST_F(NetconfAgentTest, validate) { ASSERT_EQ(2, responses_.size()); string response_str = responses_[0]; ConstElementPtr response; - ASSERT_NO_THROW(response = Element::fromJSON(response_str)); + ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); expected_str = "{\n" "\"result\": 0\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*response)); response_str = responses_[1]; - ASSERT_NO_THROW(response = Element::fromJSON(response_str)); + ASSERT_NO_THROW_LOG(response = Element::fromJSON(response_str)); expected_str = "{\n" "\"result\": 0\n" "}"; - ASSERT_NO_THROW(expected = Element::fromJSON(expected_str)); + ASSERT_NO_THROW_LOG(expected = Element::fromJSON(expected_str)); EXPECT_TRUE(expected->equals(*response)); } @@ -1140,9 +1140,9 @@ TEST_F(NetconfAgentTest, noValidate) { "10.0.0.0/24", SR_STRING_T, true } }); // Load initial YANG configuration. - ASSERT_NO_THROW(agent_->initSysrepo()); + ASSERT_NO_THROW_LOG(agent_->initSysrepo()); YangRepr repr(KEA_DHCP4_SERVER); - ASSERT_NO_THROW(repr.set(tree0, agent_->startup_sess_)); + ASSERT_NO_THROW_LOG(repr.set(tree0, agent_->startup_sess_)); EXPECT_NO_THROW(agent_->startup_sess_->apply_changes()); // Netconf configuration. diff --git a/src/bin/netconf/tests/parser_unittests.cc b/src/bin/netconf/tests/parser_unittests.cc index 65be83dba5..1788716ee1 100644 --- a/src/bin/netconf/tests/parser_unittests.cc +++ b/src/bin/netconf/tests/parser_unittests.cc @@ -50,7 +50,7 @@ void testParser(const std::string& txt, ParserContext::ParserType parser_type, bool compare = true) { ConstElementPtr test_json; - ASSERT_NO_THROW({ + ASSERT_NO_THROW_LOG({ try { ParserContext ctx; test_json = ctx.parseString(txt, parser_type); @@ -67,7 +67,7 @@ void testParser(const std::string& txt, ParserContext::ParserType parser_type, // Now compare if both representations are the same. ElementPtr reference_json; - ASSERT_NO_THROW(reference_json = Element::fromJSON(txt, true)); + ASSERT_NO_THROW_LOG(reference_json = Element::fromJSON(txt, true)); compareJSON(reference_json, test_json); } @@ -732,7 +732,7 @@ TEST(ParserTest, unicodeEscapes) { ins[1] = c; ConstElementPtr e(new StringElement(ins)); json = e->str(); - ASSERT_NO_THROW( + ASSERT_NO_THROW_LOG( try { ParserContext ctx; result = ctx.parseString(json, ParserContext::PARSER_JSON); @@ -750,7 +750,7 @@ TEST(ParserTest, unicodeSlash) { // check the 4 possible encodings of solidus '/' ConstElementPtr result; string json = "\"/\\/\\u002f\\u002F\""; - ASSERT_NO_THROW( + ASSERT_NO_THROW_LOG( try { ParserContext ctx; result = ctx.parseString(json, ParserContext::PARSER_JSON); |