const string file_txt = file ? file->stringValue() : "";
if (file_txt.empty()) {
isc_throw(AuthConfigError, "Missing zone file for zone: "
- << origin->str());
+ << origin_txt);
+ }
+ // XXX: we need to hardcode the default, see above.
+ ConstElementPtr filetype = zone_config->get("filetype");
+ const string filetype_txt = filetype ? filetype->stringValue() :
+ "text";
+ if (filetype_txt != "text") {
+ isc_throw(AuthConfigError, "Invalid filetype for zone "
+ << origin_txt << ": " << filetype_txt);
}
// Note: we don't want to have such small try-catch blocks for each
RRType::A())->code);
}
-TEST_F(MemoryDatasrcConfigTest, addOneSQLite3Zone) {
+TEST_F(MemoryDatasrcConfigTest, addOneWithFiletype) {
+ // Until #1792 is completed, only "text" filetype is allowed.
+ EXPECT_THROW(parser->build(
+ Element::fromJSON(
+ "[{\"type\": \"memory\","
+ " \"zones\": [{\"origin\": \"example.com\","
+ " \"file\": \""
+ TEST_DATA_DIR "/example.zone\","
+ " \"filetype\": \"sqlite3\"}]}]")),
+ AuthConfigError);
+
+ // Explicitly specifying "text" is okay.
parser->build(Element::fromJSON(
"[{\"type\": \"memory\","
" \"zones\": [{\"origin\": \"example.com\","
" \"file\": \""
TEST_DATA_DIR "/example.zone\","
- " \"filetype\": \"sqlite3\"}]}]"));
+ " \"filetype\": \"text\"}]}]"));
+ parser->commit();
+ EXPECT_EQ(1, server.getInMemoryClient(rrclass)->getZoneCount());
}
TEST_F(MemoryDatasrcConfigTest, addMultiZones) {