@@ -56,10 +56,7 @@ function run() {
5656function TEST_divergent() {
5757 local dir=$1
5858
59- # something that is always there
60- local dummyfile=' /etc/fstab'
61- local dummyfile2=' /etc/resolv.conf'
62-
59+ local dummyfile=$( file_with_random_data)
6360 local num_osds=3
6461 local osds=" $( seq 0 $( expr $num_osds - 1) ) "
6562 run_mon $dir a || return 1
@@ -96,7 +93,7 @@ function TEST_divergent() {
9693 # write a bunch of objects
9794 for i in $( seq 1 $testobjects )
9895 do
99- rados -p $poolname put existing_$i $dummyfile
96+ rados -p $poolname put existing_$i $dummyfile || return 1
10097 done
10198
10299 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
@@ -153,7 +150,8 @@ function TEST_divergent() {
153150 objname=" existing_$( expr $DIVERGENT_WRITE + $DIVERGENT_REMOVE ) "
154151 echo " writing non-divergent object $objname "
155152 ceph pg dump pgs
156- rados -p $poolname put $objname $dummyfile2
153+ # a second object (using a different size, for good measure)
154+ dd if=/dev/urandom bs=1000 count=1 | rados -p " $poolname " put " $objname " - || return 1
157155
158156 # ensure no recovery of up osds first
159157 echo ' delay recovery'
@@ -220,16 +218,17 @@ function TEST_divergent() {
220218 fi
221219 echo " success"
222220
221+ rm -f $dummyfile
223222 delete_pool $poolname
224223 kill_daemons $dir || return 1
225224}
226225
227226function TEST_divergent_ec() {
228227 local dir=$1
229228
230- # something that is always there
231- local dummyfile= ' /etc/fstab '
232- local dummyfile2=' /etc/resolv.conf '
229+ local dummyfile= $( file_with_random_data )
230+ # a second object, different in size and contents
231+ local dummyfile2=$( file_with_random_data 1000 )
233232
234233 local num_osds=3
235234 local osds=" $( seq 0 $( expr $num_osds - 1) ) "
@@ -265,7 +264,7 @@ function TEST_divergent_ec() {
265264 # write a bunch of objects
266265 for i in $( seq 1 $testobjects )
267266 do
268- rados -p $poolname put existing_$i $dummyfile
267+ rados -p $poolname put existing_$i $dummyfile || return 1
269268 done
270269
271270 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
@@ -322,7 +321,8 @@ function TEST_divergent_ec() {
322321 objname=" existing_$( expr $DIVERGENT_WRITE + $DIVERGENT_REMOVE ) "
323322 echo " writing non-divergent object $objname "
324323 ceph pg dump pgs
325- rados -p $poolname put $objname $dummyfile2
324+ rados -p $poolname put $objname $dummyfile2 || return 1
325+ rm -f $dummyfile2
326326
327327 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
328328
@@ -366,6 +366,7 @@ function TEST_divergent_ec() {
366366 echo ' wait for peering'
367367 ceph pg dump pgs
368368 rados -p $poolname put foo $dummyfile
369+ rm -f $dummyfile
369370
370371 echo " killing divergent $divergent "
371372 ceph pg dump pgs
@@ -420,9 +421,9 @@ function TEST_divergent_ec() {
420421function TEST_divergent_2() {
421422 local dir=$1
422423
423- # something that is always there
424- local dummyfile= ' /etc/fstab '
425- local dummyfile2=' /etc/resolv.conf '
424+ local dummyfile= $( file_with_random_data )
425+ # a second object, different in size and contents
426+ local dummyfile2=$( file_with_random_data 1000 )
426427
427428 local num_osds=3
428429 local osds=" $( seq 0 $( expr $num_osds - 1) ) "
@@ -460,7 +461,7 @@ function TEST_divergent_2() {
460461 # write a bunch of objects
461462 for i in $( seq 1 $testobjects )
462463 do
463- rados -p $poolname put existing_$i $dummyfile
464+ rados -p $poolname put existing_$i $dummyfile || return 1
464465 done
465466
466467 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
@@ -528,7 +529,8 @@ function TEST_divergent_2() {
528529 objname=" existing_$( expr $DIVERGENT_WRITE + $DIVERGENT_REMOVE ) "
529530 echo " writing non-divergent object $objname "
530531 ceph pg dump pgs
531- rados -p $poolname put $objname $dummyfile2
532+ rados -p $poolname put $objname $dummyfile2 || return 1
533+ rm -f $dummyfile2
532534
533535 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
534536
@@ -560,7 +562,8 @@ function TEST_divergent_2() {
560562 ceph pg dump pgs
561563 echo ' wait for peering'
562564 ceph pg dump pgs
563- rados -p $poolname put foo $dummyfile
565+ rados -p $poolname put foo $dummyfile || return 1
566+ rm -f $dummyfile
564567
565568 # At this point the divergent_priors should have been detected
566569
@@ -617,7 +620,6 @@ function TEST_divergent_2() {
617620 echo " success"
618621
619622 rm $dir /$expfile
620-
621623 delete_pool $poolname
622624 kill_daemons $dir || return 1
623625}
@@ -627,9 +629,9 @@ function TEST_divergent_2() {
627629function TEST_divergent_3() {
628630 local dir=$1
629631
630- # something that is always there
631- local dummyfile= ' /etc/fstab '
632- local dummyfile2=' /etc/resolv.conf '
632+ local dummyfile= $( file_with_random_data )
633+ # a second file (using a different size, for good measure)
634+ local dummyfile2=$( file_with_random_data 1000 )
633635
634636 local num_osds=3
635637 local osds=" $( seq 0 $( expr $num_osds - 1) ) "
@@ -685,7 +687,7 @@ function TEST_divergent_3() {
685687 # write a bunch of objects
686688 for i in $( seq 1 $testobjects )
687689 do
688- rados -p $poolname put existing_$i $dummyfile
690+ rados -p $poolname put existing_$i $dummyfile || return 1
689691 done
690692
691693 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
@@ -753,7 +755,7 @@ function TEST_divergent_3() {
753755 objname=" existing_$( expr $DIVERGENT_WRITE + $DIVERGENT_REMOVE ) "
754756 echo " writing non-divergent object $objname "
755757 ceph pg dump pgs
756- rados -p $poolname put $objname $dummyfile2
758+ rados -p $poolname put $objname $dummyfile2 || return 1
757759
758760 WAIT_FOR_CLEAN_TIMEOUT=20 wait_for_clean
759761
@@ -786,6 +788,8 @@ function TEST_divergent_3() {
786788 echo ' wait for peering'
787789 ceph pg dump pgs
788790 rados -p $poolname put foo $dummyfile
791+ rm -f $dummyfile
792+ rm -f $dummyfile2
789793
790794 # At this point the divergent_priors should have been detected
791795
@@ -842,7 +846,6 @@ function TEST_divergent_3() {
842846 echo " success"
843847
844848 rm $dir /$expfile
845-
846849 delete_pool $poolname
847850 kill_daemons $dir || return 1
848851}
0 commit comments