From e5564a87eb88308031ee67707fc0b6c99dd5b00d Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 16 May 2015 15:52:01 +0200 Subject: [PATCH] tests: {mon,osd}-test-helpers.sh are deprecated Remove the helpers because they are not used any longer. They have been deprecated by ceph-helpers.sh Signed-off-by: Loic Dachary --- src/test/Makefile.am | 2 - src/test/mon/mon-test-helpers.sh | 99 ----------------------- src/test/osd/osd-test-helpers.sh | 135 ------------------------------- 3 files changed, 236 deletions(-) delete mode 100644 src/test/mon/mon-test-helpers.sh delete mode 100644 src/test/osd/osd-test-helpers.sh diff --git a/src/test/Makefile.am b/src/test/Makefile.am index ad72ee90169..9d56f055b98 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -115,8 +115,6 @@ EXTRA_DIST += \ $(srcdir)/test/opensuse-13.2/Dockerfile.in \ $(srcdir)/test/opensuse-13.2/install-deps.sh \ $(srcdir)/test/opensuse-13.2/ceph.spec.in \ - $(srcdir)/test/mon/mon-test-helpers.sh \ - $(srcdir)/test/osd/osd-test-helpers.sh \ $(srcdir)/test/coverage.sh \ $(patsubst %,$(srcdir)/%,$(check_SCRIPTS)) diff --git a/src/test/mon/mon-test-helpers.sh b/src/test/mon/mon-test-helpers.sh deleted file mode 100644 index ef52c31ccda..00000000000 --- a/src/test/mon/mon-test-helpers.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2013,2014 Cloudwatt -# Copyright (C) 2014 Red Hat -# -# Author: Loic Dachary -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library Public License for more details. -# -source test/test_btrfs_common.sh - -function setup() { - local dir=$1 - teardown $dir - mkdir -p $dir -} - -function teardown() { - local dir=$1 - kill_daemons $dir - if [ $(stat -f -c '%T' .) == "btrfs" ]; then - teardown_btrfs $dir - fi - rm -fr $dir -} - -function run_mon() { - local dir=$1 - shift - local id=$1 - shift - dir+=/$id - - ./ceph-mon \ - --id $id \ - --mkfs \ - --mon-data=$dir --run-dir=$dir \ - "$@" - - ./ceph-mon \ - --id $id \ - --mon-osd-full-ratio=.99 \ - --mon-data-avail-crit=1 \ - --paxos-propose-interval=0.1 \ - --osd-crush-chooseleaf-type=0 \ - --osd-pool-default-erasure-code-directory=.libs \ - --debug-mon 20 \ - --debug-ms 20 \ - --debug-paxos 20 \ - --chdir= \ - --mon-data=$dir \ - --log-file=$dir/log \ - --mon-cluster-log-file=$dir/log \ - --run-dir=$dir \ - --pid-file=$dir/\$name.pid \ - "$@" -} - -function kill_daemons() { - local dir=$1 - for pidfile in $(find $dir | grep '\.pid') ; do - pid=$(cat $pidfile) - signal=9 - for try in 0 1 1 1 2 3 ; do - kill -$signal $pid 2> /dev/null || break - signal=0 - sleep $try - done - done -} - -function main() { - local dir=testdir/$1 - - export PATH=:$PATH # make sure program from sources are prefered - - PS4='${FUNCNAME[0]}: $LINENO: ' - export CEPH_CONF=/dev/null - unset CEPH_ARGS - - set -x - setup $dir || return 1 - local code - if run $dir ; then - code=0 - else - code=1 - fi - teardown $dir || return 1 - return $code -} diff --git a/src/test/osd/osd-test-helpers.sh b/src/test/osd/osd-test-helpers.sh deleted file mode 100644 index 34e07443951..00000000000 --- a/src/test/osd/osd-test-helpers.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2014 Cloudwatt -# Copyright (C) 2014 Red Hat -# -# Author: Loic Dachary -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library Public License for more details. -# - -function run_osd() { - local dir=$1 - shift - local id=$1 - shift - local osd_data=$dir/$id - - local ceph_disk_args - ceph_disk_args+=" --statedir=$dir" - ceph_disk_args+=" --sysconfdir=$dir" - ceph_disk_args+=" --prepend-to-path=" - ceph_disk_args+=" --verbose" - - touch $dir/ceph.conf - - mkdir -p $osd_data - ./ceph-disk $ceph_disk_args \ - prepare $osd_data || return 1 - - local ceph_args="$CEPH_ARGS" - ceph_args+=" --osd-backfill-full-ratio=.99" - ceph_args+=" --osd-failsafe-full-ratio=.99" - ceph_args+=" --osd-journal-size=100" - ceph_args+=" --osd-data=$osd_data" - ceph_args+=" --chdir=" - ceph_args+=" --osd-pool-default-erasure-code-directory=.libs" - ceph_args+=" --run-dir=$dir" - ceph_args+=" --debug-osd=20" - ceph_args+=" --debug-filestore=20" - ceph_args+=" --log-file=$dir/osd-\$id.log" - ceph_args+=" --pid-file=$dir/osd-\$id.pid" - ceph_args+=" " - ceph_args+="$@" - mkdir -p $osd_data - CEPH_ARGS="$ceph_args" ./ceph-disk $ceph_disk_args \ - activate \ - --mark-init=none \ - $osd_data || return 1 - - [ "$id" = "$(cat $osd_data/whoami)" ] || return 1 - - ./ceph osd crush create-or-move "$id" 1 root=default host=localhost - - status=1 - for ((i=0; i < 60; i++)); do - if ! ./ceph osd dump | grep "osd.$id up"; then - sleep 1 - else - status=0 - break - fi - done - - return $status -} - -function get_osds() { - local poolname=$1 - local objectname=$2 - - ./ceph osd map $poolname $objectname | \ - perl -p -e 's/.*up \(\[(.*?)\].*/$1/; s/,/ /g' -} - -function get_pg() { - local poolname=$1 - local objectname=$2 - - ./ceph osd map $poolname $objectname | \ - perl -p -e 's/.*\((.*?)\) -> up.*/$1/' -} - -function kill_osd_daemon() { - local dir=$1 - local osdid=$2 - pidfile=$(find $dir | grep pidfile | grep "osd-$osdid\.") - pid=$(cat $pidfile) - for try in 0 1 1 1 2 3 ; do - alive=0 - kill -9 $pid 2> /dev/null || break - alive=1 - sleep $try - done - return $alive -} - -function check_osd_status() { - local osdid=$1 - local st=$2 - - status=1 - for ((i=0; i < 30; i++)); do - if ! ceph osd dump | grep "osd.$osdid $st"; then - sleep 1 - else - status=0 - break - fi - done - return $status -} - -function check_pg_status() { - local pgid=$1 - local st=$2 - - status=1 - for ((i=0; i < 30; i++)); do - if ! ceph pg dump | grep "$pgid" | grep "$st"; then - sleep 1 - else - status=0 - break - fi - done - return $status -}