Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/mongocxx/lib/mongocxx/v1/auto_encryption_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ auto_encryption_options::internal::to_mongoc(v1::auto_encryption_options const&
libmongoc::auto_encryption_opts_set_encrypted_fields_map(ptr, scoped_bson_view{*opt}.bson());
}

libmongoc::auto_encryption_opts_set_bypass_auto_encryption(ptr, self.bypass_auto_encryption());
libmongoc::auto_encryption_opts_set_bypass_query_analysis(ptr, self.bypass_query_analysis());
if (self.bypass_auto_encryption()) {
libmongoc::auto_encryption_opts_set_bypass_auto_encryption(ptr, true);
}

if (self.bypass_query_analysis()) {
libmongoc::auto_encryption_opts_set_bypass_query_analysis(ptr, true);
}

if (auto const& opt = self.extra_options()) {
libmongoc::auto_encryption_opts_set_extra(ptr, scoped_bson_view{*opt}.bson());
Expand Down
19 changes: 9 additions & 10 deletions src/mongocxx/test/v1/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,13 @@ void test_auto_encryption_opts_bool(
(void)mocks.make(std::move(opts));
}

CHECK(counter == 1);
CHECKED_IF(input) {
CHECK(counter == 1);
}

else {
CHECK(counter == 0);
}
}

template <typename Mock>
Expand Down Expand Up @@ -788,11 +794,7 @@ void test_auto_encryption_opts_doc(
} // namespace

TEST_CASE("auto_encryption_opts", "[mongocxx][v1][client]") {
// Workaround baffling segmentation faults during destruction of the `mocks` local variable when compiled with GCC
// on RHEL 8 ARM64. Not observed on any other target platform. Compiling with Clang or enabling ASAN suppresses this
// runtime error. This issue seems to only affect this specific test case. (???)
std::unique_ptr<client_mocks_type> mocks_owner{new client_mocks_type{}};
auto& mocks = *mocks_owner;
client_mocks_type mocks;

identity_type opts_identity;
auto const opts_id = reinterpret_cast<mongoc_auto_encryption_opts_t*>(&opts_identity);
Expand Down Expand Up @@ -839,10 +841,7 @@ TEST_CASE("auto_encryption_opts", "[mongocxx][v1][client]") {
(void)mocks.make(std::move(opts));
}

// Workaround baffling assertion failure when compiling with GCC on RHEL 8 PPC64LE. Not observed on any other
// target platform. Compiling with Clang or enabling ASAN suppresses this failure. This issue seems to only
// affect this specific test case. (???)
CHECK_NOFAIL(counter == 1);
CHECK(counter == 1);
CHECK(enable_count == 1);
}

Expand Down
6 changes: 1 addition & 5 deletions src/mongocxx/test/v1/pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,7 @@ TEST_CASE("apm_opts", "[mongocxx][v1][pool]") {

// Defer thorough test coverage to v1::client::options.
TEST_CASE("auto_encryption_opts", "[mongocxx][v1][pool]") {
// Workaround baffling segmentation faults during destruction of the `mocks` local variable when compiled with GCC
// on RHEL 8 ARM64. Not observed on any other target platform. Compiling with Clang or enabling ASAN suppresses this
// runtime error. This issue seems to only affect this specific test case. (???)
std::unique_ptr<pool_mocks_type> mocks_owner{new pool_mocks_type{}};
auto& mocks = *mocks_owner;
pool_mocks_type mocks;

identity_type opts_identity;
auto const opts_id = reinterpret_cast<mongoc_auto_encryption_opts_t*>(&opts_identity);
Expand Down