Perform tests against a server

This commit is contained in:
Petr Písař 2019-04-04 16:12:58 +02:00
parent 18a94fca9b
commit bdfb8050f2
3 changed files with 118 additions and 1 deletions

View File

@ -1,3 +1,6 @@
# Perform optional tests
%bcond_without perl_LDAP_enables_optional_test
Name: perl-LDAP Name: perl-LDAP
Version: 0.65 Version: 0.65
Release: 13%{?dist} Release: 13%{?dist}
@ -8,6 +11,10 @@ URL: https://metacpan.org/release/perl-ldap
Source0: https://cpan.metacpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-%{version}.tar.gz
# Correct misspellings in Net::LDAP::FAQ, in upstream after 0.65 # Correct misspellings in Net::LDAP::FAQ, in upstream after 0.65
Patch0: perl-ldap-0.65-Correct-misspellings.patch Patch0: perl-ldap-0.65-Correct-misspellings.patch
# Optional tests need to know a location of an LDAP server executable
Patch1: perl-ldap-0.65-Configure-usr-sbin-slapd-for-tests.patch
# Adapt tests to openldap-2.4.46, CPAN RT#129021
Patch2: perl-ldap-0.65-Remove-facsimileNumberMatch-rule-from-2.5.4.23-OID-i.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
BuildRequires: perl-generators BuildRequires: perl-generators
@ -28,7 +35,9 @@ BuildRequires: perl(Exporter)
# Not needed for tests perl(HTTP::Status) # Not needed for tests perl(HTTP::Status)
BuildRequires: perl(IO::Select) BuildRequires: perl(IO::Select)
BuildRequires: perl(IO::Socket) BuildRequires: perl(IO::Socket)
# Not needed for tests perl(IO::Socket::SSL) >= 1.26 %if %{with perl_LDAP_enables_optional_test}
BuildRequires: perl(IO::Socket::SSL) >= 1.26
%endif
# Not needed for tests perl(JSON) # Not needed for tests perl(JSON)
# Not needed for tests perl(LWP::MediaTypes) # Not needed for tests perl(LWP::MediaTypes)
# Not needed for tests perl(LWP::Protocol) # Not needed for tests perl(LWP::Protocol)
@ -50,6 +59,11 @@ BuildRequires: perl(File::Path)
BuildRequires: perl(File::Spec) BuildRequires: perl(File::Spec)
BuildRequires: perl(IO::File) BuildRequires: perl(IO::File)
BuildRequires: perl(Test::More) BuildRequires: perl(Test::More)
%if %{with perl_LDAP_enables_optional_test}
# Optional tests:
BuildRequires: openldap-servers
BuildRequires: perl(LWP::UserAgent)
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Authen::SASL) >= 2.00 Requires: perl(Authen::SASL) >= 2.00
Requires: perl(Convert::ASN1) >= 0.2 Requires: perl(Convert::ASN1) >= 0.2
@ -73,6 +87,8 @@ maintenance functions such as adding, deleting or modifying entries.
%prep %prep
%setup -q -n perl-ldap-%{version} %setup -q -n perl-ldap-%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch2 -p1
chmod -c 644 bin/* contrib/* lib/Net/LDAP/DSML.pm chmod -c 644 bin/* contrib/* lib/Net/LDAP/DSML.pm
perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/* perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/*
# Remove bundled libraries # Remove bundled libraries
@ -103,6 +119,7 @@ make test
%changelog %changelog
* Thu Apr 04 2019 Petr Pisar <ppisar@redhat.com> - 1:0.65-13 * Thu Apr 04 2019 Petr Pisar <ppisar@redhat.com> - 1:0.65-13
- Correct misspellings in Net::LDAP::FAQ - Correct misspellings in Net::LDAP::FAQ
- Perform tests against a server
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.65-12 * Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.65-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

View File

@ -0,0 +1,58 @@
From d35a08a77306210ed95a797d5a6ed1160df84b95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 4 Apr 2019 17:03:01 +0200
Subject: [PATCH] Configure /usr/sbin/slapd for tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The tests need to know slapd executable file name.
The tests uses sssvlv overlay without loading its module. That's maybe
for statically built openldap. However, we have a dynamically built
server and we want to rely on a default module path because it varies
among architectures. Thus we just uncomment loading the module.
Also enable SSL and IPC tests.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
data/slapd.conf.in | 2 +-
test.cfg | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/data/slapd.conf.in b/data/slapd.conf.in
index c6c06a3..3c7b6fb 100644
--- a/data/slapd.conf.in
+++ b/data/slapd.conf.in
@@ -11,7 +11,7 @@ include $SLAPD_SCHEMA_DIR/openldap.schema
# get required dynmaic modules
#modulepath $SLAPD_MODULE_DIR
#moduleload back_$SLAPD_DB
-#moduleload sssvlv
+moduleload sssvlv
# PID & args file
pidfile $TESTDB/slapd.pid
diff --git a/test.cfg b/test.cfg
index 0f951f6..ea5a50c 100644
--- a/test.cfg
+++ b/test.cfg
@@ -4,12 +4,12 @@
# Set this to the full path of your LDAP server executable
# (e.g '/usr/sbin/slapd')
-$SERVER_EXE = '<path to ldap server executable>';
+$SERVER_EXE = '/usr/sbin/slapd';
# This should be one of
# * openldap[+ssl][+ipc][+sasl]
# options are appended with '+' signs
-$SERVER_TYPE = 'openldap';
+$SERVER_TYPE = 'openldap+ssl+ipc';
# Change this if your host cannot be contacted as localhost
# Some tests may fail if the name does not resolve to an IPv4 and an IPv6 address
--
2.20.1

View File

@ -0,0 +1,42 @@
From 3c8cc66320d9cb909cc8bea043280cace8bb5ff0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 4 Apr 2019 17:44:39 +0200
Subject: [PATCH] Remove facsimileNumberMatch rule from 2.5.4.23 OID in core
schema
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When running tests that need an LDAP server, the tests fail because the server dies.
It's because my openldap-2.4.46 reports a syntax error in ./data/core.schema:
$ /usr/sbin/slapd -f ./temp/slapd.conf -h ldap://localhost:9009/ -d 64
[...]
5ca625e4 ./data/core.schema: line 192 (attributetype ( 2.5.4.23 NAME ( 'facsimileTelephoneNumber' 'fax' ) DESC 'RFC2256: Facsimile (Fax) Telephone Number' EQUALITY facsimileNumberMatch SUBSTR facsimileNumberSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.22 ))
5ca625e4 ./data/core.schema: line 192 attributetype: MatchingRule not found: "facsimileNumberMatch"
This patch removes the offending matching rule because facsimileNumberMatch is
nowhere defined in the schema. (Maybe it was built into previous openldap
versions and removed later).
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
data/core.schema | 2 --
1 file changed, 2 deletions(-)
diff --git a/data/core.schema b/data/core.schema
index fd89c58..4e57898 100644
--- a/data/core.schema
+++ b/data/core.schema
@@ -187,8 +187,6 @@ attributetype ( 2.5.4.22 NAME 'teletexTerminalIdentifier'
attributetype ( 2.5.4.23 NAME ( 'facsimileTelephoneNumber' 'fax' )
DESC 'RFC2256: Facsimile (Fax) Telephone Number'
- EQUALITY facsimileNumberMatch
- SUBSTR facsimileNumberSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.22 )
attributetype ( 2.5.4.24 NAME 'x121Address'
--
2.20.1