]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: create lost2 test
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 25 Nov 2010 05:15:00 +0000 (21:15 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 30 Nov 2010 23:48:48 +0000 (15:48 -0800)
This one verifies:
1. Client asks for an unfound object and gets put to sleep
2. Object gets declared lost
3. Client wakes up

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/test/test_lost.sh

index ae0ae04318b54ee93337dad5910329ef4bf9f172..59a7e9224d9276f18bcfea844eaffa477d25ae7e 100755 (executable)
@@ -62,6 +62,8 @@ recovery1() {
 }
 
 lost1_impl() {
+       try_to_fetch_unfound=$1
+
         # Write lots and lots of objects
         write_objects 1 1 20 8000
 
@@ -86,6 +88,16 @@ lost1_impl() {
        poll_cmd "./ceph pg debug unfound_objects_exist" TRUE 3 120
         [ $? -eq 1 ] || die "Failed to see unfound objects."
 
+       if [ "$try_to_fetch_unfound" -eq 1 ]; then
+         # Ask for an object while it's still unfound, and
+         # verify we get woken to an error when it's declared lost.
+         echo "trying to get one of the unfound objects"
+         (
+         ./rados -p data get obj02 $TEMPDIR/obj02 &&\
+           die "expected radostool error"
+         ) &
+       fi
+
         # Lose all objects.
        ./ceph osd lost 0 --yes-i-really-mean-it
 
@@ -97,20 +109,30 @@ lost1_impl() {
        # TODO: check error code
        ./rados -p data get obj01 $TEMPDIR/obj01 &&\
          die "expected radostool error"
-}
 
-# TODO: lost2 test where we ask for an object while it's still unfound, and
-# verify we get woken to an error when it's declared lost.
+       if [ "$try_to_fetch_unfound" -eq 1 ]; then
+         echo "waiting for the try_to_fetch_unfound \
+radostool instance to finish"
+         wait
+       fi
+}
 
 lost1() {
         setup 2
-        lost1_impl
+        lost1_impl 0
+}
+
+lost2() {
+        setup 2
+        lost1_impl 1
 }
 
 run() {
         recovery1 || die "test failed"
 
         lost1 || die "test failed"
+
+        lost2 || die "test failed"
 }
 
 $@