summaryrefslogtreecommitdiffstats
path: root/tests/config/keyfile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/config/keyfile')
-rw-r--r--tests/config/keyfile/bad_args.args1
-rw-r--r--tests/config/keyfile/bad_args.returncode1
-rw-r--r--tests/config/keyfile/bad_args.test.lua0
-rw-r--r--tests/config/keyfile/load_ta.args1
-rw-r--r--tests/config/keyfile/load_ta.test.lua37
-rw-r--r--tests/config/keyfile/nonexist_keyfile1.args1
-rw-r--r--tests/config/keyfile/nonexist_keyfile1.returncode1
-rw-r--r--tests/config/keyfile/nonexist_keyfile1.test.lua2
-rw-r--r--tests/config/keyfile/nonexist_keyfile2.args1
-rw-r--r--tests/config/keyfile/nonexist_keyfile2.returncode1
-rw-r--r--tests/config/keyfile/nonexist_keyfile2.test.lua2
-rw-r--r--tests/config/keyfile/root1.keys1
-rw-r--r--tests/config/keyfile/root2.keys1
13 files changed, 50 insertions, 0 deletions
diff --git a/tests/config/keyfile/bad_args.args b/tests/config/keyfile/bad_args.args
new file mode 100644
index 0000000..6661ce0
--- /dev/null
+++ b/tests/config/keyfile/bad_args.args
@@ -0,0 +1 @@
+--keyfile-ro root.keys --keyfile root.keys \ No newline at end of file
diff --git a/tests/config/keyfile/bad_args.returncode b/tests/config/keyfile/bad_args.returncode
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ b/tests/config/keyfile/bad_args.returncode
@@ -0,0 +1 @@
+1 \ No newline at end of file
diff --git a/tests/config/keyfile/bad_args.test.lua b/tests/config/keyfile/bad_args.test.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/config/keyfile/bad_args.test.lua
diff --git a/tests/config/keyfile/load_ta.args b/tests/config/keyfile/load_ta.args
new file mode 100644
index 0000000..2d1897d
--- /dev/null
+++ b/tests/config/keyfile/load_ta.args
@@ -0,0 +1 @@
+--keyfile-ro root2.keys \ No newline at end of file
diff --git a/tests/config/keyfile/load_ta.test.lua b/tests/config/keyfile/load_ta.test.lua
new file mode 100644
index 0000000..bfe851b
--- /dev/null
+++ b/tests/config/keyfile/load_ta.test.lua
@@ -0,0 +1,37 @@
+-- test fixtures
+
+-- count warning message, fail with other than allowed message
+warn_msg = {}
+overriding_msg="[ ta ] warning: overriding previously set trust anchors for ."
+warn_msg[overriding_msg] = 0
+function warn(fmt, ...)
+ msg = string.format(fmt, ...)
+ if warn_msg[msg] == nil then
+ fail(string.format("Not allowed warn message: %s", msg))
+ else
+ warn_msg[msg] = warn_msg[msg] + 1
+ end
+end
+
+-- tests
+
+boom(trust_anchors.add_file, {'nonwriteable/root.keys', false},
+ "Managed trust anchor in non-writeable directory")
+
+boom(trust_anchors.add_file, {'nonexist.keys', true},
+ "Nonexist unmanaged trust anchor file")
+
+trust_anchors.add_file('root2.keys', true)
+trust_anchors.add_file('root1.keys', true)
+is(warn_msg[overriding_msg], 1, "Warning message when override trust anchors")
+
+is(trust_anchors.keysets['\0'][1].key_tag, 19036,
+ "Loaded KeyTag from root1.keys")
+
+local function test_loading_from_cmdline()
+ is(trust_anchors.keysets['\0'][1].key_tag , 20326,
+ "Loaded KeyTag from cmdline file root2.keys")
+ is(warn_msg[overriding_msg], 2, "Warning message when override trust anchors")
+end
+
+return {test_loading_from_cmdline}
diff --git a/tests/config/keyfile/nonexist_keyfile1.args b/tests/config/keyfile/nonexist_keyfile1.args
new file mode 100644
index 0000000..6fead68
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile1.args
@@ -0,0 +1 @@
+--keyfile-ro nonexist \ No newline at end of file
diff --git a/tests/config/keyfile/nonexist_keyfile1.returncode b/tests/config/keyfile/nonexist_keyfile1.returncode
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile1.returncode
@@ -0,0 +1 @@
+1 \ No newline at end of file
diff --git a/tests/config/keyfile/nonexist_keyfile1.test.lua b/tests/config/keyfile/nonexist_keyfile1.test.lua
new file mode 100644
index 0000000..be73f32
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile1.test.lua
@@ -0,0 +1,2 @@
+-- simulate building without KEYFILE_DEFAULT
+trust_anchors.keyfile_default = nil
diff --git a/tests/config/keyfile/nonexist_keyfile2.args b/tests/config/keyfile/nonexist_keyfile2.args
new file mode 100644
index 0000000..6fead68
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile2.args
@@ -0,0 +1 @@
+--keyfile-ro nonexist \ No newline at end of file
diff --git a/tests/config/keyfile/nonexist_keyfile2.returncode b/tests/config/keyfile/nonexist_keyfile2.returncode
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile2.returncode
@@ -0,0 +1 @@
+1 \ No newline at end of file
diff --git a/tests/config/keyfile/nonexist_keyfile2.test.lua b/tests/config/keyfile/nonexist_keyfile2.test.lua
new file mode 100644
index 0000000..bb2f98b
--- /dev/null
+++ b/tests/config/keyfile/nonexist_keyfile2.test.lua
@@ -0,0 +1,2 @@
+-- simulate building with KEYFILE_DEFAULT
+trust_anchors.keyfile_default = "root1.keys"
diff --git a/tests/config/keyfile/root1.keys b/tests/config/keyfile/root1.keys
new file mode 100644
index 0000000..c734337
--- /dev/null
+++ b/tests/config/keyfile/root1.keys
@@ -0,0 +1 @@
+. 172800 DNSKEY 257 3 8 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjFFVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoXbfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaDX6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpzW5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relSQageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulqQxA+Uk1ihz0= ; Valid: ; KeyTag:19036
diff --git a/tests/config/keyfile/root2.keys b/tests/config/keyfile/root2.keys
new file mode 100644
index 0000000..5e9d6ac
--- /dev/null
+++ b/tests/config/keyfile/root2.keys
@@ -0,0 +1 @@
+. 172800 DNSKEY 257 3 8 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU= ; Valid: ; KeyTag:20326