ldb:tests: don't assert the results before doing the final search finished
authorAndrew Bartlett <abartlet@samba.org>
Thu, 15 Jun 2017 01:56:46 +0000 (13:56 +1200)
committerStefan Metzmacher <metze@samba.org>
Sun, 2 Jul 2017 15:35:19 +0000 (17:35 +0200)
This is required to pass the test in future, because
otherwise the clean up will fail because we hold locks.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/ldb/tests/ldb_mod_op_test.c

index fc4b134479752f72a6e2733e216275612ade6701..dedad15fe3a31320c7b1484e3cb3ddafc87800de 100644 (file)
@@ -1335,7 +1335,7 @@ static int test_ldb_search_against_transaction_callback2(struct ldb_request *req
 static int test_ldb_search_against_transaction_callback1(struct ldb_request *req,
                                                         struct ldb_reply *ares)
 {
-       int ret;
+       int ret, ret2;
        int pipes[2];
        char buf[2];
        struct search_against_transaction_ctx *ctx = req->context;
@@ -1430,13 +1430,18 @@ static int test_ldb_search_against_transaction_callback1(struct ldb_request *req
                                   ctx,
                                   test_ldb_search_against_transaction_callback2,
                                   NULL);
-       assert_int_equal(ret, 0);
-       ret = ldb_request(ctx->test_ctx->ldb, req);
+       /*
+        * we don't assert on these return codes until after the search is
+        * finished, or the clean up will fail because we hold locks.
+        */
 
-       if (ret == LDB_SUCCESS) {
-               ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+       ret2 = ldb_request(ctx->test_ctx->ldb, req);
+
+       if (ret2 == LDB_SUCCESS) {
+               ret2 = ldb_wait(req->handle, LDB_WAIT_ALL);
        }
        assert_int_equal(ret, 0);
+       assert_int_equal(ret2, 0);
        assert_int_equal(ctx->res_count, 2);
 
        return LDB_SUCCESS;