Skip to content

Commit 35312fa

Browse files
committed
CDRIVER-735 fix aggregate test
A reused index variable meant not all of the test was ever run. Also, remove some test code for MongoDB 2.0, now long obsolete, that might have masked future regressions.
1 parent 4340881 commit 35312fa

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

tests/test-mongoc-collection.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ test_aggregate (void)
11981198
bson_t *pipeline;
11991199
bson_t *b;
12001200
bson_iter_t iter;
1201-
int i;
1201+
int i, j;
12021202

12031203
client = test_framework_client_new ();
12041204
ASSERT (client);
@@ -1236,20 +1236,13 @@ test_aggregate (void)
12361236
bson_destroy (&opts);
12371237
}
12381238

1239-
for (i = 0; i < 2; i++) {
1240-
/*
1241-
* This can fail if we are connecting to a 2.0 MongoDB instance.
1242-
*/
1239+
for (j = 0; j < 2; j++) {
12431240
r = mongoc_cursor_next(cursor, &doc);
12441241
if (mongoc_cursor_error(cursor, &error)) {
1245-
if ((error.domain == MONGOC_ERROR_QUERY) &&
1246-
(error.code == MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND)) {
1247-
mongoc_cursor_destroy (cursor);
1248-
break;
1249-
}
1250-
12511242
fprintf (stderr, "[%d.%d] %s",
12521243
error.domain, error.code, error.message);
1244+
1245+
abort ();
12531246
}
12541247

12551248
ASSERT (r);
@@ -1262,7 +1255,9 @@ test_aggregate (void)
12621255
r = mongoc_cursor_next(cursor, &doc);
12631256
if (mongoc_cursor_error(cursor, &error)) {
12641257
fprintf (stderr, "%s", error.message);
1258+
abort ();
12651259
}
1260+
12661261
ASSERT (!r);
12671262
ASSERT (!doc);
12681263

0 commit comments

Comments
 (0)