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

Unified Diff: appengine/swarming/handlers_test.py

Issue 2249803003: Create Tasks.Tags endpoint and Cron job (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Docs 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_test.py ('k') | appengine/swarming/server/task_result.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_test.py
diff --git a/appengine/swarming/handlers_test.py b/appengine/swarming/handlers_test.py
index b02100305ac6978ceeb1d46fe10bf3e478bb0154..42caf30ede5796de48c451742edf38ddef0b3383 100755
--- a/appengine/swarming/handlers_test.py
+++ b/appengine/swarming/handlers_test.py
@@ -25,7 +25,7 @@ import handlers_frontend
from components import template
from server import bot_code
from server import bot_management
-
+from server import task_result
class AppTestBase(test_env_handlers.AppTestBase):
def setUp(self):
@@ -480,7 +480,6 @@ 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)
@@ -509,6 +508,32 @@ class BackendTest(AppTestBase):
ts=now)
self.assertEqual(expected, actual)
+ def testCronTagsAggregateTask(self):
+ self.set_as_admin()
+ now = datetime.datetime(2011, 1, 2, 3, 4, 5)
+ self.mock_now(now)
+
+ self.client_create_task_raw(tags=['alpha:beta', 'gamma:delta'])
+ self.client_create_task_raw(tags=['alpha:epsilon', 'zeta:theta'])
+
+ self.app.get('/internal/cron/aggregate_tasks_tags',
+ headers={'X-AppEngine-Cron': 'true'}, status=200)
+ actual = task_result.TagAggregation.KEY.get()
+ expected = task_result.TagAggregation(
+ key=task_result.TagAggregation.KEY,
+ tags=[
+ task_result.TagValues(tag='alpha', values=['beta', 'epsilon']),
+ task_result.TagValues(tag='gamma', values=['delta']),
+ task_result.TagValues(tag='os', values=['Amiga']),
+ task_result.TagValues(tag='pool', values=['default']),
+ task_result.TagValues(tag='priority', values=['10']),
+ task_result.TagValues(tag='user', values=['joe@localhost']),
+ task_result.TagValues(tag='zeta', values=['theta']),
+
+ ],
+ ts=now)
+ self.assertEqual(expected, actual)
+
def testCronTriggerTask(self):
triggers = (
'/internal/cron/trigger_cleanup_data',
« no previous file with comments | « appengine/swarming/handlers_endpoints_test.py ('k') | appengine/swarming/server/task_result.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698