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

Unified Diff: appengine/swarming/handlers_endpoints_test.py

Issue 1939343002: swarming: change meaning of inputs_ref (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: nit Created 4 years, 8 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 9484189448d83cf70eb5b3b29e47b8f76da23ba5..eef59314e8b71b934d151d9414c2008a6948c628 100755
--- a/appengine/swarming/handlers_endpoints_test.py
+++ b/appengine/swarming/handlers_endpoints_test.py
@@ -505,6 +505,70 @@ class TasksApiTest(BaseTest):
response = self.call_api('new', body=message_to_dict(request))
self.assertEqual(expected, response.json)
+ def test_new_ok_isolated_output(self):
+ """Asserts that new generates appropriate metadata."""
+ self.mock(random, 'getrandbits', lambda _: 0x88)
+ now = datetime.datetime(2010, 1, 2, 3, 4, 5)
+ self.mock_now(now)
+ str_now = unicode(now.strftime(self.DATETIME_NO_MICRO))
+ request = swarming_rpcs.NewTaskRequest(
+ expiration_secs=30,
+ name='job1',
+ priority=200,
+ properties=swarming_rpcs.TaskProperties(
+ command=['rm', '-rf', '/'],
+ dimensions=[
+ swarming_rpcs.StringPair(key='pool', value='default'),
+ swarming_rpcs.StringPair(key='foo', value='bar'),
+ ],
+ env=[
+ swarming_rpcs.StringPair(key='PATH', value='/'),
+ ],
+ execution_timeout_secs=30,
+ io_timeout_secs=30,
+ outputs_target=swarming_rpcs.IsolatedOutputsTarget(
+ isolatedserver='http://localhost:1',
+ namespace='default-gzip')),
+ tags=['foo:bar'],
+ user='joe@localhost')
+ expected = {
+ u'request': {
+ u'authenticated': u'user:user@example.com',
+ u'created_ts': str_now,
+ u'expiration_secs': u'30',
+ u'name': u'job1',
+ u'priority': u'200',
+ u'properties': {
+ u'command': [u'rm', u'-rf', u'/'],
+ u'dimensions': [
+ {u'key': u'foo', u'value': u'bar'},
+ {u'key': u'pool', u'value': u'default'},
+ ],
+ u'env': [
+ {u'key': u'PATH', u'value': u'/'},
+ ],
+ u'execution_timeout_secs': u'30',
+ u'grace_period_secs': u'30',
+ u'idempotent': False,
+ u'io_timeout_secs': u'30',
+ u'outputs_target': {
+ 'isolatedserver': 'http://localhost:1',
+ 'namespace': 'default-gzip',
+ },
+ },
+ u'tags': [
+ u'foo:bar',
+ u'pool:default',
+ u'priority:200',
+ u'user:joe@localhost',
+ ],
+ u'user': u'joe@localhost',
+ },
+ u'task_id': u'5cee488008810',
+ }
+ response = self.call_api('new', body=message_to_dict(request))
+ self.assertEqual(expected, response.json)
+
def test_list_ok(self):
"""Asserts that list requests all TaskResultSummaries."""
first, second, str_now_120, start, end = self._gen_two_tasks()

Powered by Google App Engine
This is Rietveld 408576698