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

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 more comments 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
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..7ce4c813d5218805c2fdff9cb37982d09f686765 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',
M-A Ruel 2016/08/05 18:55:27 bot_management.DimensionValues( dimension='foo
kjlubick 2016/08/05 19:00:52 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698