diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-08-30 16:29:29 +0200 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-08-30 16:29:29 +0200 |
commit | 2bfb0965e2ad7cdd6df04d3b5d0e3bad4114b2e2 (patch) | |
tree | 36faeb12462fcc109055fc8954a4d143d357293a /service | |
parent | b4b2a882001f007c962f2676d6409ed691bf19e1 (diff) |
#761 added script to loadtest parallel attachment upload
Diffstat (limited to 'service')
-rw-r--r-- | service/test/load/attachment_load.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/service/test/load/attachment_load.sh b/service/test/load/attachment_load.sh new file mode 100644 index 00000000..740dd846 --- /dev/null +++ b/service/test/load/attachment_load.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +number=$1 +csrf=$2 +session=$3 + +if [ -z $sleep_time ] +then + sleep_time=0.5 +fi + +if [ -z $host ] +then + host='https://unstable.pixelated-project.org:8080' +fi + +echo "upload $number files" +echo "with csrf $csrf" +echo "and session $session" +echo "in $host" + +echo "Generating $number attachements of 5Mb size..." +for i in `seq 1 $number`; do + rm -rf /tmp/test$i + dd if=/dev/urandom of=/tmp/test$i bs=1M count=5 +done + +new_line="" + +echo "Uploading..." +for i in `seq 1 $number`; do + echo $new_line + echo "Attachment $i" + curl -sS -k -X POST --cookie "XSRF-TOKEN=$csrf; TWISTED_SESSION=$session;" \ + --header "X-XSRF-TOKEN=$csrf" -F attachment=@/tmp/test$i -F csrftoken=$csrf \ + $host/attachment & + sleep $sleep_time +done + +echo $new_line +echo "Done..." + |