mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 09:57:41 +00:00
[#3927] fixed TLS unit tests
This commit is contained in:
parent
c57d680482
commit
88c7ccee0c
@ -42,6 +42,15 @@ using namespace std;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
/// @brief Check if SSL/TLS support is available and configured.
|
||||||
|
bool hasMySQLTls() {
|
||||||
|
std::string tls = getMySQLTlsEnv();
|
||||||
|
if (tls.empty()) {
|
||||||
|
tls = getMySQLTlsServer();
|
||||||
|
}
|
||||||
|
return (tls == "YES");
|
||||||
|
}
|
||||||
|
|
||||||
class MySqlHostDataSourceTest : public GenericHostDataSourceTest {
|
class MySqlHostDataSourceTest : public GenericHostDataSourceTest {
|
||||||
public:
|
public:
|
||||||
/// @brief Clears the database and opens connection to it.
|
/// @brief Clears the database and opens connection to it.
|
||||||
@ -246,6 +255,13 @@ TEST(MySqlHostDataSource, OpenDatabase) {
|
|||||||
MYSQL_VALID_TYPE, NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)),
|
MYSQL_VALID_TYPE, NULL, VALID_HOST, INVALID_USER, VALID_PASSWORD)),
|
||||||
NoDatabaseName);
|
NoDatabaseName);
|
||||||
|
|
||||||
|
// Check for SSL/TLS support.
|
||||||
|
if (hasMySQLTls()) {
|
||||||
|
EXPECT_NO_THROW(HostMgr::addBackend(connectionString(
|
||||||
|
MYSQL_VALID_TYPE, VALID_NAME, VALID_HOST_TCP, VALID_SECURE_USER,
|
||||||
|
VALID_PASSWORD, 0, 0, VALID_CERT, VALID_KEY, VALID_CA, VALID_CIPHER)));
|
||||||
|
}
|
||||||
|
|
||||||
// Tidy up after the test
|
// Tidy up after the test
|
||||||
destroyMySQLSchema();
|
destroyMySQLSchema();
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,15 @@ using namespace std;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
/// @brief Check if SSL/TLS support is available and configured.
|
||||||
|
bool hasMySQLTls() {
|
||||||
|
std::string tls = getMySQLTlsEnv();
|
||||||
|
if (tls.empty()) {
|
||||||
|
tls = getMySQLTlsServer();
|
||||||
|
}
|
||||||
|
return (tls == "YES");
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Test fixture class for testing MySQL Lease Manager
|
/// @brief Test fixture class for testing MySQL Lease Manager
|
||||||
///
|
///
|
||||||
/// Opens the database prior to each test and closes it afterwards.
|
/// Opens the database prior to each test and closes it afterwards.
|
||||||
@ -206,6 +215,13 @@ TEST(MySqlOpenTest, OpenDatabase) {
|
|||||||
MYSQL_VALID_TYPE, NULL, VALID_HOST, VALID_USER, VALID_PASSWORD)),
|
MYSQL_VALID_TYPE, NULL, VALID_HOST, VALID_USER, VALID_PASSWORD)),
|
||||||
NoDatabaseName);
|
NoDatabaseName);
|
||||||
|
|
||||||
|
// Check for SSL/TLS support.
|
||||||
|
if (hasMySQLTls()) {
|
||||||
|
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
|
||||||
|
MYSQL_VALID_TYPE, VALID_NAME, VALID_HOST_TCP, VALID_SECURE_USER,
|
||||||
|
VALID_PASSWORD, 0, 0, VALID_CERT, VALID_KEY, VALID_CA, VALID_CIPHER)));
|
||||||
|
}
|
||||||
|
|
||||||
// Check for extended info tables.
|
// Check for extended info tables.
|
||||||
const char* EX_INFO = "extended-info-tables=true";
|
const char* EX_INFO = "extended-info-tables=true";
|
||||||
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
|
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
|
||||||
|
@ -42,6 +42,15 @@ using namespace std;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
/// @brief Check if SSL/TLS support is available and configured.
|
||||||
|
bool hasPgSQLTls() {
|
||||||
|
std::string tls = getPgSQLTlsEnv();
|
||||||
|
if (tls.empty()) {
|
||||||
|
tls = getPgSQLTlsServer();
|
||||||
|
}
|
||||||
|
return (tls == "YES");
|
||||||
|
}
|
||||||
|
|
||||||
class PgSqlHostDataSourceTest : public GenericHostDataSourceTest {
|
class PgSqlHostDataSourceTest : public GenericHostDataSourceTest {
|
||||||
public:
|
public:
|
||||||
/// @brief Clears the database and opens connection to it.
|
/// @brief Clears the database and opens connection to it.
|
||||||
@ -245,9 +254,11 @@ TEST(PgSqlHostDataSource, OpenDatabase) {
|
|||||||
NoDatabaseName);
|
NoDatabaseName);
|
||||||
|
|
||||||
// Check for SSL/TLS support.
|
// Check for SSL/TLS support.
|
||||||
EXPECT_NO_THROW(HostMgr::addBackend(connectionString(
|
if (hasPgSQLTls()) {
|
||||||
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD,
|
EXPECT_NO_THROW(HostMgr::addBackend(connectionString(
|
||||||
0, 0, 0, 0, VALID_CA)));
|
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST_TCP, VALID_SECURE_USER,
|
||||||
|
VALID_PASSWORD, 0, 0, VALID_CERT, VALID_KEY, VALID_CA, VALID_CIPHER)));
|
||||||
|
}
|
||||||
|
|
||||||
// Tidy up after the test
|
// Tidy up after the test
|
||||||
destroyPgSQLSchema();
|
destroyPgSQLSchema();
|
||||||
|
@ -40,6 +40,15 @@ using namespace std;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
/// @brief Check if SSL/TLS support is available and configured.
|
||||||
|
bool hasPgSQLTls() {
|
||||||
|
std::string tls = getPgSQLTlsEnv();
|
||||||
|
if (tls.empty()) {
|
||||||
|
tls = getPgSQLTlsServer();
|
||||||
|
}
|
||||||
|
return (tls == "YES");
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Test fixture class for testing PostgreSQL Lease Manager
|
/// @brief Test fixture class for testing PostgreSQL Lease Manager
|
||||||
///
|
///
|
||||||
/// Opens the database prior to each test and closes it afterwards.
|
/// Opens the database prior to each test and closes it afterwards.
|
||||||
@ -210,9 +219,11 @@ TEST(PgSqlOpenTest, OpenDatabase) {
|
|||||||
NoDatabaseName);
|
NoDatabaseName);
|
||||||
|
|
||||||
// Check for SSL/TLS support.
|
// Check for SSL/TLS support.
|
||||||
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
|
if (hasPgSQLTls()) {
|
||||||
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD,
|
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
|
||||||
0, 0, 0, 0, VALID_CA)));
|
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST_TCP, VALID_SECURE_USER,
|
||||||
|
VALID_PASSWORD, 0, 0, VALID_CERT, VALID_KEY, VALID_CA, VALID_CIPHER)));
|
||||||
|
}
|
||||||
|
|
||||||
// Check for extended info tables.
|
// Check for extended info tables.
|
||||||
const char* EX_INFO = "extended-info-tables=true";
|
const char* EX_INFO = "extended-info-tables=true";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user