diff --git a/src/mongocxx/lib/mongocxx/v1/auto_encryption_options.cpp b/src/mongocxx/lib/mongocxx/v1/auto_encryption_options.cpp index 9476fc165b..05161f021b 100644 --- a/src/mongocxx/lib/mongocxx/v1/auto_encryption_options.cpp +++ b/src/mongocxx/lib/mongocxx/v1/auto_encryption_options.cpp @@ -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()); diff --git a/src/mongocxx/test/v1/client.cpp b/src/mongocxx/test/v1/client.cpp index 8d15e5c948..4f5ae10463 100644 --- a/src/mongocxx/test/v1/client.cpp +++ b/src/mongocxx/test/v1/client.cpp @@ -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 @@ -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 mocks_owner{new client_mocks_type{}}; - auto& mocks = *mocks_owner; + client_mocks_type mocks; identity_type opts_identity; auto const opts_id = reinterpret_cast(&opts_identity); @@ -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); } diff --git a/src/mongocxx/test/v1/pool.cpp b/src/mongocxx/test/v1/pool.cpp index 414be19bd9..c0af1465c7 100644 --- a/src/mongocxx/test/v1/pool.cpp +++ b/src/mongocxx/test/v1/pool.cpp @@ -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 mocks_owner{new pool_mocks_type{}}; - auto& mocks = *mocks_owner; + pool_mocks_type mocks; identity_type opts_identity; auto const opts_id = reinterpret_cast(&opts_identity);