Browse Source

[1893] parametralized test NSEC3PARAM data so that they can be shared.

the previous ordering of addition, RRSIG then NSEC3PARAM, doesn't seem to be
necessary, so I reordered them in a more intuitive order.
JINMEI Tatuya 13 years ago
parent
commit
7fb1cf4981
1 changed files with 18 additions and 18 deletions
  1. 18 18
      src/lib/datasrc/tests/database_unittest.cc

+ 18 - 18
src/lib/datasrc/tests/database_unittest.cc

@@ -214,6 +214,15 @@ const char* const TEST_RECORDS[][5] = {
     {NULL, NULL, NULL, NULL, NULL},
     {NULL, NULL, NULL, NULL, NULL},
 };
 };
 
 
+// NSEC3PARAM at the zone origin and its RRSIG.  These will be added
+// separately for some NSEC3 related tests.
+const char* TEST_NSEC3PARAM_RECORDS[][5] = {
+    {"example.org.", "NSEC3PARAM", "3600", "", "1 0 12 aabbccdd"},
+    {"example.org.", "RRSIG", "3600", "", "NSEC3PARAM 5 3 3600 20000101000000 "
+     "20000201000000 12345 example.org. FAKEFAKEFAKE"},
+    {NULL, NULL, NULL, NULL, NULL}
+};
+
 // FIXME: Taken from a different test. Fill with proper data when creating a test.
 // FIXME: Taken from a different test. Fill with proper data when creating a test.
 const char* TEST_NSEC3_RECORDS[][5] = {
 const char* TEST_NSEC3_RECORDS[][5] = {
     {apex_hash, "NSEC3", "300", "", "1 1 12 AABBCCDD 2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG"},
     {apex_hash, "NSEC3", "300", "", "1 1 12 AABBCCDD 2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG"},
@@ -1065,24 +1074,15 @@ public:
     // tests. Note that the NSEC3 namespace is available in other tests, but
     // tests. Note that the NSEC3 namespace is available in other tests, but
     // it should not be accessed at that time.
     // it should not be accessed at that time.
     void enableNSEC3() {
     void enableNSEC3() {
-        // We place the signature first, so it's in the block with the other
-        // signatures
-        vector<string> signature;
-        signature.push_back("RRSIG");
-        signature.push_back("3600");
-        signature.push_back("");
-        signature.push_back("NSEC3PARAM 5 3 3600 20000101000000 20000201000000 "
-                            "12345 example.org. FAKEFAKEFAKE");
-        signature.push_back("exmaple.org.");
-        (*readonly_records_)["example.org."].push_back(signature);
-        // Now the NSEC3 param itself
-        vector<string> param;
-        param.push_back("NSEC3PARAM");
-        param.push_back("3600");
-        param.push_back("");
-        param.push_back("1 0 12 aabbccdd");
-        param.push_back("example.org.");
-        (*readonly_records_)["example.org."].push_back(param);
+        for (int i = 0; TEST_NSEC3PARAM_RECORDS[i][0] != NULL; ++i) {
+            vector<string> param;
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][1]); // RRtype
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][2]); // TTL
+            param.push_back("");                            // sigtype, unused
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][4]); // RDATA
+            param.push_back(TEST_NSEC3PARAM_RECORDS[i][0]); // owner name
+            (*readonly_records_)[param.back()].push_back(param);
+        }
     }
     }
 };
 };