Commit f45fe7b7 authored by Francis Dupont's avatar Francis Dupont

[381-bad-config-crashes-ca-or-d2-servers-even-with-c] Added a not regression unit test

parent 52927a0a
// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // 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 // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -130,6 +130,37 @@ TEST_F(LoggingTest, parsingConsoleOutput) { ...@@ -130,6 +130,37 @@ TEST_F(LoggingTest, parsingConsoleOutput) {
EXPECT_TRUE(storage->getLoggingInfo()[0].destinations_[0].flush_); EXPECT_TRUE(storage->getLoggingInfo()[0].destinations_[0].flush_);
} }
// Checks if the LogConfigParser class fails when the configuration
// lacks a severity entry.
TEST_F(LoggingTest, parsingNoSeverity) {
const char* config_txt =
"{ \"loggers\": ["
" {"
" \"name\": \"kea\","
" \"output_options\": ["
" {"
" \"output\": \"stdout\","
" \"flush\": true"
" }"
" ],"
" \"debuglevel\": 99"
" }"
"]}";
ConfigPtr storage(new ConfigBase());
LogConfigParser parser(storage);
// We need to parse properly formed JSON and then extract
// "loggers" element from it. For some reason fromJSON is
// throwing at opening square bracket
ConstElementPtr config = Element::fromJSON(config_txt);
config = config->get("loggers");
EXPECT_THROW(parser.parseConfiguration(config), BadValue);
}
// Checks if the LogConfigParser class is able to transform JSON structures // Checks if the LogConfigParser class is able to transform JSON structures
// into Configuration usable by log4cplus. This test checks for output // into Configuration usable by log4cplus. This test checks for output
// configured to a file on INFO level. // configured to a file on INFO level.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment