Commit 03f02ecd authored by Matthieu Dorier's avatar Matthieu Dorier

added test cases for the multi-provider and multi-target modes

parent c04e6c09
......@@ -196,7 +196,7 @@ int main(int argc, char **argv)
return(-1);
}
printf("Provider %d managing new target at multiplex id %d\n", i, i+1);
printf("Provider 0 managing new target at multiplex id %d\n", 1);
}
}
......
......@@ -8,10 +8,14 @@ check_PROGRAMS += \
TESTS += \
tests/basic.sh \
tests/copy-to-and-from.sh \
tests/copy-to-and-from-multi-providers.sh \
tests/copy-to-and-from-multi-targets.sh \
tests/create-write-persist.sh
EXTRA_DIST += \
tests/basic.sh \
tests/copy-to-and-from.sh \
tests/copy-to-and-from-multi-providers.sh \
tests/copy-to-and-from-multi-targets.sh \
tests/create-write-persist.sh
#!/bin/bash -x
if [ -z $srcdir ]; then
echo srcdir variable not set.
exit 1
fi
source $srcdir/tests/test-util.sh
# start 1 server with 2 providers, 2 second wait, 20s timeout
test_start_servers_multi_providers 1 2 2 20
# actual test case
#####################
# Writing foo1.dat to provider 1
echo "Hello world first provider." > $TMPBASE/foo1.dat
CPOUT=`run_to 10 src/bake-copy-to $TMPBASE/foo1.dat $svr1 1 1`
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
RID1=`echo "$CPOUT" | grep -o -P '/tmp.*$'`
# Writing foo2.dat to provider 2
echo "Hello world second provider." > $TMPBASE/foo2.dat
CPOUT=`run_to 10 src/bake-copy-to $TMPBASE/foo2.dat $svr1 2 1`
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
RID2=`echo "$CPOUT" | grep -o -P '/tmp.*$'`
# Reading from provider 1
run_to 10 src/bake-copy-from $svr1 1 $RID1 $TMPBASE/foo1-out.dat
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
cat $TMPBASE/foo1-out.dat
sleep 1
# Reading from provider 2
run_to 10 src/bake-copy-from $svr1 2 $RID2 $TMPBASE/foo2-out.dat
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
cat $TMPBASE/foo2-out.dat
sleep 1
#####################
# tear down
run_to 10 src/bake-shutdown $svr1
if [ $? -ne 0 ]; then
wait
exit 1
fi
wait
echo cleaning up $TMPBASE
rm -rf $TMPBASE
exit 0
#!/bin/bash -x
if [ -z $srcdir ]; then
echo srcdir variable not set.
exit 1
fi
source $srcdir/tests/test-util.sh
# start 1 server with 2 targets, 2 second wait, 20s timeout
test_start_servers_multi_targets 1 2 2 20
# actual test case
#####################
# Writing foo1.dat to provider 1
echo "Hello world first target." > $TMPBASE/foo1.dat
CPOUT=`run_to 10 src/bake-copy-to $TMPBASE/foo1.dat $svr1 1 1`
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
RID1=`echo "$CPOUT" | grep -o -P '/tmp.*$'`
# Writing foo2.dat to provider 2
echo "Hello world second target." > $TMPBASE/foo2.dat
CPOUT=`run_to 10 src/bake-copy-to $TMPBASE/foo2.dat $svr1 1 2`
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
RID2=`echo "$CPOUT" | grep -o -P '/tmp.*$'`
# Reading from target 1
run_to 10 src/bake-copy-from $svr1 1 $RID1 $TMPBASE/foo1-out.dat
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
cat $TMPBASE/foo1-out.dat
sleep 1
# Reading from target 2
run_to 10 src/bake-copy-from $svr1 1 $RID2 $TMPBASE/foo2-out.dat
if [ $? -ne 0 ]; then
run_to 10 src/bake-shutdown $svr1
wait
exit 1
fi
cat $TMPBASE/foo2-out.dat
sleep 1
#####################
# tear down
run_to 10 src/bake-shutdown $svr1
if [ $? -ne 0 ]; then
wait
exit 1
fi
wait
echo cleaning up $TMPBASE
rm -rf $TMPBASE
exit 0
......@@ -59,3 +59,71 @@ function test_start_servers ()
svr1=`cat $TMPBASE/svr-1.addr`
}
function test_start_servers_multi_providers ()
{
nservers=${1:-4}
nproviders=${2:-1}
startwait=${3:-15}
maxtime=${4:-120}
# start daemons
for i in `seq $nservers`
do
for j in `seq $nproviders`
do
src/bake-mkpool -s 100M $TMPBASE/svr-$i-prvd-$j.dat
if [ $? -ne 0 ]; then
exit 1
fi
done
run_to ${maxtime} src/bake-server-daemon -m providers -f $TMPBASE/svr-$i.addr na+sm $TMPBASE/svr-$i-prvd-*.dat &
if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
# return codes of the actual client side tests to tell if
# everything started properly
exit 1
fi
done
# wait for servers to start
sleep ${startwait}
svr1=`cat $TMPBASE/svr-1.addr`
}
function test_start_servers_multi_targets ()
{
nservers=${1:-4}
ntargets=${2:-1}
startwait=${3:-15}
maxtime=${4:-120}
# start daemons
for i in `seq $nservers`
do
for j in `seq $ntargets`
do
src/bake-mkpool -s 100M $TMPBASE/svr-$i-tgt-$j.dat
if [ $? -ne 0 ]; then
exit 1
fi
done
run_to ${maxtime} src/bake-server-daemon -m targets -f $TMPBASE/svr-$i.addr na+sm $TMPBASE/svr-$i-tgt-*.dat &
if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
# return codes of the actual client side tests to tell if
# everything started properly
exit 1
fi
done
# wait for servers to start
sleep ${startwait}
svr1=`cat $TMPBASE/svr-1.addr`
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment