]> git.sur5r.net Git - openldap/blob - tests/scripts/test061-syncreplication-initiation
2253cc7b6534a894354803ef3b6a0b0295d37c83
[openldap] / tests / scripts / test061-syncreplication-initiation
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2015 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 # This script tests race conditions related to setting up the syncrepl
17 # refresh phase, especially when the provider is itself a consumer
18 # refreshing from its provider again.
19
20 # The configuration used is a provider->forwarder->consumer chain, where
21 # the forwarder is restarted between add/delete of entries on the provider.
22
23 echo "Running defines.sh"
24 . $SRCDIR/scripts/defines.sh
25
26 test "x$INITIATION_RACE_TESTS" = "x" && INITIATION_RACE_TESTS=1
27
28 if test $SYNCPROV = syncprovno; then
29         echo "Syncrepl provider overlay not available, test skipped"
30         exit 0
31 fi
32
33 RETRY="1 +"
34
35 PROV_DIR=$TESTDIR/prov
36 CONS_DIR=$TESTDIR/cons
37 FWD1_DIR=$TESTDIR/fwd1
38 FWD2_DIR=$TESTDIR/fwd2
39
40 PROV_URI=$URI1
41 CONS_URI=$URI2
42 FWD1_URI=$URI3
43
44 PROV_LOG=$LOG1
45 CONS_LOG=$LOG2
46 FWD1_LOG=$LOG3
47
48 DIRS="$PROV_DIR $CONS_DIR $FWD1_DIR"
49 URIS="$PROV_URI $CONS_URI $FWD1_URI"
50
51 noObj=32
52 nullExclude="" nullOK=""
53 test $BACKEND = null && nullExclude="# " nullOK="OK" noObj=0
54
55 mkdir -p $TESTDIR
56
57 for dir in $DIRS; do
58         mkdir -p $dir $dir/slapd.d $dir/db
59 done
60
61 KILLPIDS=
62
63 $SLAPPASSWD -g -n >$CONFIGPWF
64
65 case "$BACKEND" in
66         bdb|hdb)        olcDbCheckpoint="olcDbCheckpoint";;
67         *)              olcDbCheckpoint="# olcDbCheckpoint";;
68 esac
69
70 echo "Initializing server configurations"
71 for dir in $DIRS; do
72         $SLAPADD -F $dir/slapd.d -n 0 <<EOF
73 dn: cn=config
74 objectClass: olcGlobal
75 cn: config
76 olcServerID: 1 $PROV_URI
77 olcServerID: 2 $CONS_URI
78 olcServerID: 3 $FWD1_URI
79
80 dn: olcDatabase={0}config,cn=config
81 objectClass: olcDatabaseConfig
82 olcDatabase: {0}config
83 olcRootPW:< file://$CONFIGPWF
84
85 EOF
86 done
87
88 echo "Starting provider slapd on $PROV_URI"
89 cd $PROV_DIR
90 $SLAPD -F slapd.d -h $PROV_URI -d $LVL $TIMING >> $PROV_LOG 2>&1 &
91 PROV_PID=$!
92 if test $WAIT != 0 ; then
93         echo PID $PROV_PID
94         read foo
95 fi
96 KILLPIDS="$KILLPIDS $PROV_PID"
97 cd $TESTWD
98 sleep 1
99 for i in 1 2 3 4 5; do
100         $LDAPSEARCH -s base -b "" -H $PROV_URI \
101                 'objectclass=*' > /dev/null 2>&1
102         RC=$?
103         test $RC = 0 && break
104         echo "Waiting $i seconds for slapd to start..."
105         sleep $i
106 done
107 if test $RC != 0 ; then
108         echo "ldapsearch failed ($RC)!"
109         test $KILLSERVERS != no && kill -HUP $KILLPIDS
110         exit $RC
111 fi
112
113 echo "Starting forward1 slapd on $FWD1_URI"
114 cd $FWD1_DIR
115 $SLAPD -F slapd.d -h $FWD1_URI -d $LVL $TIMING >> $FWD1_LOG 2>&1 &
116 FWD1_PID=$!
117 if test $WAIT != 0 ; then
118         echo PID $FWD1_PID
119         read foo
120 fi
121 KILLPIDS="$KILLPIDS $FWD1_PID"
122 cd $TESTWD
123 sleep 1
124 for i in 1 2 3 4 5; do
125         $LDAPSEARCH -s base -b "" -H $FWD1_URI \
126                 'objectclass=*' > /dev/null 2>&1
127         RC=$?
128         test $RC = 0 && break
129         echo "Waiting $i seconds for slapd to start..."
130         sleep $i
131 done
132 if test $RC != 0 ; then
133         echo "ldapsearch failed ($RC)!"
134         test $KILLSERVERS != no && kill -HUP $KILLPIDS
135         exit $RC
136 fi
137
138 echo "Starting consumer slapd on $CONS_URI"
139 cd $CONS_DIR
140 $SLAPD -F slapd.d -h $CONS_URI -d $LVL $TIMING >> $CONS_LOG 2>&1 &
141 CONS_PID=$!
142 if test $WAIT != 0 ; then
143         echo PID $CONS_PID
144         read foo
145 fi
146 KILLPIDS="$KILLPIDS $CONS_PID"
147 cd $TESTWD
148 sleep 1
149 for i in 1 2 3 4 5; do
150         $LDAPSEARCH -s base -b "" -H $CONS_URI \
151                 'objectclass=*' > /dev/null 2>&1
152         RC=$?
153         test $RC = 0 && break
154         echo "Waiting $i seconds for slapd to start..."
155         sleep $i
156 done
157 if test $RC != 0 ; then
158         echo "ldapsearch failed ($RC)!"
159         test $KILLSERVERS != no && kill -HUP $KILLPIDS
160         exit $RC
161 fi
162
163 for uri in $URIS; do
164         echo "Adding schema on $uri"
165         $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
166 include: file://$ABS_SCHEMADIR/core.ldif
167
168 include: file://$ABS_SCHEMADIR/cosine.ldif
169
170 include: file://$ABS_SCHEMADIR/inetorgperson.ldif
171
172 include: file://$ABS_SCHEMADIR/openldap.ldif
173
174 include: file://$ABS_SCHEMADIR/nis.ldif
175
176 EOF
177         RC=$?
178         if test $RC != 0 ; then
179                 echo "ldapadd failed ($RC)!"
180                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
181                 exit $RC
182         fi
183
184         [ "$BACKENDTYPE" = mod ] || continue
185
186         echo "Adding backend module on $uri..."
187         $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
188 dn: cn=module,cn=config
189 objectClass: olcModuleList
190 cn: module
191 olcModulePath: $TESTWD/../servers/slapd/back-$BACKEND
192 olcModuleLoad: back_$BACKEND.la
193
194 EOF
195         RC=$?
196         if test $RC != 0 ; then
197                 echo "ldapadd failed for backend module ($RC)!"
198                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
199                 exit $RC
200         fi
201 done
202
203 syncprov_module=''
204 [ "$AC_syncprov" = syncprovmod ] && syncprov_module="
205 dn: cn=module,cn=config
206 objectClass: olcModuleList
207 cn: module
208 olcModulePath: $TESTWD/../servers/slapd/overlays
209 olcModuleLoad: syncprov.la"
210
211 for uri in $PROV_URI; do
212         echo "Adding database configuration on $uri"
213         $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
214 dn: olcDatabase={1}$BACKEND,cn=config
215 objectClass: olcDatabaseConfig
216 objectClass: olc${BACKEND}Config
217 olcDatabase: {1}$BACKEND
218 ${nullExclude}olcDbDirectory: ./db
219 $olcDbCheckpoint: 1024 5
220 olcSuffix: $BASEDN
221 olcRootDN: $MANAGERDN
222 olcRootPW: $PASSWD
223
224 $syncprov_module
225
226 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
227 objectClass: olcOverlayConfig
228 objectClass: olcSyncProvConfig
229 olcOverlay: {0}syncprov
230 olcSpCheckpoint: 1 1
231
232 EOF
233         RC=$?
234         if test $RC != 0 ; then
235                 echo "ldapadd failed ($RC)!"
236                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
237                 exit $RC
238         fi
239
240         echo "Populating provider on $uri"
241         $LDAPADD -D "$MANAGERDN" -H $PROV_URI -w $PASSWD <<EOF >> $TESTOUT 2>&1
242 dn: $BASEDN
243 objectClass: top
244 objectClass: organization
245 objectClass: dcObject
246 dc: example
247 o: Example, Inc
248
249 EOF
250         RC=$?
251         if test $RC != 0 ; then
252                 echo "ldapadd failed ($RC)!"
253                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
254                 exit $RC
255         fi
256 done
257
258 for uri in $FWD1_URI; do
259         echo "Adding database configuration on $uri"
260         $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
261 dn: olcDatabase={1}$BACKEND,cn=config
262 objectClass: olcDatabaseConfig
263 objectClass: olc${BACKEND}Config
264 olcDatabase: {1}$BACKEND
265 ${nullExclude}olcDbDirectory: ./db
266 $olcDbCheckpoint: 1024 5
267 olcSuffix: $BASEDN
268 olcRootDN: $MANAGERDN
269 olcRootPW: $PASSWD
270 olcSyncRepl: rid=1 provider=$PROV_URI searchbase="$BASEDN"
271   binddn="$MANAGERDN" bindmethod=simple credentials=$PASSWD
272   type=refreshAndPersist retry="$RETRY" timeout=1
273
274 $syncprov_module
275
276 dn: olcOverlay={0}syncprov,olcDatabase={1}$BACKEND,cn=config
277 objectClass: olcOverlayConfig
278 objectClass: olcSyncProvConfig
279 olcOverlay: {0}syncprov
280 olcSpCheckpoint: 1 1
281
282 EOF
283         RC=$?
284         if test $RC != 0 ; then
285                 echo "ldapadd failed ($RC)!"
286                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
287                 exit $RC
288         fi
289 done
290
291 for uri in $CONS_URI; do
292         echo "Adding database configuration on $uri"
293         $LDAPADD -D cn=config -H $uri -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
294 dn: olcDatabase={1}$BACKEND,cn=config
295 objectClass: olcDatabaseConfig
296 objectClass: olc${BACKEND}Config
297 olcDatabase: {1}$BACKEND
298 ${nullExclude}olcDbDirectory: ./db
299 $olcDbCheckpoint: 1024 5
300 olcSuffix: $BASEDN
301 olcRootDN: $MANAGERDN
302 olcRootPW: $PASSWD
303 olcSyncRepl: rid=1 provider=$FWD1_URI searchbase="$BASEDN"
304   binddn="$MANAGERDN" bindmethod=simple credentials=$PASSWD
305   type=refreshAndPersist retry="$RETRY" timeout=1
306
307 EOF
308         RC=$?
309         if test $RC != 0 ; then
310                 echo "ldapadd failed ($RC)!"
311                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
312                 exit $RC
313         fi
314 done
315
316 for uri in $FWD1_URI $CONS_URI; do
317         echo "Using ldapsearch to check that $uri received database..."
318         for i in 1 2 3 4 5; do
319                 $LDAPSEARCH -s base -b "$BASEDN" -H $uri \
320                         'objectclass=*' > /dev/null 2>&1
321                 RC=$?
322                 test $RC = 0 && break
323                 echo "Waiting $i seconds for slapd to receive database..."
324                 sleep $i
325         done
326         if test $RC != 0 ; then
327                 echo "ldapsearch failed ($RC)!"
328                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
329                 exit $RC
330         fi
331 done
332
333 RACE_NUM=0
334 ERROR=0
335
336 nEntries=10
337
338 addEnd=1
339 delEnd=1
340
341 addIdx=1
342 delIdx=1
343
344 while test $ERROR -eq 0 -a $RACE_NUM -lt $INITIATION_RACE_TESTS ; do
345         RACE_NUM=`expr $RACE_NUM + 1`
346         echo "Running $RACE_NUM of $INITIATION_RACE_TESTS syncrepl initiation race tests..."
347
348         echo "Stopping forwarders for add test"
349         for pid in $FWD1_PID; do
350                 kill -HUP $pid
351                 wait $pid
352                 KILLPIDS=`echo "$KILLPIDS " | sed -e "s/ $pid / /"`;
353         done
354
355         addStart=$addEnd
356         addEnd=`expr $addEnd + $nEntries`
357
358         echo "Using ldapadd to add $nEntries entries on provider"
359         while test $addIdx -lt $addEnd; do
360                 $LDAPADD -D "$MANAGERDN" -H $PROV_URI -w $PASSWD <<EOF >> $TESTOUT 2>&1
361 dn: ou=$addIdx,$BASEDN
362 objectClass: top
363 objectClass: organizationalUnit
364 ou: $addIdx
365
366 EOF
367                 RC=$?
368                 if test $RC != 0 ; then
369                         echo "ldapadd failed for entry $addIdx ($RC)!"
370                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
371                         exit $RC
372                 fi
373                 addIdx=`expr $addIdx + 1`
374         done
375
376         echo "Starting forwarders again"
377         cd $FWD1_DIR
378         $SLAPD -F slapd.d -h $FWD1_URI -d $LVL $TIMING >> $FWD1_LOG 2>&1 &
379         FWD1_PID=$!
380         KILLPIDS="$KILLPIDS $FWD1_PID"
381         cd $TESTWD
382
383         addEnd=`expr $addEnd + $nEntries`
384
385         echo "Using ldapadd to add $nEntries more entries on provider"
386         while test $addIdx -lt $addEnd; do
387                 $LDAPADD -D "$MANAGERDN" -H $PROV_URI -w $PASSWD <<EOF >> $TESTOUT 2>&1
388 dn: ou=$addIdx,$BASEDN
389 objectClass: top
390 objectClass: organizationalUnit
391 ou: $addIdx
392
393 EOF
394                 RC=$?
395                 if test $RC != 0 ; then
396                         echo "ldapadd failed for entry $addIdx ($RC)!"
397                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
398                         exit $RC
399                 fi
400                 addIdx=`expr $addIdx + 1`
401         done
402
403         for uri in $FWD1_URI $CONS_URI; do
404                 echo "Checking replication to $uri"
405                 RC=32
406                 i=$addStart
407                 while test $i -lt $addEnd; do
408                         for j in 1 2 3 4 5; do
409                                 RESULT=`$LDAPSEARCH -H $uri -s base -b "ou=$i,$BASEDN" 2>&1 \
410                                         | awk '/^dn:/ {print "OK"}'`
411                                 if test "x$RESULT$nullOK" = "xOK" ; then
412                                         RC=0
413                                         break
414                                 fi
415                                 echo "Waiting $j seconds for $uri to receive entry $i..."
416                                 sleep $j
417                         done
418                         if test $RC != 0 ; then
419                                 echo "ERROR: Entry $i not replicated to $uri! ($RC)!"
420                                 ERROR=1
421                                 break
422                         fi
423                         i=`expr $i + 1`
424                 done
425                 if test $ERROR != 0; then break; fi
426         done
427         if test $ERROR != 0; then break; fi
428
429         echo "Stopping forwarders for add/delete test"
430         for pid in $FWD1_PID; do
431                 kill -HUP $pid
432                 wait $pid
433                 KILLPIDS=`echo "$KILLPIDS " | sed -e "s/ $pid / /"`;
434         done
435
436         addStart=$addEnd
437         addEnd=`expr $addEnd + $nEntries`
438
439         echo "Using ldapadd to add $nEntries entries on provider"
440         while test $addIdx -lt $addEnd; do
441                 $LDAPADD -D "$MANAGERDN" -H $PROV_URI -w $PASSWD <<EOF >> $TESTOUT 2>&1
442 dn: ou=$addIdx,$BASEDN
443 objectClass: top
444 objectClass: organizationalUnit
445 ou: $addIdx
446
447 EOF
448                 RC=$?
449                 if test $RC != 0 ; then
450                         echo "ldapadd failed for entry $addIdx ($RC)!"
451                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
452                         exit $RC
453                 fi
454                 addIdx=`expr $addIdx + 1`
455         done
456
457         delStart=$delEnd
458         delEnd=`expr $delEnd + $nEntries`
459
460         echo "Using ldapdelete to delete $nEntries entries on provider"
461         while test $delIdx -lt $delEnd; do
462                 $LDAPDELETE -D "$MANAGERDN" -H $PROV_URI -w $PASSWD "ou=$delIdx,$BASEDN"
463                 RC=$?
464                 if test $RC != 0 ; then
465                         echo "ldapdelete failed ($RC)!"
466                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
467                         exit 1
468                 fi
469                 delIdx=`expr $delIdx + 1`
470         done
471
472         echo "Starting forwarders again"
473         cd $FWD1_DIR
474         $SLAPD -F slapd.d -h $FWD1_URI -d $LVL $TIMING >> $FWD1_LOG 2>&1 &
475         FWD1_PID=$!
476         KILLPIDS="$KILLPIDS $FWD1_PID"
477         cd $TESTWD
478
479         addEnd=`expr $addEnd + $nEntries`
480         delEnd=`expr $delEnd + $nEntries`
481
482         echo "Using ldapadd to add $nEntries more entries on provider"
483         while test $addIdx -lt $addEnd; do
484                 $LDAPADD -D "$MANAGERDN" -H $PROV_URI -w $PASSWD <<EOF >> $TESTOUT 2>&1
485 dn: ou=$addIdx,$BASEDN
486 objectClass: top
487 objectClass: organizationalUnit
488 ou: $addIdx
489
490 EOF
491                 RC=$?
492                 if test $RC != 0 ; then
493                         echo "ldapadd failed for entry $addIdx ($RC)!"
494                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
495                         exit $RC
496                 fi
497                 addIdx=`expr $addIdx + 1`
498         done
499
500         echo "Using ldapdelete to delete $nEntries more entries on provider"
501         while test $delIdx -lt $delEnd; do
502                 $LDAPDELETE -D "$MANAGERDN" -H $PROV_URI -w $PASSWD "ou=$delIdx,$BASEDN"
503                 RC=$?
504                 if test $RC != 0 ; then
505                         echo "ldapdelete failed ($RC)!"
506                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
507                         exit 1
508                 fi
509                 delIdx=`expr $delIdx + 1`
510         done
511
512         for uri in $FWD1_URI $CONS_URI; do
513                 echo "Checking replication to $uri"
514                 RC=32
515                 i=$addStart
516                 while test $i -lt $addEnd; do
517                         for j in 1 2 3 4 5; do
518                                 RESULT=`$LDAPSEARCH -H $uri -s base -b "ou=$i,$BASEDN" 2>&1 \
519                                         | awk '/^dn:/ {print "OK"}'`
520                                 if test "x$RESULT$nullOK" = "xOK" ; then
521                                         RC=0
522                                         break
523                                 fi
524                                 echo "Waiting $j seconds for $uri to receive entry $i..."
525                                 sleep $j
526                         done
527                         if test $RC != 0 ; then
528                                 echo "ERROR: Entry $i not replicated to $uri! ($RC)!"
529                                 ERROR=1
530                                 break
531                         fi
532                         i=`expr $i + 1`
533                 done
534                 if test $ERROR != 0; then break; fi
535
536                 i=$delStart
537                 while test $i -lt $delEnd; do
538                         for j in 1 2 3 4 5; do
539                                 $LDAPSEARCH -s base -b "ou=$i,$BASEDN" -H $uri > /dev/null 2>&1
540                                 RC=$?
541                                 if test $RC = $noObj; then break; fi
542                                 echo "Waiting $j seconds for $uri to delete entry $i..."
543                                 sleep $j
544                         done
545                         if test $RC != $noObj; then
546                                 echo "ERROR: Entry $i not removed on $uri! (RC=$RC)"
547                                 ERROR=1
548                                 break
549                         fi
550                         i=`expr $i + 1`
551                 done    
552                 if test $ERROR != 0; then break; fi
553         done
554         if test $ERROR != 0; then break; fi
555
556         echo "Stopping forwarders for delete test"
557         for pid in $FWD1_PID; do
558                 kill -HUP $pid
559                 wait $pid
560                 KILLPIDS=`echo "$KILLPIDS " | sed -e "s/ $pid / /"`;
561         done
562
563         delStart=$delEnd
564         delEnd=`expr $delEnd + $nEntries`
565
566         echo "Using ldapdelete to delete entries on provider"
567         while test $delIdx -lt $delEnd; do
568                 $LDAPDELETE -D "$MANAGERDN" -H $PROV_URI -w $PASSWD "ou=$delIdx,$BASEDN"
569                 RC=$?
570                 if test $RC != 0 ; then
571                         echo "ldapdelete failed ($RC)!"
572                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
573                         exit 1
574                 fi
575                 delIdx=`expr $delIdx + 1`
576         done
577
578         echo "Starting forwarders again"
579         cd $FWD1_DIR
580         $SLAPD -F slapd.d -h $FWD1_URI -d $LVL $TIMING >> $FWD1_LOG 2>&1 &
581         FWD1_PID=$!
582         KILLPIDS="$KILLPIDS $FWD1_PID"
583         cd $TESTWD
584
585         delEnd=`expr $delEnd + $nEntries`
586
587         echo "Using ldapdelete to delete $nEntries more entries on provider"
588         while test $delIdx -lt $delEnd; do
589                 $LDAPDELETE -D "$MANAGERDN" -H $PROV_URI -w $PASSWD "ou=$delIdx,$BASEDN"
590                 RC=$?
591                 if test $RC != 0 ; then
592                         echo "ldapdelete failed ($RC)!"
593                         test $KILLSERVERS != no && kill -HUP $KILLPIDS
594                         exit 1
595                 fi
596                 delIdx=`expr $delIdx + 1`
597         done
598
599         for uri in $FWD1_URI $CONS_URI; do
600                 echo "Checking replication to $uri"
601                 RC=0
602                 i=$delStart
603                 while test $i -lt $delEnd; do
604                         for j in 1 2 3 4 5; do
605                                 $LDAPSEARCH -s base -b "ou=$i,$BASEDN" -H $uri > /dev/null 2>&1
606                                 RC=$?
607                                 if test $RC = $noObj; then break; fi
608                                 echo "Waiting $j seconds for $uri to delete entry $i..."
609                                 sleep $j
610                         done
611                         if test $RC != $noObj; then
612                                 echo "ERROR: Entry $i not removed on $uri! (RC=$RC)"
613                                 ERROR=1
614                                 break
615                         fi
616                         i=`expr $i + 1`
617                 done    
618                 if test $ERROR != 0; then break; fi
619         done
620         if test $ERROR != 0; then break; fi
621
622         sleep 1
623         echo "Checking contextCSN"
624         CSN_ERRORS=0
625         CSN1=`$LDAPSEARCH -H $URI1 -b $BASEDN -s base contextCSN | grep contextCSN`
626         CSN2=`$LDAPSEARCH -H $URI2 -b $BASEDN -s base contextCSN | grep contextCSN`
627         CSN3=`$LDAPSEARCH -H $URI3 -b $BASEDN -s base contextCSN | grep contextCSN`
628
629         if test -z "$CSN1" ; then
630                 test $BACKEND = null && break
631                 echo "ERROR: contextCSN empty on provider"
632                 ERROR=1
633                 break
634         fi
635         nCSN=`echo "$CSN1" | wc -l`
636         if test "$nCSN" -ne 1 ; then
637                 echo "ERROR: Wrong contextCSN count on provder, should be 1"
638                 echo "$CSN1"
639                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
640                 exit 1
641         fi
642         if  test -z "$CSN2" -o "$CSN1" != "$CSN2" ; then
643                 echo "ERROR: contextCSN mismatch between provider and consumer"
644                 echo "contextCSN on provider: $CSN1"
645                 echo "contextCSN on consumer: $CSN2"
646                 ERROR=1
647                 break
648         fi
649         if  test -z "$CSN3" -o "$CSN1" != "$CSN3" ; then
650                 echo "ERROR: contextCSN mismatch between provider and forward1"
651                 echo "contextCSN on provider: $CSN1"
652                 echo "contextCSN on forward1: $CSN3"
653                 ERROR=1
654                 break
655         fi
656 done
657
658 test $KILLSERVERS != no && kill -HUP $KILLPIDS
659
660 if test $ERROR != 0; then
661         echo "Error found after $RACE_NUM of $INITIATION_RACE_TESTS iterations"
662         exit 1
663 else
664         echo "No race errors found after $INITIATION_RACE_TESTS iterations"
665 fi
666
667 echo ">>>>> Test succeeded"
668
669 exit 0