[appengine-afterburner] r33 committed - Add a test for samplez test mode.

0 views
Skip to first unread message

appengine-...@googlecode.com

unread,
Jul 18, 2011, 8:54:52 PM7/18/11
to appengine-after...@googlegroups.com
Revision: 33
Author: mike.aizatsky
Date: Mon Jul 18 17:54:05 2011
Log: Add a test for samplez test mode.


http://code.google.com/p/appengine-afterburner/source/detail?r=33

Modified:
/trunk/python/src/afterburner/experimental/samplez/samplez_test.py

=======================================
--- /trunk/python/src/afterburner/experimental/samplez/samplez_test.py Mon
Jul 18 17:27:33 2011
+++ /trunk/python/src/afterburner/experimental/samplez/samplez_test.py Mon
Jul 18 17:54:05 2011
@@ -947,6 +947,28 @@
## handler.get()
## self.assertTrue('Samplez sections' in response.out.getvalue())

+ def testMode(self):
+ """Tests using the module in test mode."""
+ section = samplez.Section(
+ 'My section',
+ samplez.Config(
+ 'first',
+ period=300,
+ rate=1,
+ samples=10000,
+ by_value=True))
+
+ # Just doing a set won't work because test mode isn't setup yet.
+ samplez.set(section, 'my key', 9999)
+
+ # Once test mode is setup then samples will be recorded.
+ samplez.setup_for_testing()
+ samplez.set(section, 'my key', 1234)
+ self.assertEquals([0], [r.get_count('my key') for r in
section.results()])
+
+ samplez.apply_for_testing()
+ self.assertEquals([1], [r.get_count('my key') for r in
section.results()])
+
def testConfig(self):
"""Tests config validation."""
# Bad name.

Reply all
Reply to author
Forward
0 new messages