Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1624)

Unified Diff: appengine/swarming/handlers_endpoints_test.py

Issue 2212073002: Add endpoint and cron job to aggregate all dimensions and values (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Address nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/handlers_endpoints.py ('k') | appengine/swarming/handlers_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_endpoints_test.py
diff --git a/appengine/swarming/handlers_endpoints_test.py b/appengine/swarming/handlers_endpoints_test.py
index 14e13b99905637dc82b2ad58a1a67a624114c98e..b49b39dea722a19a32df5e02d8fddcfb3afe06bf 100755
--- a/appengine/swarming/handlers_endpoints_test.py
+++ b/appengine/swarming/handlers_endpoints_test.py
@@ -1491,6 +1491,39 @@ class BotsApiTest(BaseTest):
request = swarming_rpcs.BotsRequest(dimensions=['bad'])
self.call_api('count', body=message_to_dict(request), status=400)
+ def test_dimensions_ok(self):
+ """Asserts that BotsDimensions is returned with the right data."""
+ self.set_as_privileged_user()
+ now = datetime.datetime(2009, 1, 2, 3, 4, 5, 6)
+ self.mock_now(now)
+
+ bot_management.DimensionAggregation(
+ key=bot_management.DimensionAggregation.KEY,
+ dimensions=[
+ bot_management.DimensionValues(
+ dimension='foo', values=['alpha', 'beta']),
+ bot_management.DimensionValues(
+ dimension='bar', values=['gamma', 'delta', 'epsilon']),
+ ],
+ ts=now).put()
+
+ expected = {
+ u'bots_dimensions': [
+ {
+ u'key': 'foo',
+ u'value': [u'alpha', u'beta'],
+ },
+ {
+ u'key': 'bar',
+ u'value': [u'gamma', u'delta', u'epsilon'],
+ },
+ ],
+ u'ts': unicode(now.strftime(self.DATETIME_FORMAT)),
+ }
+
+ self.assertEqual(expected, self.call_api('dimensions', body={}).json)
+
+
class BotApiTest(BaseTest):
api_service_cls = handlers_endpoints.SwarmingBotService
« no previous file with comments | « appengine/swarming/handlers_endpoints.py ('k') | appengine/swarming/handlers_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698