Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make `python test_sauropod.py` run the full loadtest suite

  • Loading branch information...
commit 0bfbfbb899282ce581def0df16afa209e2ec71eb 1 parent cd5b66b
@rfk rfk authored
View
20 loadtest/README.txt
@@ -4,25 +4,17 @@ See here for more details on FunkLoad:
http://funkload.nuxeo.org/
-To successfully run the tests, you will need to provision a Sauropod table
+To successfully run the loadtest, you will need to provision a Sauropod table
for the audience "http://sauropod.mozillalabs.com"::
node provision.js http://sauropod.mozillalabs.com
-Then disable assertion checking for sessions, and run Sauropod on localhost
-port 8001 for use by the tests::
+Run Sauropod on localhost port 8001 in mock mode::
- node main.js
+ node main.js mock
-Confirm that your setup is working by running a single instance of the test
-suite::
+Then you can run through the full loadtest suite by doing::
- fl-run-test test_sauropod.py
+ python test_sauropod.py
-Then you can run the loadtest by doing::
-
- fl-run-bench test_sauropod.py SauropodTests.test_write_read_seq
-
-And generate some pretty graphs with::
-
- fl-build-report --html --output-directory=html sauropod-bench.xml
+This will execute the tests and write reports into the "html" directory.
View
6 loadtest/SauropodTests.conf
@@ -12,7 +12,9 @@ num_users = 98
[test_write_read_seq]
description=Sequential write of keys, then sequential read
-num_keys = 20
+
+[test_contention_for_single_key]
+description=Concurrent read/write of a single key
# ------------------------------------------------------------
# Generic funkload configurtion
@@ -28,7 +30,7 @@ sleep_time_max = 0
# Configuration for bench mode fl-run-bench
#
[bench]
-cycles = 10:50:100
+cycles = 10:50:100:150:200
duration = 45
startup_delay = 0.01
sleep_time = 0.01
View
34 loadtest/test_sauropod.py
@@ -69,7 +69,7 @@ def test_write_read_seq(self):
This test does a simple sequential write of a bunch of keys, then
reads them all back in the same order.
"""
- num_keys = int(self.conf_get("test_write_read_seq", "num_keys"))
+ num_keys = 20
self.start_session()
# Write out a bunch of keys.
for i in range(num_keys):
@@ -78,3 +78,35 @@ def test_write_read_seq(self):
for i in range(num_keys):
value = self.get_key("key%d" % (i,))
self.assertEquals(value, "value%d" % (i,))
+
+ def test_contention_for_single_key(self):
+ """Test contention for a single key.
+
+ This test does a bunch of reads and writes of a single key, to
+ see how we go under hotly contested scenarios.
+ """
+ self.start_session("user1@moz.com")
+ for i in range(20):
+ self.set_key("hot-key", "we all want this key baby")
+ value = self.get_key("hot-key")
+ self.assertEquals(value, "we all want this key baby")
+
+
+if __name__ == "__main__":
+ import os
+ import sys
+ import subprocess
+ # Sanity-check the setup by running a single instance of the tests.
+ print "SANITY-CHECKING YOUR SETUP"
+ subprocess.check_call(["fl-run-test", __file__])
+ # Now we can run the full benchmark suite.
+ for methnm in dir(SauropodTests):
+ if not methnm.startswith("test_"):
+ continue
+ print "RUNNING THE BENCHMARK", methnm
+ subprocess.check_call(["fl-run-bench", __file__,
+ "SauropodTests." + methnm])
+ print "GENERATING THE REPORT"
+ subprocess.check_call(["fl-build-report", "--html",
+ "--output-directory=html",
+ "sauropod-bench.xml"])
Please sign in to comment.
Something went wrong with that request. Please try again.