Only test for/missing warnings when explicitly requested
@@ -113,7 +113,9 @@ static void
test_connection_uri_cb (bson_t *scenario)
{
bson_iter_t iter;
+ bson_iter_t descendent;
bson_iter_t tests_iter;
+ bson_iter_t warning_iter;
const char *uri_string = NULL;
bson_t hosts = BSON_INITIALIZER;
bson_t auth = BSON_INITIALIZER;
@@ -161,11 +163,17 @@ test_connection_uri_cb (bson_t *scenario)
capture_logs (true);
run_uri_test (uri_string, valid, &hosts, &auth, &options);
- if (bson_lookup_bool_null_ok (&test_case, "warning", false)) {
+
+ bson_iter_init (&warning_iter, &test_case);
+
+ if (bson_iter_find_descendant (&warning_iter, "warning", &descendent) &&
+ BSON_ITER_HOLDS_BOOL (&descendent)) {
+ if (bson_iter_as_bool (&descendent)) {
ASSERT_CAPTURED_LOG ("mongoc_uri", MONGOC_LOG_LEVEL_WARNING, "");
} else {
ASSERT_NO_CAPTURED_LOGS ("mongoc_uri");
}
+ }
bson_reinit (&hosts);
bson_reinit (&auth);
