3 .
"sh-tests/common.functions"
9 test -z "$tmpdir" && tmpdir
=/tmp
10 out1
="${tmpdir}/bnch$$.1"
11 out2
="${tmpdir}/bnch$$.2"
12 logdir
="${tmpdir}/bnch$$.d"
13 nc
="sh-tests/netcat.py"
15 if test "`type -t fiu-run`" = ''
17 echo ...skipped.
'(requires fiu tools from http://blitiri.com.ar/p/libfiu/)'
30 rm -rf "$logdir" "$out1" "$out2" ${tmpdir}/fiu-ctrl-
[0-9]*.
{in,out
}
40 ls -l -- "$@" |
awk '{ print $5 }'
44 trap catch HUP INT QUIT TERM
46 if [ ! -x .
/beanstalkd
]; then
47 echo "Executable ./beanstalkd not found; do you need to compile first?"
51 start_beanstalkd
$logdir "-s $size" "fiu-run -x"
53 # Insert enough jobs to create another binlog file
54 $nc $server $port <<EOF > "$out1"
56 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
58 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
60 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
62 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
64 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
76 test "$res" -eq 0 ||
exit $res
78 # Check that the second binlog file is present
79 test "$(fsize "$logdir"/binlog.2)" -eq $size ||
{
80 fail Second binlog
file is missing
83 # Make beanstalkd think the disk is full now.
84 fiu-ctrl
-e posix
/io
/oc
/open
-i $ENOSPC $bpid
86 # Insert enough jobs to create another binlog file
87 $nc $server $port <<EOF > "$out1"
89 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
91 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
93 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
95 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
97 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
109 test "$res" -eq 0 ||
exit $res
111 # Check that the first binlog file is still there
112 test -e "$logdir"/binlog
.1 || fail First binlog
file is missing
114 $nc $server $port <<EOF > "$out1"
135 test "$res" -eq 0 ||
exit $res
137 # Check that the first binlog file was deleted
138 test ! -e "$logdir"/binlog
.1 || fail First binlog
file is still there
140 # Now make beanstalkd think the disk once again has space.
141 fiu-ctrl
-d posix
/io
/oc
/open
$bpid
143 # Insert enough jobs to create another binlog file
144 $nc $server $port <<EOF > "$out1"
146 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
148 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
150 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
152 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
163 test "$res" -eq 0 ||
exit $res
167 start_beanstalkd
$logdir "-s $size"
169 $nc $server $port <<EOF > "$out2"