summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/tests/rdata_dnskey_unittest.cc
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@isc.org>2013-04-03 09:02:33 +0200
committerMukund Sivaraman <muks@isc.org>2013-04-03 09:03:46 +0200
commitdfd5516cd85bfda7bab56d161082d2ce74330e2b (patch)
tree464ba44f8c28c2a72f1828ec7ddda2e0085925ed /src/lib/dns/tests/rdata_dnskey_unittest.cc
parent[2387] Add unmatched parenthesis testcases that cause lexer failures (when lo... (diff)
downloadkea-dfd5516cd85bfda7bab56d161082d2ce74330e2b.tar.xz
kea-dfd5516cd85bfda7bab56d161082d2ce74330e2b.zip
[2387] Permit missing key data in DNSKEY RDATA
Diffstat (limited to 'src/lib/dns/tests/rdata_dnskey_unittest.cc')
-rw-r--r--src/lib/dns/tests/rdata_dnskey_unittest.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/dns/tests/rdata_dnskey_unittest.cc b/src/lib/dns/tests/rdata_dnskey_unittest.cc
index e99fc588fe..8e90c1538a 100644
--- a/src/lib/dns/tests/rdata_dnskey_unittest.cc
+++ b/src/lib/dns/tests/rdata_dnskey_unittest.cc
@@ -99,8 +99,8 @@ TEST_F(Rdata_DNSKEY_Test, fromText) {
// Delimited number in key data is OK
checkFromText_None("257 3 5 YmluZDEwLmlzYy 5 vcmc=");
- // Key data missing
- checkFromText_InvalidText("257 3 5");
+ // Missing keydata is OK
+ EXPECT_NO_THROW(const generic::DNSKEY rdata_dnskey3("257 3 5"));
// Flags field out of range
checkFromText_InvalidText("65536 3 5 YmluZDEwLmlzYy5vcmc=");
@@ -171,11 +171,13 @@ TEST_F(Rdata_DNSKEY_Test, createFromWire) {
EXPECT_EQ(0, rdata_dnskey.compare(
*rdataFactoryFromFile(RRType("DNSKEY"), RRClass("IN"),
"rdata_dnskey_fromWire.wire")));
- // Empty keydata should throw
- EXPECT_THROW(rdataFactoryFromFile
- (RRType("DNSKEY"), RRClass("IN"),
- "rdata_dnskey_empty_keydata_fromWire.wire"),
- InvalidRdataLength);
+
+ // Missing keydata is OK
+ const generic::DNSKEY rdata_dnskey_missing_keydata("257 3 5");
+ EXPECT_EQ(0, rdata_dnskey_missing_keydata.compare(
+ *rdataFactoryFromFile(RRType("DNSKEY"), RRClass("IN"),
+ "rdata_dnskey_empty_keydata_fromWire.wire")));
+
// Short keydata for RSA/MD5 should throw
EXPECT_THROW(rdataFactoryFromFile
(RRType("DNSKEY"), RRClass("IN"),