[CalendarServer-changes] [15349] CalendarServer/trunk/contrib/performance/loadtest/test_sim.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 30 14:52:35 PST 2015


Revision: 15349
          http://trac.calendarserver.org//changeset/15349
Author:   cdaboo at apple.com
Date:     2015-11-30 14:52:34 -0800 (Mon, 30 Nov 2015)
Log Message:
-----------
Fix tests.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/test_sim.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_sim.py	2015-11-30 21:22:41 UTC (rev 15348)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_sim.py	2015-11-30 22:52:34 UTC (rev 15349)
@@ -38,7 +38,13 @@
 
 
 VALID_CONFIG = {
-    'server': 'tcp:127.0.0.1:8008',
+    'servers': {
+        "PodA": {
+            "enabled": True,
+            "uri": 'http://example.org:1234/',
+            "stats": {"enabled": False},
+        },
+    },
     'webadmin': {
         'enabled': True,
         'HTTPPort': 8080,
@@ -121,11 +127,19 @@
         """
         calsim = CalendarClientSimulator(
             [self._user('alice'), self._user('bob'), self._user('carol')],
-            Populator(None), None, None, None, 'http://example.org:1234/', None, None)
+            Populator(None), None, None, None,
+            {
+                "PodA": {
+                    "enabled": True,
+                    "uri": 'http://example.org:1234/',
+                    "stats": {"enabled": False},
+                },
+            },
+            None, None)
         users = sorted([
-            calsim._createUser(0)[0],
-            calsim._createUser(1)[0],
-            calsim._createUser(2)[0],
+            calsim._createUser(0)[1],
+            calsim._createUser(1)[1],
+            calsim._createUser(2)[1],
         ])
         self.assertEqual(['alice', 'bob', 'carol'], users)
 
@@ -137,8 +151,16 @@
         """
         calsim = CalendarClientSimulator(
             [self._user('alice')],
-            Populator(None), None, None, None, 'http://example.org:1234/', None, None)
-        user, auth = calsim._createUser(0)
+            Populator(None), None, None, None,
+            {
+                "PodA": {
+                    "enabled": True,
+                    "uri": 'http://example.org:1234/',
+                    "stats": {"enabled": False},
+                },
+            },
+            None, None)
+        _ignore_record, user, auth = calsim._createUser(0)
         self.assertEqual(
             auth['basic'].passwd.find_user_password('Test Realm', 'http://example.org:1234/')[1],
             'password-' + user)
@@ -182,7 +204,15 @@
             [ProfileType(BrokenProfile, {'runResult': profileRunResult})])
         )
         sim = CalendarClientSimulator(
-            [self._user('alice')], Populator(None), None, params, None, 'http://example.com:1234/', None, None)
+            [self._user('alice')], Populator(None), None, params, None,
+            {
+                "PodA": {
+                    "enabled": True,
+                    "uri": 'http://example.org:1234/',
+                    "stats": {"enabled": False},
+                },
+            },
+            None, None)
         sim.add(1, 1)
         sim.stop()
         clientRunResult.errback(RuntimeError("Some fictional client problem"))
@@ -270,14 +300,20 @@
         with its own reactor and host and port information from the
         configuration file.
         """
-        server = 'http://127.0.0.7:1243/'
+        servers = {
+            "PodA": {
+                "enabled": True,
+                "uri": 'http://example.org:1234/',
+                "stats": {"enabled": False},
+            },
+        }
         reactor = object()
-        sim = LoadSimulator(server, None, None, None, None, None, None, reactor=reactor)
+        sim = LoadSimulator(servers, None, None, None, None, None, None, reactor=reactor)
         calsim = sim.createSimulator()
         self.assertIsInstance(calsim, CalendarClientSimulator)
         self.assertIsInstance(calsim.reactor, LagTrackingReactor)
         self.assertIdentical(calsim.reactor._reactor, reactor)
-        self.assertEquals(calsim.server, server)
+        self.assertEquals(calsim.servers, servers)
 
 
     def test_loadAccountsFromFile(self):
@@ -292,7 +328,8 @@
         config["accounts"] = {
             "loader": "contrib.performance.loadtest.sim.recordsFromCSVFile",
             "params": {
-                "path": accounts.path
+                "path": accounts.path,
+                "interleavePods": True,
             },
         }
         configpath = FilePath(self.mktemp())
@@ -321,7 +358,8 @@
         config["accounts"] = {
             "loader": "contrib.performance.loadtest.sim.recordsFromCSVFile",
             "params": {
-                "path": ""
+                "path": "",
+                "interleavePods": True,
             },
         }
         configpath = FilePath(self.mktemp())
@@ -417,10 +455,16 @@
         """
         config = FilePath(self.mktemp())
         config.setContent(
-            writePlistToString({"server": "https://127.0.0.3:8432/"})
+            writePlistToString({"servers": {
+                "PodA": {
+                    "enabled": True,
+                    "uri": 'https://127.0.0.3:8432/',
+                    "stats": {"enabled": False},
+                },
+            }})
         )
         sim = LoadSimulator.fromCommandLine(['--config', config.path])
-        self.assertEquals(sim.server, "https://127.0.0.3:8432/")
+        self.assertEquals(sim.servers["PodA"]["uri"], "https://127.0.0.3:8432/")
 
 
     def test_loadArrivalConfig(self):
@@ -460,7 +504,7 @@
 
         reactor = object()
         sim = LoadSimulator(
-            None, None, None, None, None, Arrival(FakeArrival, {'x': 3, 'y': 2}), None, reactor=reactor)
+            None, None, None, None, Arrival(FakeArrival, {'x': 3, 'y': 2}), None, reactor=reactor)
         arrival = sim.createArrivalPolicy()
         self.assertIsInstance(arrival, FakeArrival)
         self.assertIdentical(arrival.reactor, sim.reactor)
@@ -575,11 +619,16 @@
         """
         observers = [Observer()]
         sim = LoadSimulator(
-            "http://example.com:123/",
+            {
+                "PodA": {
+                    "enabled": True,
+                    "uri": 'http://example.org:1234/',
+                    "stats": {"enabled": False},
+                },
+            },
             "/principals/users/%s/",
             None,
             None,
-            None,
             Arrival(lambda reactor: NullArrival(), {}),
             None, observers, reactor=Reactor())
         io = StringIO()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151130/9d1935e8/attachment.html>


More information about the calendarserver-changes mailing list