Merge lp:~yolanda.robla/ubuntu/saucy/openldap/dep-8-tests into lp:ubuntu/saucy/openldap

Proposed by Yolanda Robla
Status: Needs review
Proposed branch: lp:~yolanda.robla/ubuntu/saucy/openldap/dep-8-tests
Merge into: lp:ubuntu/saucy/openldap
Diff against target: 368 lines (+61/-222)
8 files modified
debian/changelog (+6/-0)
debian/control (+1/-0)
debian/tests/check_upgradepath (+0/-173)
debian/tests/control (+3/-0)
debian/tests/dict/random_words (+25/-0)
debian/tests/find_unused_functions (+0/-30)
debian/tests/hammer_slapd (+11/-19)
debian/tests/slapd (+15/-0)
To merge this branch: bzr merge lp:~yolanda.robla/ubuntu/saucy/openldap/dep-8-tests
Reviewer Review Type Date Requested Status
Martin Pitt Needs Fixing
Review via email: mp+164944@code.launchpad.net

Description of the change

Added dep-8-tests
Recheck, reworked openldap tests to use static list, with UTF-8 chars

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

> * d/tests: added dep-8-tests

Can you please describe why the existing files were removed, and which functional changes were done to debian/tests/hammer_slapd?

Also, please write "debian/tests", and "autopkgtest" instead of "dep-8-tests" (I did that in your other MPs).

Otherwise, the tests pass with "run-adt-test -sS lp:~yolanda.robla/ubuntu/saucy/openldap/dep-8-tests openldap".

Thanks!

review: Needs Fixing
Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

I removed existing dict because the size was very huge. I created a custom dict with randon words, that included some UTF-8 chars in order to test that functionality also.

59. By Yolanda Robla

debian/tests: added autopkgtests

Unmerged revisions

59. By Yolanda Robla

debian/tests: added autopkgtests

58. By Yolanda Robla

added extra tests

57. By Yolanda Robla

d/tests: added dep-8-tests

56. By Yolanda Robla

added dep-8-tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-08-20 08:46:02 +0000
3+++ debian/changelog 2013-05-28 15:23:25 +0000
4@@ -1,3 +1,9 @@
5+openldap (2.4.31-1ubuntu3) saucy; urgency=low
6+
7+ * debian/tests: added autopkgtests
8+
9+ -- Yolanda <yolanda.robla@canonical.com> Tue, 21 May 2013 18:31:24 +0200
10+
11 openldap (2.4.31-1ubuntu2) quantal-proposed; urgency=low
12
13 * debian/slapd.py: Add AppArmor info and logs to apport hook.
14
15=== modified file 'debian/control'
16--- debian/control 2012-07-18 13:29:46 +0000
17+++ debian/control 2013-05-28 15:23:25 +0000
18@@ -22,6 +22,7 @@
19 Homepage: http://www.openldap.org/
20 Vcs-Svn: svn://svn.debian.org/pkg-openldap/openldap/trunk
21 Vcs-Browser: http://svn.debian.org/wsvn/pkg-openldap/openldap/trunk
22+XS-Testsuite: autopkgtest
23
24 Package: slapd
25 Section: net
26
27=== removed file 'debian/tests/check_upgradepath'
28--- debian/tests/check_upgradepath 2009-02-18 18:44:00 +0000
29+++ debian/tests/check_upgradepath 1970-01-01 00:00:00 +0000
30@@ -1,173 +0,0 @@
31-#! /bin/sh
32-
33-set -e
34-
35-# WARNING: This script is obsolete and will require a fair bit of work to get
36-# working again. It assumes woody, uses debconf questions that don't exist
37-# any more, and probably doesn't check everything that you would want to
38-# check. Preserved just because I haven't done the work to see if puiparts
39-# can now do the same thing in a cleaner way.
40-
41-# Setup
42-: ${chroot_dir:=../chroot}
43-: ${debmirror:=http://ftp.de.debian.org/debian}
44-: ${proxy:=http://proxy.galaxy:3128/}
45-unset LC_ALL
46-unset LC_CTYPE
47-unset LC_MESSAGES
48-# XXX: comment out when testing new versions. Needed so libc6 does not
49-# ask for restarting services.
50-export DEBIAN_FRONTEND=noninteractive
51-
52-woodytar=$chroot_dir/woody_base.tar.gz
53-
54-# List our packages
55-list_packages() {
56- local p ver
57- ver=`dpkg-parsechangelog|sed -ne 's/^Version: //p'`
58- for p in `dh_listpackages`; do
59- (cd .. && echo ${p}_$ver*deb)
60- done
61-}
62-
63-# Run a command inside the chroot
64-
65-in_target() {
66- chroot $chroot_dir/woody "$@"
67-}
68-
69-# Set a debconf variable inside the chroot
70-
71-debconf_set() {
72- local name=$1
73- shift
74- cat >>$chroot_dir/woody/var/cache/debconf/config.dat <<EOF
75-Name: $name
76-Template: $name
77-Flags: seen
78-Value: $@
79-
80-EOF
81-}
82-
83-# Setup a woody chroot
84-
85-setup_chroot() {
86- # Kill an existing chroot
87- rm -Rf $chroot_dir/woody
88-
89- # If there is a tar archive with a base system we use it
90- if [ -e $woodytar ]; then
91- mkdir $chroot_dir/woody
92- echo -n "Unpacking system from $woodytar"
93- tar -C $chroot_dir/woody -xzf $woodytar
94- echo "done."
95- # Otherwise we need to create a new base system and save it
96- # to a tar for the next time
97- else
98- debootstrap woody $chroot_dir/woody $debmirror | \
99- shtool prop -p "Creating base system from $debmirror"
100- tar -C $chroot_dir/woody -czvf $woodytar . | \
101- shtool prop -p "Saving system to $woodytar"
102- fi
103-
104- # Install a suitable apt configuration
105- echo "deb $debmirror woody main" \
106- > $chroot_dir/woody/etc/apt/sources.list
107- echo "Acquire::HTTP::Proxy \"$proxy\";" \
108- > $chroot_dir/woody/etc/apt/apt.conf
109- in_target apt-get update
110- in_target mount -t proc none /proc
111-
112- # We don't want any debconf interaction
113- #debconf_set debconf/frontend Noninteractive
114-}
115-
116-# These are our example configurations for testing the upgrade
117-
118-conf_domain_or_host() {
119- debconf_set slapd/fill_method auto
120- debconf_set slapd/suffix_type "domain or host"
121- debconf_set slapd/domain "some.example.net"
122- debconf_set slapd/replicate false
123- debconf_set shared/organization Some Organization
124-}
125-
126-
127-check_domain_or_host() {
128- sleep 2 # wait for slapd to startup
129- in_target ldapsearch -h localhost -b dc=some,dc=example,dc=net -x \
130- objectclass=\*
131-}
132-
133-conf_location() {
134- debconf_set slapd/fill_method auto
135- debconf_set slapd/suffix_type "location"
136- debconf_set shared/locale/countrycode de
137- debconf_set shared/organization "Sample Organization"
138- debconf_set slapd/replicate false
139- debconf_set shared/organization Some Organization
140-}
141-
142-check_location() {
143- sleep 2 # wait for slapd to startup
144- in_target ldapsearch -h localhost -b "o=Some Organization, c=de" \
145- -x objectclass=\*
146-}
147-# Install slapd inside the chroot
148-
149-install_slapd() {
150- in_target apt-get -y install slapd ldap-utils
151-}
152-
153-# Do an upgrade of our packages inside the chroot
154-
155-upgrade() {
156- # Link our packages into the chroot
157- for p in `list_packages`; do
158- ln ../$p $chroot_dir/woody/root/
159- done
160-
161- # Create a packages file
162- (cd $chroot_dir/woody/root && dpkg-scanpackages . /dev/null >Packages)
163-
164- # Switch to unstable
165- echo "deb $debmirror unstable main" \
166- > $chroot_dir/woody/etc/apt/sources.list
167- echo "deb file:/root ./" >> $chroot_dir/woody/etc/apt/sources.list
168-
169- # Update package lists
170- in_target apt-get update
171-
172- # Tell our scripts to fix the config
173- debconf_set slapd/fix_directory true
174- debconf_set slapd/password1 foobar
175- debconf_set slapd/allow_ldap_v2
176-
177- # Do an upgrade of our packages
178- in_target apt-get install -y `dh_listpackages`
179-}
180-
181-# Checks if upgrading a woody system with slapd configured with the
182-# command given works.
183-
184-check_upgrade() {
185- setup_chroot
186- conf_$1
187- debconf_set slapd/password1 foobar
188- debconf_set slapd/password2 foobar
189- install_slapd
190- check_$1
191- upgrade
192- check_$1
193- in_target /etc/init.d/slapd stop
194- in_target umount /proc
195-}
196-
197-# Try upgrading our example setups
198-
199-for i in location domain_or_host; do
200- check_upgrade $i
201-done
202-
203-echo "SUCCESS testing upgrading from woody"
204
205=== added file 'debian/tests/control'
206--- debian/tests/control 1970-01-01 00:00:00 +0000
207+++ debian/tests/control 2013-05-28 15:23:25 +0000
208@@ -0,0 +1,3 @@
209+Tests: slapd create_account hammer_slapd
210+Depends: libnet-ldap-perl
211+Restrictions: needs-root
212
213=== added directory 'debian/tests/dict'
214=== added file 'debian/tests/dict/random_words'
215--- debian/tests/dict/random_words 1970-01-01 00:00:00 +0000
216+++ debian/tests/dict/random_words 2013-05-28 15:23:25 +0000
217@@ -0,0 +1,25 @@
218+Aarón
219+Abraham
220+África
221+Alžběta
222+Barney
223+Blažej
224+Bryce
225+Christy
226+Elise
227+Gabriel
228+Homer
229+Kevin
230+Mary
231+Ramón
232+Robin
233+Susan
234+Tom
235+Will's
236+Zen
237+张
238+芳
239+Алиса
240+Камилла
241+Вадим
242+Тимур
243
244=== removed file 'debian/tests/find_unused_functions'
245--- debian/tests/find_unused_functions 2009-02-18 18:44:00 +0000
246+++ debian/tests/find_unused_functions 1970-01-01 00:00:00 +0000
247@@ -1,30 +0,0 @@
248-#! /usr/bin/perl -w
249-
250-use autouse Data::Dumper, qw{Dumper};
251-
252-# Script to find the unused shell functions in slapd.scripts-common
253-
254-our @code;
255-
256-# Get all shell code from maintainer scripts
257-
258-foreach my $file ((<slapd.*rm>, <slapd.*inst>, <slapd.config>,
259- <slapd.scripts-common>)) {
260- open SCRIPT, "<$file" or
261- die "Can't open $file: $!";
262- push @code, <SCRIPT>;
263- close SCRIPT;
264-}
265-
266-# Find all function declarations
267-
268-our @functions = map { /^(\w+)\s*\(\).*$/; } @code;
269-
270-# Find unused functions
271-
272-foreach $function (@functions) {
273- @occurences = grep /$function/, @code;
274- @invocations = grep { !/^$function\s*\(\)/ and !/#.*$function/ }
275- @occurences;
276- print "$function\n" if @invocations == 0;
277-}
278
279=== modified file 'debian/tests/hammer_slapd'
280--- debian/tests/hammer_slapd 2009-02-18 18:44:00 +0000
281+++ debian/tests/hammer_slapd 2013-05-28 15:23:25 +0000
282@@ -2,6 +2,7 @@
283
284 use Net::LDAP;
285 use Data::Dumper;
286+use File::Basename;
287
288 $host = "localhost"; # LDAP server
289 $basedn = "dc=galaxy"; # Base DN
290@@ -23,28 +24,19 @@
291 }
292 }
293
294-sub invent_name {
295+sub invent_names {
296+ our @names;
297 our @words;
298 unless (@words) {
299- open WORDS, "/usr/share/dict/british-english-large";
300+ open WORDS, dirname(__FILE__)."/dict/random_words" or die "Can't open dictionary";
301 @words = grep /^[A-Z]\w{0,11}$/, <WORDS>;
302 map { chomp } @words;
303 close WORDS;
304 }
305
306- my $index = int(rand(@words));
307- $index = int(rand(@words)) while not defined $words[$index];
308- my $word = $words[$index];
309- delete $words[$index];
310- return $word;
311-}
312-
313-sub invent_names {
314- our @names;
315-
316- foreach (1..1000) {
317- push @names, { cn => invent_name, sn => invent_name };
318- }
319+ foreach (@words) {
320+ push @names, { cn => $_, sn => $_ };
321+ }
322 }
323
324 sub create_entries {
325@@ -61,11 +53,11 @@
326 my $login = $id{cn};
327 $login =~ tr/A-Z/a-z/;
328 $ldap->add("uid=$login, ou=$group, $basedn", attr => [
329- %id,
330- objectClass => [ "top", "person", "posixAccount" ],
331+ %id,
332+ objectClass => [ "top", "person", "posixAccount" ],
333 uid => $login,
334 uidNumber => $uid++,
335- gidNumber => 1000,
336+ gidNumber => 1000,
337 homeDirectory => "/home/$login" ]);
338 }
339
340@@ -83,7 +75,7 @@
341 }
342
343 sub search_entries {
344- foreach (1..10000) {
345+ foreach (1..1000) {
346 my $num = int(rand(@names));
347 $login = $names[$num]->{cn};
348 $login =~ tr/A-Z/a-z/;
349
350=== added file 'debian/tests/slapd'
351--- debian/tests/slapd 1970-01-01 00:00:00 +0000
352+++ debian/tests/slapd 2013-05-28 15:23:25 +0000
353@@ -0,0 +1,15 @@
354+#!/bin/bash
355+#--------------
356+# Testing slapd
357+#--------------
358+set -e
359+
360+debconf-set-selections <<< "slapd slapd/password1 password foo" 2>&1
361+debconf-set-selections <<< "slapd slapd/internal/adminpw password foo" 2>&1
362+debconf-set-selections <<< "slapd slapd/password2 password foo" 2>&1
363+debconf-set-selections <<< "slapd slapd/domain string galaxy" 2>&1
364+
365+DEBIAN_FRONTEND=noninteractive aptitude install -q -y slapd 2>&1
366+
367+perl `dirname $0`/create_account 2>&1
368+perl `dirname $0`/hammer_slapd 2>&1

Subscribers

People subscribed via source and target branches

to all changes: