From: Remi Gacogne Date: Tue, 25 Jan 2022 16:15:17 +0000 (+0100) Subject: dnsdist: Add low-hanging unit test cases to improve code coverage X-Git-Tag: auth-4.8.0-alpha0~146^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47c4ed832ede0f2c9cab3818eb9d40061b20bb06;p=thirdparty%2Fpdns.git dnsdist: Add low-hanging unit test cases to improve code coverage --- diff --git a/pdns/dnsdistdist/test-connectionmanagement_hh.cc b/pdns/dnsdistdist/test-connectionmanagement_hh.cc index 34432f2902..83205183c3 100644 --- a/pdns/dnsdistdist/test-connectionmanagement_hh.cc +++ b/pdns/dnsdistdist/test-connectionmanagement_hh.cc @@ -29,6 +29,7 @@ BOOST_AUTO_TEST_CASE(test_ConnectionManagementEnabled) { /* raise the number of slots */ maxConns = 12; manager.setMaxConcurrentConnections(maxConns); + BOOST_CHECK_EQUAL(manager.getMaxConcurrentConnections(), maxConns); BOOST_CHECK_EQUAL(manager.registerConnection(), true); BOOST_CHECK_EQUAL(manager.registerConnection(), true); BOOST_CHECK_EQUAL(manager.registerConnection(), false); diff --git a/pdns/test-credentials_cc.cc b/pdns/test-credentials_cc.cc index 89bd6e4a22..d363e6a4fc 100644 --- a/pdns/test-credentials_cc.cc +++ b/pdns/test-credentials_cc.cc @@ -25,6 +25,7 @@ BOOST_AUTO_TEST_CASE(test_CredentialsUtils) BOOST_CHECK(!verifyPassword(hashed, "not test")); BOOST_CHECK(!verifyPassword(sampleHash, "not test")); + BOOST_CHECK(!verifyPassword("test", "test")); BOOST_CHECK(isPasswordHashed(hashed)); BOOST_CHECK(isPasswordHashed(sampleHash)); @@ -43,6 +44,8 @@ BOOST_AUTO_TEST_CASE(test_CredentialsUtils) BOOST_CHECK(!isPasswordHashed("")); // missing leading $ BOOST_CHECK(!isPasswordHashed("scrypt$ln=10,p=1,r=8$1GZ10YdmSGtTmKK9jTH85Q==$JHeICW1mUCnTC+nnULDr7QFQ3kRrZ7u12djruJdrPhI=")); + // prefix-only + BOOST_CHECK(!isPasswordHashed("$scrypt$")); // unknown algo BOOST_CHECK(!isPasswordHashed("$tcrypt$ln=10,p=1,r=8$1GZ10YdmSGtTmKK9jTH85Q==$JHeICW1mUCnTC+nnULDr7QFQ3kRrZ7u12djruJdrPhI=")); // missing parameters