Remove an unreliable cancelling test

This commit is contained in:
Petr Písař 2019-04-25 14:32:37 +02:00
parent 1d45cc9072
commit bb00c21318
2 changed files with 72 additions and 1 deletions

View File

@ -9,7 +9,7 @@
Name: perl-LDAP
Version: 0.66
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
Summary: LDAP Perl module
License: GPL+ or Artistic
@ -17,6 +17,8 @@ URL: https://metacpan.org/release/perl-ldap
Source0: https://cpan.metacpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-%{version}.tar.gz
# Optional tests need to know a location of an LDAP server executable
Patch0: perl-ldap-0.65-Configure-usr-sbin-slapd-for-tests.patch
# Remove an unreliable cancelling test
Patch1: perl-ldap-0.66-test-Remove-a-test-for-cancelling-asynchronous-calls.patch
BuildArch: noarch
BuildRequires: perl-interpreter
BuildRequires: perl-generators
@ -110,6 +112,7 @@ project.
%prep
%setup -q -n perl-ldap-%{version}
%patch0 -p1
%patch1 -p1
chmod -c 644 bin/* contrib/* lib/Net/LDAP/DSML.pm
perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/*
# Remove bundled libraries
@ -146,6 +149,9 @@ make test
%endif
%changelog
* Thu Apr 25 2019 Petr Pisar <ppisar@redhat.com> - 1:0.66-2
- Remove an unreliable cancelling test
* Tue Apr 16 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1:0.66-1
- 0.66 bump

View File

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