From: Razvan Becheriu Date: Thu, 11 May 2023 14:45:13 +0000 (+0300) Subject: [#2786] fixed UTs when backends are disabled X-Git-Tag: Kea-2.3.8~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ae6b2ce2fc9b2878f9064e3d57e98d0120c359f;p=thirdparty%2Fkea.git [#2786] fixed UTs when backends are disabled --- diff --git a/src/bin/dhcp4/tests/decline_unittest.cc b/src/bin/dhcp4/tests/decline_unittest.cc index 458458d7ca..8c515f5b91 100644 --- a/src/bin/dhcp4/tests/decline_unittest.cc +++ b/src/bin/dhcp4/tests/decline_unittest.cc @@ -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 diff --git a/src/bin/dhcp6/tests/decline_unittest.cc b/src/bin/dhcp6/tests/decline_unittest.cc index 509c5e8d22..39c9ddc92a 100644 --- a/src/bin/dhcp6/tests/decline_unittest.cc +++ b/src/bin/dhcp6/tests/decline_unittest.cc @@ -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 } } diff --git a/tools/check-for-json-errors-in-doc.sh b/tools/check-for-json-errors-in-doc.sh index 49f40508c8..0116e752ea 100755 --- a/tools/check-for-json-errors-in-doc.sh +++ b/tools/check-for-json-errors-in-doc.sh @@ -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