]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: improve tests for configuration updates 2047/head
authorLoic Dachary <loic@dachary.org>
Mon, 30 Jun 2014 19:10:41 +0000 (21:10 +0200)
committerLoic Dachary <loic@dachary.org>
Mon, 30 Jun 2014 19:10:41 +0000 (21:10 +0200)
Extract the default values from the actual configuration instead of
having them hardcoded. Also check that lowering the osd_map_cache_size
triggers the expected warning.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/test/osd/osd-config.sh

index 2b58bd955772010d1b61e2d6a50320f3f7cf38ef..042a2280141b2cc29003587453dcb366c8e5b4ff 100755 (executable)
@@ -54,16 +54,46 @@ function TEST_config_track() {
         || return 1
     run_osd $dir 0 || return 1
 
+    local osd_map_cache_size=$(CEPH_ARGS='' ./ceph-conf \
+        --show-config-value osd_map_cache_size)
+    local osd_map_max_advance=$(CEPH_ARGS='' ./ceph-conf \
+        --show-config-value osd_map_max_advance)
+    local osd_pg_epoch_persisted_max_stale=$(CEPH_ARGS='' ./ceph-conf \
+        --show-config-value osd_pg_epoch_persisted_max_stale)
+    #
+    # lower cache_size under max_advance to trigger the warning
+    #
     ! grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
-    local advance=1000
-    local cache=500
+    local cache=$(($osd_map_max_advance / 2))
+    ./ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
+    grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
+    rm $dir/osd-0.log
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log reopen || return 1
+
+    #
+    # reset cache_size to the default and assert that it does not trigger the warning
+    #
+    ! grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
+    local cache=$osd_map_cache_size
     ./ceph tell osd.0 injectargs "--osd-map-cache-size $cache" || return 1
+    CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
+    ! grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
+
+    #
+    # increase the osd_map_max_advance above the default cache_size
+    #
+    ! grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
+    local advance=$(($osd_map_cache_size * 2))
     ./ceph tell osd.0 injectargs "--osd-map-max-advance $advance" || return 1
     CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
     grep 'is not > osd_map_max_advance' $dir/osd-0.log || return 1
 
+    #
+    # increase the osd_pg_epoch_persisted_max_stale above the default cache_size
+    #
     ! grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd-0.log || return 1
-    local stale=1000
+    local stale=$(($osd_map_cache_size * 2))
     ceph tell osd.0 injectargs "--osd-pg-epoch-persisted-max-stale $stale" || return 1
     CEPH_ARGS='' ./ceph --admin-daemon $dir/ceph-osd.0.asok log flush || return 1
     grep 'is not > osd_pg_epoch_persisted_max_stale' $dir/osd-0.log || return 1