]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: sample test for new replication tests
authorNoah Watkins <noahwatkins@gmail.com>
Tue, 12 Feb 2013 23:21:14 +0000 (15:21 -0800)
committerJoe Buck <jbbuck@gmail.com>
Tue, 19 Feb 2013 22:05:11 +0000 (14:05 -0800)
Signed-off-by: Joe Buck <jbbuck@gmail.com>
qa/workunits/hadoop-internal-tests/test.sh

index 5b84761dee444ac5fbbefd52d72a92a5396f6081..bfbb38c73cd50bec8965171646ab125480c69960 100755 (executable)
@@ -1,23 +1,62 @@
-#!/bin/sh -e
+#!/bin/bash -e
 
-echo "starting hadoop-internal-tests tests"
+BASE=/tmp/cephtest
+TLIB=binary/usr/local/lib
+export LD_LIBRARY_PATH=$BASE/$TLIB 
+CEPH_CONF_FILE=$BASE/ceph.conf
 
-# bail if $TESTDIR is not set as this test will fail in that scenario
-[ -z $TESTDIR] && { echo "\$TESTDIR needs to be set, but is not. Exiting."; exit 1; }
+POOL_SIZES=`seq 1 8`
+POOL_BASE=hadoop
+POOL_NAMES=`echo -n $POOL_SIZES | sed "s/\([0-9]*\)/$POOL_BASE\1/g" | sed "s/ /,/g"`
 
-command1="cd $TESTDIR/hadoop"
-command2="ant -Dextra.library.path=$LD_LIBRARY_PATH -Dceph.conf.file=$CEPH_CONF -Dtestcase=TestCephFileSystem"
+function gen_hadoop_conf() {
+local outfile=$1
+local poolnames=$2
+cat << EOF > $outfile
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<configuration>
+<property>
+  <name>ceph.conf.file</name>
+  <value>$CEPH_CONF_FILE</value>
+</property>
+<property>
+  <name>ceph.data.pools</name>
+  <value>$poolnames</value>
+</property>
+</configuration>
+EOF
+}
 
-#print out the command
-echo "----------------------"
-echo $command1
-echo "----------------------"
-echo $command2
-echo "----------------------"
+echo creating hadoop test pools
+for size in $POOL_SIZES; do
+  name=${POOL_BASE}$size
+  echo creating pool $name
+  ./ceph osd pool create $name 100 100
+  ./ceph osd pool set $name size $size
 
-#now execute the command
-$command1
-$command2
+  echo making pool $name a data pool
+  poolid=`./ceph osd dump | sed -n "s/^pool \([0-9]*\) '$name'.*/\1/p"`
+  ./ceph mds add_data_pool $poolid
+done
+
+def_repl_conf=`mktemp`
+echo generating default replication hadoop config $def_repl_conf
+gen_hadoop_conf $def_repl_conf ""
+
+cust_repl_conf=`mktemp`
+echo generating custom replication hadoop config $cust_repl_conf
+gen_hadoop_conf $cust_repl_conf $POOL_NAMES
+
+pushd $BASE/hadoop
+
+echo running default replication hadoop tests
+ant -Dextra.library.path=$BASE/$TLIB -Dhadoop.conf.file=$def_repl_conf -Dtestcase=TestCephDefaultReplication test
+
+echo running custom replication hadoop tests
+ant -Dextra.library.path=$BASE/$TLIB -Dhadoop.conf.file=$def_repl_conf -Dtestcase=TestCephCustomReplication test
+
+popd
 
 echo "completed hadoop-internal-tests tests"
 exit 0