#include <cc/data.h>
#include <cc/dhcp_config_error.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <gtest/gtest.h>
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "CTRL_AGENT_CONFIG_SYNTAX_WARNING Control Agent ";
+ log += "configuration syntax warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"Control-agent": {
"control-sockets": {
})");
testParser(txt, ParserContext::PARSER_AGENT, false);
+ addLog("<string>:6.30");
+ addLog("<string>:10.30");
+ addLog("<string>:14.30");
+ addLog("<string>:15.8");
+ addLog("<string>:25.31");
+ addLog("<string>:26.12");
+ addLog("<string>:28.28");
+ addLog("<string>:29.8");
+ addLog("<string>:30.6");
+ addLog("<string>:31.4");
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, ParserContext::PARSER_AGENT, false);
#include <d2/parser_context.h>
#include <d2/tests/parser_unittest.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <gtest/gtest.h>
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "DHCP_DDNS_CONFIG_SYNTAX_WARNING DHCP-DDNS server ";
+ log += "configuration syntax warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"DhcpDdns": {
"forward-ddns": {},
})");
testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
+ addLog("<string>:11.12");
+ addLog("<string>:13.28");
+ addLog("<string>:14.8");
+ addLog("<string>:22.45");
+ addLog("<string>:23.8");
+ addLog("<string>:25.4");
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
#include <dhcpsrv/parsers/simple_parser4.h>
#include <testutils/gtest_utils.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <gtest/gtest.h>
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "DHCP4_CONFIG_SYNTAX_WARNING configuration syntax ";
+ log += "warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"Dhcp4": {
"control-socket": {
})");
testParser(txt, Parser4Context::PARSER_DHCP4, false);
+ addLog("<string>:5.28");
+ addLog("<string>:9.63");
+ addLog("<string>:10.8");
+ addLog("<string>:14.15");
+ addLog("<string>:15.8");
+ addLog("<string>:20.24");
+ addLog("<string>:28.31");
+ addLog("<string>:29.12");
+ addLog("<string>:31.28");
+ addLog("<string>:32.8");
+ addLog("<string>:43.37");
+ addLog("<string>:44.12");
+ addLog("<string>:46.35");
+ addLog("<string>:47.8");
+ addLog("<string>:48.6");
+ addLog("<string>:49.4");
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, Parser4Context::PARSER_DHCP4, false);
#include <dhcp6/parser_context.h>
#include <dhcpsrv/parsers/simple_parser6.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <testutils/gtest_utils.h>
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "DHCP6_CONFIG_SYNTAX_WARNING configuration syntax ";
+ log += "warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"Dhcp6": {
"control-socket": {
})");
testParser(txt, Parser6Context::PARSER_DHCP6, false);
+ addLog("<string>:5.28");
+ addLog("<string>:9.63");
+ addLog("<string>:10.8");
+ addLog("<string>:14.15");
+ addLog("<string>:15.8");
+ addLog("<string>:20.24");
+ addLog("<string>:28.31");
+ addLog("<string>:29.12");
+ addLog("<string>:31.28");
+ addLog("<string>:32.8");
+ addLog("<string>:43.38");
+ addLog("<string>:44.12");
+ addLog("<string>:46.36");
+ addLog("<string>:47.8");
+ addLog("<string>:48.6");
+ addLog("<string>:49.4");
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, Parser6Context::PARSER_DHCP6, false);
#include <netconf/parser_context.h>
#include <testutils/gtest_utils.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <gtest/gtest.h>
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "NETCONF_CONFIG_SYNTAX_WARNING Netconf ";
+ log += "configuration syntax warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"Netconf": {
"boot-update": true,
})");
testParser(txt, ParserContext::PARSER_NETCONF, false);
+ addLog("<string>:7.16");
+ /// @todo
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, ParserContext::PARSER_NETCONF, false);