From a7f93cec7999de04614d7adaf91c4348a3313e2e Mon Sep 17 00:00:00 2001
From: drebs <drebs@riseup.net>
Date: Sun, 29 Oct 2017 14:28:12 -0200
Subject: [benchmarks] add some orchestration to scalability tests

---
 .../scalability/test_controller/client/makefile    | 101 ++++++++++++++++++---
 1 file changed, 86 insertions(+), 15 deletions(-)

(limited to 'scripts/scalability/test_controller/client')

diff --git a/scripts/scalability/test_controller/client/makefile b/scripts/scalability/test_controller/client/makefile
index 33e67e25..e0a719a0 100644
--- a/scripts/scalability/test_controller/client/makefile
+++ b/scripts/scalability/test_controller/client/makefile
@@ -1,19 +1,90 @@
-bench: upload download
+# test_controller/client/makefile
+# ===============================
+#
+# This file is part of the client-side infrastructure for Server Scalability
+# Tests. The client-side is responsible for orchestrating the benchmarking by
+# setting up server resources needed for the tests.
+#
+# What this file does
+# -------------------
+#
+# This makefile knows how to:
+#
+#   - Start and stop server-side system resource monitoring.
+#
+#   - Setup server-side resources for tests (user dbs, access tokens and blobs).
+#
+#   - Orchestrate test runs using the client-side machinery.
+#
+#   - Generate reports and save test results.
+#
+# Running tests
+# -------------
+#
+# To run tests, make sure a Test Controller Server is reachable at $(URI) and
+# run `make`.
 
-upload:
-	curl -X POST "http://127.0.0.1:7001/blobs?action=delete"
-	fl-run-bench -f test_Blobs.py Blobs.test_upload
-	fl-build-report --html results/blobs-bench.xml
 
-download:
-	curl -X POST "http://127.0.0.1:7001/blobs?action=create&size=10&amount=5000"
-	fl-run-bench -f test_Blobs.py Blobs.test_download
-	fl-build-report --html results/blobs-bench.xml
+URI    = https://giraffe.cdev.bitmask.net:7001
+CREATE = 5000
 
-test_upload:
-	curl -X POST "http://127.0.0.1:7001/blobs?action=delete"
-	fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_upload
 
-test_download:
-	curl -X POST "http://127.0.0.1:7001/blobs?action=create&size=10"
-	fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_download
+#------------------#
+# main test target #
+#------------------#
+
+test: bench
+
+bench: bench-cpu bench-mem
+
+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
+
+bench-download: 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
+	 curl -X POST "$(URI)/blobs?action=delete"
+	 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
+	 curl -X POST "$(URI)/blobs?action=create&size=10"
+	 fl-run-bench -c 1 --duration 10 -f test_Blobs.py Blobs.test_download
+
+#---------------------#
+# resource monitoring #
+#---------------------#
+
+start-cpu:
+	 curl -X POST $(URI)/cpu
+
+stop-cpu:
+	 curl -X GET $(URI)/cpu
+
+start-mem:
+	 curl -X POST $(URI)/mem
+
+stop-mem:
+	 curl -X GET $(URI)/mem
+
+
+#--------------#
+# server setup #
+#--------------#
+
+create-users:
+	 curl -X POST $(URI)/users?create=$(CREATE)
+
+delete-blobs:
+	 curl -X POST "$(URI)/blobs?action=delete"
+
+create-blobs:
+	 curl -X POST "$(URI)/blobs?action=create&size=10&amount=5000"
-- 
cgit v1.2.3