From ee198e3ba0b7b2df3b07c6f73056af90a5d46fab Mon Sep 17 00:00:00 2001
From: drebs <drebs@riseup.net>
Date: Wed, 1 Nov 2017 16:56:16 -0200
Subject: [PATCH] [benchmarks] make blob size configurable in scalability tests

---
 scripts/scalability/README.rst                |  2 +-
 scripts/scalability/makefile                  |  5 ++-
 .../test_controller/client/Blobs.conf         |  2 +-
 .../test_controller/client/makefile           | 37 ++++++++++---------
 4 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/scripts/scalability/README.rst b/scripts/scalability/README.rst
index a2d891a7..a8dd9ea3 100644
--- a/scripts/scalability/README.rst
+++ b/scripts/scalability/README.rst
@@ -33,4 +33,4 @@ Make sure an instance of the Test Controller Server is reachable at $(URI),
 and run:
 
   make install-client
-  make run-test
+  make test
diff --git a/scripts/scalability/makefile b/scripts/scalability/makefile
index 05ce1461..7afc0428 100644
--- a/scripts/scalability/makefile
+++ b/scripts/scalability/makefile
@@ -7,7 +7,8 @@
 # See the file README.rst for more information on how to use this makefile.
 
 
-URI ?= https://giraffe.cdev.bitmask.net:7001
+URI  ?= https://giraffe.cdev.bitmask.net:7001
+SIZE ?= 10
 
 PIDFILE = /tmp/test_controller.pid
 LOGFILE = /tmp/test_controller.log
@@ -47,4 +48,4 @@ install-client:
 	pip install ".[client]"
 
 test:
-	(cd test_controller/client && make test URI=$(URI))
+	(cd test_controller/client && make test URI=$(URI) SIZE=$(SIZE))
diff --git a/scripts/scalability/test_controller/client/Blobs.conf b/scripts/scalability/test_controller/client/Blobs.conf
index eea4b1cd..d5a2761f 100644
--- a/scripts/scalability/test_controller/client/Blobs.conf
+++ b/scripts/scalability/test_controller/client/Blobs.conf
@@ -2,7 +2,7 @@
 title=Blobs Scalability Tests
 description=Upload and download blobs
 url=http://giraffe.cdev.bitmask.net:2424/
-size=1
+size=10
 templates_dir=/tmp/templates
 
 [test_upload]
diff --git a/scripts/scalability/test_controller/client/makefile b/scripts/scalability/test_controller/client/makefile
index 97603cc4..131b5f00 100644
--- a/scripts/scalability/test_controller/client/makefile
+++ b/scripts/scalability/test_controller/client/makefile
@@ -42,37 +42,40 @@ bench-cpu: start-cpu bench-upload bench-download stop-cpu
 
 bench-mem: start-mem bench-upload bench-download stop-mem
 
-bench-upload: create-users delete-blobs
-	 fl-run-bench -f test_Blobs.py Blobs.test_upload
-	 fl-build-report --html results/blobs-bench.xml
+configure-size:
+	sed -i -e "s/size=[[:digit:]]\+/size=$(SIZE)/" Blobs.conf
 
-bench-download: create-users create-blobs
-	 fl-run-bench -f test_Blobs.py Blobs.test_download
-	 fl-build-report --html results/blobs-bench.xml
+bench-upload: configure-size create-users delete-blobs
+	fl-run-bench -f test_Blobs.py Blobs.test_upload
+	fl-build-report --html results/blobs-bench.xml
+
+bench-download: configure-size create-users create-blobs
+	fl-run-bench -f test_Blobs.py Blobs.test_download
+	fl-build-report --html results/blobs-bench.xml
 
 # for quick tests only
-bench-upload-quick: create-users delete-blobs
-	 fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_upload
+bench-upload-quick: configure-size create-users delete-blobs
+	fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_upload
 
 # for quick tests only
-bench-download-quick: create-users create-blobs
-	 fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_download
+bench-download-quick: configure-size create-users create-blobs
+	fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_download
 
 #---------------------#
 # resource monitoring #
 #---------------------#
 
 start-cpu:
-	 curl -X POST $(URI)/cpu
+	curl -X POST $(URI)/cpu
 
 stop-cpu:
-	 curl -X GET $(URI)/cpu
+	curl -X GET $(URI)/cpu
 
 start-mem:
-	 curl -X POST $(URI)/mem
+	curl -X POST $(URI)/mem
 
 stop-mem:
-	 curl -X GET $(URI)/mem
+	curl -X GET $(URI)/mem
 
 
 #--------------#
@@ -80,10 +83,10 @@ stop-mem:
 #--------------#
 
 create-users:
-	 curl -X POST $(URI)/users?create=1
+	curl -X POST $(URI)/users?create=1
 
 delete-blobs:
-	 curl -X POST "$(URI)/blobs?action=delete"
+	curl -X POST "$(URI)/blobs?action=delete"
 
 create-blobs:
-	 curl -X POST "$(URI)/blobs?action=create&size=$(SIZE)&amount=$(BLOBS)"
+	curl -X POST "$(URI)/blobs?action=create&size=$(SIZE)&amount=$(BLOBS)"
-- 
GitLab