Skip to content

Commit 2de0ad1

Browse files
committed
CXX-1167 Fix broken SSL testing
The unit tests to confirm that a pool could be configured with SSL options never ran because the tests were guarded by a private definition that was never included. This also concealed a bug where mocking failed because the necessary private header wasn't included in a test helper header. This commit adds the private header to the test helper header to fix mocking and runs the SSL pool configuration test unconditionally if MONGOC_ENABLE_SSL is configured. I manually verified that this commit would have caught the original CXX-1163 bug. Backported from CXX-1163.
1 parent 8733f25 commit 2de0ad1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/mongocxx/test/pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ TEST_CASE("a pool is created with the correct MongoDB URI", "[pool]") {
5858
REQUIRE(destroy_called);
5959
}
6060

61-
#if defined(MONGOCXX_ENABLE_SSL) && defined(MONGOC_ENABLE_SSL)
61+
#if defined(MONGOC_ENABLE_SSL)
6262
TEST_CASE(
6363
"If we pass an engaged SSL options struct to the pool class, we will use it to configure the "
6464
"underlying mongoc pool",

src/third_party/catch/include/helpers.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#pragma once
1616

1717
#include <mongocxx/private/libmongoc.hh>
18+
#include <mongocxx/config/private/prelude.hh>
1819

1920
#define CHECK_OPTIONAL_ARGUMENT(OBJECT, NAME, VALUE) \
2021
SECTION("has NAME disengaged") { \
@@ -229,3 +230,5 @@
229230
libmongoc::read_prefs_set_max_staleness_seconds.create_instance(); \
230231
auto read_prefs_set_mode = libmongoc::read_prefs_set_mode.create_instance(); \
231232
auto read_prefs_set_tags = libmongoc::read_prefs_set_tags.create_instance();
233+
234+
#include <mongocxx/config/private/postlude.hh>

0 commit comments

Comments
 (0)