]> git.sur5r.net Git - openldap/blob - tests/scripts/test011-subtree-repl
Disable broken test011
[openldap] / tests / scripts / test011-subtree-repl
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "Test disabled."
5 exit 0
6
7 SRCDIR="."
8 if test $# -ge 1 ; then
9         SRCDIR=$1; shift
10 fi
11 BACKEND=bdb
12 if test $# -ge 1 ; then
13         BACKEND=$1; shift
14 fi
15 WAIT=0
16 if test $# -ge 1 ; then
17         WAIT=1; shift
18 fi
19
20 echo "running defines.sh"
21 . $SRCDIR/scripts/defines.sh
22
23 #
24 # Test replication:
25 # - start master
26 # - start slave
27 # - create root entry in slave
28 # - start slurpd
29 # - populate over ldap
30 # - perform some modifies and deleted
31 # - retrieve database over ldap and compare against expected results
32 #
33
34 if test ! -x $SLURPD ; then
35         echo ">>>>> $SLURPD is not executable or do not exist."
36         echo ">>>>> Test skipped."
37         exit 0
38 fi
39
40 echo "Cleaning up in $DBDIR..."
41 rm -f $DBDIR/[!C]*
42 echo "Cleaning up in $REPLDIR..."
43 rm -f $REPLDIR/replica/[!C]*
44 rm -f $REPLDIR/[!C]*
45
46 echo "Starting master slapd on TCP/IP port $PORT..."
47 . $CONFFILTER $BACKEND < $SUBMASTERCONF > $DBCONF
48 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
49 PID=$!
50 if test $WAIT != 0 ; then
51     echo PID $PID
52     read foo
53 fi
54
55 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
56 . $CONFFILTER $BACKEND < $SUBSLAVECONF > $REPLCONF
57 $SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
58 SLAVEPID=$!
59 if test $WAIT != 0 ; then
60     echo SLAVEPID $SLAVEPID
61     read foo
62 fi
63
64 echo "Using ldapsearch to check that master slapd is running..."
65 for i in 0 1 2 3 4 5; do
66         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
67                 'objectclass=*' > /dev/null 2>&1
68         RC=$?
69         if test $RC = 1 ; then
70                 echo "Waiting 5 seconds for slapd to start..."
71                 sleep 5
72         fi
73 done
74
75 echo "Using ldapsearch to check that slave slapd is running..."
76 for i in 0 1 2 3 4 5; do
77         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
78                 'objectclass=*' > /dev/null 2>&1
79         RC=$?
80         if test $RC = 1 ; then
81                 echo "Waiting 5 seconds for slapd to start..."
82                 sleep 5
83         fi
84 done
85
86 echo "Starting slurpd..."
87 $SLURPD -f $SUBMASTERCONF -d ${SLURPD_DEBUG-5} -t $REPLDIR > $SLURPLOG 2>&1 &
88 SLURPPID=$!
89
90 echo "Using ldapadd to populate the master directory..."
91 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
92         $LDIFORDERED > /dev/null 2>&1
93 RC=$?
94 if test $RC != 0 ; then
95         echo "ldapadd failed ($RC)!"
96         kill -INT $PID $SLAVEPID
97         kill -KILL $SLURPPID
98         exit $RC
99 fi
100
101 echo "Waiting 15 seconds for slurpd to send changes..."
102 sleep 15
103
104 echo "Using ldapmodify to modify master directory..."
105
106 #
107 # Do some modifications
108 #
109
110 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
111         $TESTOUT 2>&1 << EOMODS
112 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
113 changetype: modify
114 add: drink
115 drink: Orange Juice
116
117 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
118 changetype: modify
119 replace: drink
120 drink: Iced Tea
121 drink: Mad Dog 20/20
122
123 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
124 delete: member
125 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
126 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
127 -
128 add: member
129 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
130 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
131
132 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
133 changetype: modify
134 delete: member
135
136 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
137 changetype: add
138 objectclass: top
139 objectclass: person
140 objectclass: OpenLDAPperson
141 cn: Gern Jensen
142 sn: Jensen
143 uid: gjensen
144 title: Chief Investigator, ITD
145 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
146 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
147 drink: Coffee
148 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
149 description: Very odd
150 facsimiletelephonenumber: +1 313 555 7557
151 telephonenumber: +1 313 555 8343
152 mail: gjensen@mailgw.umich.edu
153 homephone: +1 313 555 8844
154
155 dn: ou=Retired, ou=People, o=University of Michigan, c=US
156 changetype: add
157 objectclass: top
158 objectclass: organizationalUnit
159 ou: Retired
160
161 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
162 changetype: add
163 objectclass: top
164 objectclass: person
165 cn: Rosco P. Coltrane
166 sn: Coltrane
167
168 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
169 changetype: modrdn
170 newrdn: cn=Rosco P. Coltrane
171 deleteoldrdn: 1
172 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
173
174 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
175 changetype: delete
176
177 EOMODS
178
179 echo "Waiting 15 seconds for slurpd to send changes..."
180 sleep 15
181
182 echo "Using ldapsearch to read all the entries from the master..."
183 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
184         'objectclass=*' > $MASTEROUT 2>&1
185
186 if test $RC != 0 ; then
187         echo "ldapsearch failed ($RC)!"
188         kill -INT $PID $SLAVEPID
189         kill -KILL $SLURPPID
190         exit $RC
191 fi
192
193 echo "Using ldapsearch to read the subtree entries from the master..."
194 $LDAPSEARCH -S "" -b "ou=Groups, $BASEDN" -h $LOCALHOST -p $PORT \
195         'objectclass=*' > $SUBMASTEROUT 2>&1
196
197 if test $RC != 0 ; then
198         echo "ldapsearch failed ($RC)!"
199         kill -INT $PID $SLAVEPID
200         kill -KILL $SLURPPID
201         exit $RC
202 fi
203
204 echo "Using ldapsearch to read all the entries from the slave..."
205 $LDAPSEARCH -S "" -b "ou=Groups, $BASEDN" -h $LOCALHOST -p $SLAVEPORT \
206         'objectclass=*' > $SLAVEOUT 2>&1
207
208 if test $RC != 0 ; then
209         echo "ldapsearch failed ($RC)!"
210         kill -INT $PID $SLAVEPID
211         kill -KILL $SLURPPID
212         exit $RC
213 fi
214
215 kill -INT $PID $SLAVEPID
216 kill -KILL $SLURPPID
217
218 SEARCHOUT=$SUBMASTEROUT
219 LDIF=$SLAVEOUT
220
221 echo "Filtering master ldapsearch results..."
222 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
223 echo "Filtering slave ldapsearch results..."
224 . $LDIFFILTER < $LDIF > $LDIFFLT
225
226 echo "Comparing retrieved entries from master and slave..."
227 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
228
229 if test $? != 0 ; then
230         echo "test failed - master and slave databases differ"
231         exit 1
232 fi
233
234 SEARCHOUT=$MASTEROUT
235
236 echo "Filtering remaining data"
237 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
238
239 echo "Stripping slave entries from master output..."
240 $CMP $SEARCHFLT $LDIFFLT | $UNDIFFFILTER > $SUBFLT
241
242 echo "Stripping subtree entries from master output..."
243 . $SUBFILTER 'ou=Groups,[ ]?o=University of Michigan,[ ]?c=US' < $SEARCHOUT \
244         | $UNDIFFFILTER > $SUBFLT2
245
246 echo "Comparing master minus subtree and master minus slave..."
247 $CMP $SUBFLT $SUBFLT2 > $CMPOUT
248
249 if test $? != 0 ; then
250         echo "test failed - master and slave databases differ"
251         exit 1
252 fi
253
254 echo ">>>>> Test succeeded"
255
256 exit 0