Skip to content

Commit 857e692

Browse files
author
Bertrand Gouny
committed
news tests
1 parent e7efbce commit 857e692

File tree

19 files changed

+102
-95
lines changed

19 files changed

+102
-95
lines changed

β€Žtest.shβ€Ž

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,14 @@
22

33
# Usage
44
#Β sudo ./test.sh
5-
# add -v for verbose mode
5+
# add -v for verbose mode (or type whatever you like !) :p
66

7-
verbose=$1
8-
error=0
9-
ok=0
7+
. test/tools/run.sh
108

11-
echo_start () {
12-
echo "------- Start $* test -------"
13-
}
14-
15-
echo_error () {
16-
echo "\n$(tput setaf 1)/!\ $* failed$(tput sgr0)\n"
17-
error=`expr $error + 1`
18-
}
19-
20-
echo_ok () {
21-
echo "\n--> $* ok\n"
22-
ok=`expr $ok + 1`
23-
}
24-
25-
run_test () {
26-
fction=$1
27-
out=test/test.out
28-
29-
echo_start $fction
30-
31-
if [ -z ${verbose} ]; then
32-
./test/$1.sh > $out 2>&1
33-
else
34-
./test/$1.sh | tee $out 2>&1
35-
fi
36-
37-
if [ "$(grep -c "$2" $out)" -eq 0 ]; then
38-
echo_error $fction
39-
else
40-
echo_ok $fction
41-
fi
42-
43-
rm $out
44-
}
45-
46-
47-
./test/tools/prepare.sh > /dev/null 2>&1
48-
run_test build "Successfully built"
9+
run_test tools/build-container "Successfully built"
4910
run_test simple "dn: dc=example,dc=com"
5011
run_test tls "dn: dc=example,dc=com"
5112
run_test db "dn: dc=otherdomain,dc=com"
52-
./test/tools/end.sh > /dev/null 2>&1
5313

54-
echo "------- Test finished -------"
55-
echo $error " failed " $ok " passed"
14+
. test/tools/end.sh
5615

β€Žtest/build.shβ€Ž

Lines changed: 0 additions & 8 deletions
This file was deleted.

β€Žtest/db.shβ€Ž

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
dir=$(dirname $0)
44
. $dir/tools/config.prop
55

6-
if [ -d "$openldapTestDir" ]; then
7-
rm -r $openldapTestDir
6+
if [ -d "$testDir" ]; then
7+
rm -r $testDir
88
fi
99

10-
mkdir $openldapTestDir
11-
mkdir $openldapTestDir/db
12-
mkdir $openldapTestDir/config
10+
mkdir $testDir
11+
mkdir $testDir/db
12+
mkdir $testDir/config
1313

14-
runOptions="-e LDAP_DOMAIN=otherdomain.com -v $openldapTestDir/db:/var/lib/ldap -v $openldapTestDir/config:/etc/ldap/slapd.d"
15-
. $dir/tools/run-simple.sh
14+
runOptions="-e LDAP_DOMAIN=otherdomain.com -v $testDir/db:/var/lib/ldap -v $testDir/config:/etc/ldap/slapd.d"
15+
. $dir/tools/run-container.sh
1616
$dir/tools/delete-container.sh
1717

18-
runOptions="-v $openldapTestDir/db:/var/lib/ldap -v $openldapTestDir/config:/etc/ldap/slapd.d"
19-
. $dir/tools/run-simple.sh
18+
runOptions="-v $testDir/db:/var/lib/ldap -v $testDir/config:/etc/ldap/slapd.d"
19+
. $dir/tools/run-container.sh
2020
echo "ldapsearch -x -h $IP -b dc=otherdomain,dc=com"
2121
ldapsearch -x -h $IP -b dc=otherdomain,dc=com
2222

23-
rm -r $openldapTestDir
23+
rm -r $testDir
2424
$dir/tools/delete-container.sh

β€Žtest/simple.shβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
dir=$(dirname $0)
44
. $dir/tools/config.prop
55

6-
. $dir/tools/run-simple.sh
6+
. $dir/tools/run-container.sh
77
echo "ldapsearch -x -h $IP -b dc=example,dc=com"
88
ldapsearch -x -h $IP -b dc=example,dc=com
99

β€Žtest/tls.shβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
dir=$(dirname $0)
44
. $dir/tools/config.prop
55

6-
. $dir/tools/run-tls.sh
6+
. $dir/tls/run.sh
77
echo "ldapsearch -x -h $certCN -b dc=example,dc=com -ZZ"
88
ldapsearch -x -h $certCN -b dc=example,dc=com -ZZ
99

10-
. $dir/tools/end-tls.sh
10+
. $dir/tls/end.sh
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/sh
22

33

4-
runOptions="--dns=127.0.0.1 -v `pwd`/test/ssl:/etc/ldap/ssl"
5-
. $dir/tools/run-simple.sh
4+
runOptions="--dns=127.0.0.1 -v `pwd`/test/tls/ssl:/etc/ldap/ssl"
5+
. $dir/tools/run-container.sh
66

7-
cert=$(echo $dir/ssl/ldap.crt)
7+
cert=$(echo $dir/tls/ssl/ldap.crt)
88
certCN=$(openssl x509 -in $cert -subject -noout | sed -n 's/.*CN=\(.*\)\/*\(.*\)/\1/p')
99
addLine=$(echo $IP $certCN)
1010

0 commit comments

Comments
Β (0)