]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph create may consume more than one id
authorLoic Dachary <ldachary@redhat.com>
Thu, 21 May 2015 14:39:30 +0000 (16:39 +0200)
committerLoic Dachary <ldachary@redhat.com>
Fri, 22 May 2015 08:16:24 +0000 (10:16 +0200)
When CEPH_CLI_TEST_DUP_COMMAND=1 is set, ceph osd create will consume
two osd id and return the later. Fix the test to account for that and
not assume the osd id being allocated by osd create is always the
next available osd id.

The other osd create tests do not suffer from the same variation because
they provide a UUID argument that guarantees the same osd id is going to
be returned every time.

http://tracker.ceph.com/issues/11618 Fixes: #11618

Signed-off-by: Loic Dachary <ldachary@redhdat.com>
qa/workunits/cephtool/test.sh

index 15d4e733d90cb69637e6c00799bd945bb4597717..e3343bdcfc9ea9ac4162534b2a48d0157eaacffa 100755 (executable)
@@ -1036,17 +1036,26 @@ function test_mon_osd()
 
   ceph osd create $uuid $gap_start 2>&1 | grep 'EINVAL'
 
+  #
+  # When CEPH_CLI_TEST_DUP_COMMAND is set, osd create
+  # is repeated and consumes two osd id, not just one.
+  #
+  local next_osd
+  if test "$CEPH_CLI_TEST_DUP_COMMAND" ; then
+      next_osd=$((gap_start + 1))
+  else
+      next_osd=$gap_start
+  fi
   id=`ceph osd create`
-  [ "$id" = "$gap_start" ]
-  gap_start=$((gap_start + 1))
+  [ "$id" = "$next_osd" ]
 
+  next_osd=$((id + 1))
   id=`ceph osd create $(uuidgen)`
-  [ "$id" = "$gap_start" ]
-  gap_start=$((gap_start + 1))
+  [ "$id" = "$next_osd" ]
 
-  id=`ceph osd create $(uuidgen) $gap_start`
-  [ "$id" = "$gap_start" ]
-  gap_start=$((gap_start + 1))
+  next_osd=$((id + 1))
+  id=`ceph osd create $(uuidgen) $next_osd`
+  [ "$id" = "$next_osd" ]
 
   local new_osds=$(echo $(ceph osd ls))
   for id in $(echo $new_osds | sed -e "s/$old_osds//") ; do