Chromium Code Reviews| Index: appengine/swarming/handlers_test.py |
| diff --git a/appengine/swarming/handlers_test.py b/appengine/swarming/handlers_test.py |
| index 1b02abf1dfa558a05dad5f24e1df44a87d06ab36..b043b3a499bc10c9faea16ebcb70d09d76ccb6ae 100755 |
| --- a/appengine/swarming/handlers_test.py |
| +++ b/appengine/swarming/handlers_test.py |
| @@ -4,6 +4,7 @@ |
| # Use of this source code is governed under the Apache License, Version 2.0 |
| # that can be found in the LICENSE file. |
| +import datetime |
| import itertools |
| import json |
| import logging |
| @@ -479,6 +480,35 @@ class BackendTest(AppTestBase): |
| # The actual number doesn't matter, just make sure they are unqueued. |
| self.execute_tasks() |
| + |
| + def testCronBotsAggregateTask(self): |
| + # Tests that the aggregation works |
| + now = datetime.datetime(2010, 1, 2, 3, 4, 5) |
| + self.mock_now(now) |
| + |
| + bot_management.bot_event( |
| + event_type='bot_connected', bot_id='id1', |
| + external_ip='8.8.4.4', authenticated_as='bot:whitelisted-ip', |
| + dimensions={'foo': ['beta'], 'id': ['id1']}, state={'ram': 65}, |
| + version='123456789', quarantined=False, task_id=None, task_name=None) |
| + bot_management.bot_event( |
| + event_type='bot_connected', bot_id='id2', |
| + external_ip='8.8.4.4', authenticated_as='bot:whitelisted-ip', |
| + dimensions={'foo': ['alpha'], 'id': ['id2']}, state={'ram': 65}, |
| + version='123456789', quarantined=True, task_id='987', task_name=None) |
| + |
| + self.app.get('/internal/cron/aggregate_bots_dimensions', |
| + headers={'X-AppEngine-Cron': 'true'}, status=200) |
| + actual = bot_management.DimensionAggregation.KEY.get() |
| + expected = bot_management.DimensionAggregation( |
| + key=bot_management.DimensionAggregation.KEY, |
| + dimensions=[ |
| + bot_management.DimensionValues(dimension='foo', |
|
M-A Ruel
2016/08/05 18:41:46
weird alignment.
kjlubick
2016/08/05 18:51:54
Fixed, I think.
|
| + values=['alpha', 'beta']) |
| + ], |
| + ts=now) |
| + self.assertEqual(expected, actual) |
| + |
| def testCronTriggerTask(self): |
| triggers = ( |
| '/internal/cron/trigger_cleanup_data', |