]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2786] fixed UTs when backends are disabled
authorRazvan Becheriu <razvan@isc.org>
Thu, 11 May 2023 14:45:13 +0000 (17:45 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 11 May 2023 14:45:13 +0000 (17:45 +0300)
src/bin/dhcp4/tests/decline_unittest.cc
src/bin/dhcp6/tests/decline_unittest.cc
tools/check-for-json-errors-in-doc.sh

index 458458d7cae8c49e9de9b8c7e3af1b0a551c0ed9..8c515f5b9142252e1f85bfc971a12e18014d3745 100644 (file)
@@ -49,7 +49,7 @@ const char* DECLINE_CONFIGS[] = {
         "    } ]"
         " } ]"
     "}",
-// Configuration 1
+// Configuration 1 - only use when mysql is enabled
     "{ \"interfaces-config\": {"
         "      \"interfaces\": [ \"*\" ]"
         "},"
@@ -70,7 +70,7 @@ const char* DECLINE_CONFIGS[] = {
         "    } ]"
         " } ]"
     "}",
-// Configuration 2
+// Configuration 2 - only use when pgsql is enabled
     "{ \"interfaces-config\": {"
         "      \"interfaces\": [ \"*\" ]"
         "},"
@@ -254,6 +254,7 @@ TEST_F(DeclineTest, declineNoIdentifierChangeMemfile) {
                       SHOULD_PASS);
 }
 
+#ifdef HAVE_MYSQL
 // This test checks that the client can acquire and decline the lease.
 TEST_F(DeclineTest, declineNoIdentifierChangeMySQL) {
     Dhcp4Client client(Dhcp4Client::SELECTING);
@@ -261,7 +262,9 @@ TEST_F(DeclineTest, declineNoIdentifierChangeMySQL) {
                       "01:02:03:04:05:06", "12:14",
                       SHOULD_PASS, 1);
 }
+#endif
 
+#ifdef HAVE_PGSQL
 // This test checks that the client can acquire and decline the lease.
 TEST_F(DeclineTest, declineNoIdentifierChangePgSQL) {
     Dhcp4Client client(Dhcp4Client::SELECTING);
@@ -269,6 +272,7 @@ TEST_F(DeclineTest, declineNoIdentifierChangePgSQL) {
                       "01:02:03:04:05:06", "12:14",
                       SHOULD_PASS, 2);
 }
+#endif
 
 // This test verifies the decline correctness in the following case:
 // - Client acquires new lease using HW address only
index 509c5e8d2279d8806b120420c552d8bee9a618a5..39c9ddc92abf341952deef9e8a02f77aa3fa369d 100644 (file)
@@ -42,7 +42,7 @@ const char* DECLINE_CONFIGS[] = {
         "    \"interface\": \"eth0\""
         " } ],"
         "\"valid-lifetime\": 4000 }",
-// Configuration 1
+// Configuration 1 - only use when mysql is enabled
     "{ \"interfaces-config\": {"
         "  \"interfaces\": [ \"*\" ]"
         "},"
@@ -62,7 +62,7 @@ const char* DECLINE_CONFIGS[] = {
         "    \"interface\": \"eth0\""
         " } ],"
         "\"valid-lifetime\": 4000 }",
-// Configuration 2
+// Configuration 2 - only use when pgsql is enabled
     "{ \"interfaces-config\": {"
         "  \"interfaces\": [ \"*\" ]"
         "},"
@@ -248,18 +248,22 @@ TEST_F(DeclineTest, basicMemfile) {
                       1234, VALID_ADDR, SHOULD_PASS);
 }
 
+#ifdef HAVE_MYSQL
 // This test checks that the client can acquire and decline the lease.
 TEST_F(DeclineTest, basicMySQL) {
     Dhcp6Client client;
     acquireAndDecline(client, "01:02:03:04:05:06", 1234, "01:02:03:04:05:06",
                       1234, VALID_ADDR, SHOULD_PASS, 1);
 }
+#endif
 
+#ifdef HAVE_PGSQL
 TEST_F(DeclineTest, basicPgSQL) {
     Dhcp6Client client;
     acquireAndDecline(client, "01:02:03:04:05:06", 1234, "01:02:03:04:05:06",
                       1234, VALID_ADDR, SHOULD_PASS, 2);
 }
+#endif
 
 }
 }
index 49f40508c8cb1fcba976fff5258844dc5ed8aa12..0116e752ea82b0dff5f4cfd1fa8cae0a701b58d2 100755 (executable)
@@ -10,7 +10,7 @@ else
 fi
 
 # Get the files.
-files=$(find ${files} -type f \( -name '*.rst' -or -name '*.json' \) -and -not -path '/_build/*' -and -not -path '/man/*' | sort)
+files=$(find ${files} -type f \( -name '*.rst' -or -name '*.json' \) -and -not -path '*/_build/*' -and -not -path '*/man/*' | sort)
 work_file=$(mktemp)
 for file in $files; do
        json=0
@@ -88,7 +88,7 @@ for file in $files; do
                                fi
                        fi
                fi
-       done <<< $(cat $file | sed ':a;N;$!ba;s/,\s*\n\s*\.\.\.//g' | sed 's/\\\"/\\\\\"/g' | sed 's/\\\\,/\\\\\\\\,/g')
+       done <<< $(cat $file | sed ':a;N;$!ba;s/,\s*\n\s*\.\.\.//g')
        if [ $comment -eq 0 -a $json -eq 1 ]; then
                # if the file ended but the parser is processing a json structure
                cat $work_file | jq . > /dev/null