bb00c21
From 5a2388c895cfd7db5f6ca1cc4acb062dfde336bf Mon Sep 17 00:00:00 2001
bb00c21
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
bb00c21
Date: Thu, 25 Apr 2019 14:23:55 +0200
bb00c21
Subject: [PATCH] test: Remove a test for cancelling asynchronous calls
bb00c21
MIME-Version: 1.0
bb00c21
Content-Type: text/plain; charset=UTF-8
bb00c21
Content-Transfer-Encoding: 8bit
bb00c21
bb00c21
t/60cancel.t performed a racy test when it started an asynchronous query, then
bb00c21
it canceled it and tested that the cancelling succeeded. However, if a server
bb00c21
finished the search before the cancelling order was issued, the cancel itself
bb00c21
failed because it referred an not running and thus then nonexisting query:
bb00c21
bb00c21
    t/60cancel.t .. 1/7
bb00c21
    #   Failed test 'cancel a running operation: 119: message ID not found'
bb00c21
    #   at t/60cancel.t line 63.
bb00c21
    # This test may have failed because the server was too fast
bb00c21
bb00c21
The race was actually admitted in the diag message.
bb00c21
bb00c21
This patch removes the unreliable test to prevent from false negatives.
bb00c21
bb00c21
Signed-off-by: Petr Písař <ppisar@redhat.com>
bb00c21
---
bb00c21
 t/60cancel.t | 17 +----------------
bb00c21
 1 file changed, 1 insertion(+), 16 deletions(-)
bb00c21
bb00c21
diff --git a/t/60cancel.t b/t/60cancel.t
bb00c21
index c72bfa5..8a3074c 100644
bb00c21
--- a/t/60cancel.t
bb00c21
+++ b/t/60cancel.t
bb00c21
@@ -11,7 +11,7 @@ BEGIN { require "t/common.pl" }
bb00c21
 
bb00c21
 
bb00c21
 start_server()
bb00c21
-? plan tests => 7
bb00c21
+? plan tests => 6
bb00c21
 : plan skip_all => 'no server';
bb00c21
 
bb00c21
 
bb00c21
@@ -47,21 +47,6 @@ SKIP: {
bb00c21
   # cancel the finished search => should fail
bb00c21
   $cancel = $ldap->cancel($search);
bb00c21
   ok($cancel->code, "cancel a finished operation: " . $cancel->code . ": " . $cancel->error);
bb00c21
-
bb00c21
-  # switch to async mode
bb00c21
-  $ldap->async(1);
bb00c21
-
bb00c21
-  # perform a search (asynchronously)
bb00c21
-  $search = $ldap->search(
bb00c21
-                       base     => $BASEDN,
bb00c21
-                       filter   => '(objectclass=*)',
bb00c21
-                       callback => \&process_entry, # Call this sub for each entry
bb00c21
-                     );
bb00c21
-
bb00c21
-  # cancel the running search => should work [may fail, as it depends on the server's speed]
bb00c21
-  $cancel = $ldap->cancel($search);
bb00c21
-  ok(!$cancel->code, "cancel a running operation: " . $cancel->code . ": " . $cancel->error)
bb00c21
-    or diag("This test may have failed because the server was too fast");
bb00c21
 }
bb00c21
 
bb00c21
 
bb00c21
-- 
bb00c21
2.20.1
bb00c21