diff --git a/tools/performance/stresstest_templates.sh b/tools/performance/stresstest_templates.sh new file mode 100755 index 00000000..d6888cf0 --- /dev/null +++ b/tools/performance/stresstest_templates.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +verbose=no +tiler_url=http://dev.localhost.lan:8181/tiles/template +apikey=${CDB_APIKEY} + +while test -n "$1"; do + if test "$1" = "-k"; then + shift + apikey="$1" + elif test "$1" = "-u"; then + shift + tiler_url="$1" + elif test -z "$tpl"; then + tpl="$1" + else + echo "Unused parameter $1" >&2 + fi + shift +done + +if test -z "$tpl"; then + echo "Usage: $0 [-v] [-k ] [-u ] " >&2 + echo "Default is ${tiler_url}" >&2 + echo "Default is read from CDB_APIKEY env variable" >&2 + exit 1 +fi + +basedir=$(cd $(dirname $0); cd ..; pwd) +export CDB_APIKEY=${apikey} +max=3000000 +i=0 +while test "$i" -le "$max"; do + tpl_id=`${basedir}/create_template -u ${tiler_url} ${tpl}` + if test $? -ne 0; then + echo $tpl_id >&2 + break + fi + tpl_id=`${basedir}/update_template -u ${tiler_url} ${tpl_id} ${tpl}` + if test $? -ne 0; then + echo $tpl_id >&2 + break + fi + out=`${basedir}/delete_template -u ${tiler_url} ${tpl_id}` + if test $? -ne 0; then + echo $out >&2 + break + fi + i=$((i+1)) + if test `expr $i % 100` -eq 0; then + echo -n "." + fi +done