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

Unified Diff: appengine/swarming/server/task_request_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/server/task_request_test.py
diff --git a/appengine/swarming/server/task_request_test.py b/appengine/swarming/server/task_request_test.py
index 84f43e6a38deabf0d0822a2aa4987aa91d2e8b9c..59f75439795ca924dd0959b8a8b29da8bdf14342 100755
--- a/appengine/swarming/server/task_request_test.py
+++ b/appengine/swarming/server/task_request_test.py
@@ -54,6 +54,10 @@ def _gen_request(properties=None, **kwargs):
'grace_period_secs': 30,
'idempotent': False,
'io_timeout_secs': None,
+ 'outputs_target': task_request.IsolatedOutputsTarget(
+ isolatedserver='https://isolateserver.appspot.com',
+ namespace='default-gzip',
+ ),
}
props.update(properties)
now = utils.utcnow()
@@ -208,6 +212,10 @@ class TaskRequestApiTest(TestCase):
'idempotent': True,
'inputs_ref': None,
'io_timeout_secs': None,
+ 'outputs_target': {
+ 'isolatedserver': 'https://isolateserver.appspot.com',
+ 'namespace': 'default-gzip',
+ },
'packages': [{'package_name': 'rm', 'version': PINNED_PACKAGE_VERSION}],
}
expected_request = {
@@ -218,7 +226,7 @@ class TaskRequestApiTest(TestCase):
'properties': expected_properties,
# Intentionally hard code the hash value since it has to be deterministic.
# Other unit tests should use the calculated value.
- 'properties_hash': '83b350298f05eff6072d54d2c6f031d06cc30449',
+ 'properties_hash': 'c145d80dcc95e0ff3b3160b7697f6136b81bc8bc',
'pubsub_topic': None,
'pubsub_userdata': None,
'tags': [
@@ -245,6 +253,7 @@ class TaskRequestApiTest(TestCase):
'isolatedserver': 'http://localhost:1',
'namespace': 'default-gzip',
},
+ 'outputs_target': None,
}))
# Hack: Would need to know about TaskResultSummary.
parent_id = task_pack.pack_request_key(parent.key) + '1'
@@ -264,6 +273,10 @@ class TaskRequestApiTest(TestCase):
'idempotent': True,
'inputs_ref': None,
'io_timeout_secs': None,
+ 'outputs_target': {
+ 'isolatedserver': 'https://isolateserver.appspot.com',
+ 'namespace': 'default-gzip',
+ },
'packages': [{'package_name': 'rm', 'version': PINNED_PACKAGE_VERSION}],
}
expected_request = {
@@ -274,7 +287,7 @@ class TaskRequestApiTest(TestCase):
'properties': expected_properties,
# Intentionally hard code the hash value since it has to be deterministic.
# Other unit tests should use the calculated value.
- 'properties_hash': '83b350298f05eff6072d54d2c6f031d06cc30449',
+ 'properties_hash': 'c145d80dcc95e0ff3b3160b7697f6136b81bc8bc',
'pubsub_topic': None,
'pubsub_userdata': None,
'tags': [
@@ -314,7 +327,7 @@ class TaskRequestApiTest(TestCase):
# Other unit tests should use the calculated value.
# Ensure the algorithm is deterministic.
self.assertEqual(
- '83b350298f05eff6072d54d2c6f031d06cc30449', as_dict['properties_hash'])
+ 'c145d80dcc95e0ff3b3160b7697f6136b81bc8bc', as_dict['properties_hash'])
def test_duped(self):
# Two TestRequest with the same properties.
@@ -431,7 +444,37 @@ class TaskRequestApiTest(TestCase):
with self.assertRaises(datastore_errors.BadValueError):
mkreq(_gen_request(properties=dict(
command=['see', 'spot', 'run'],
- inputs_ref=task_request.FilesRef())))
+ inputs_ref=task_request.FilesRef(
+ isolated='deadbeef',
+ isolatedserver='http://localhost:1',
+ namespace='default-gzip'),
+ outputs_target=None)))
+ with self.assertRaises(datastore_errors.BadValueError):
+ mkreq(_gen_request(properties=dict(
+ inputs_ref=task_request.FilesRef(),
+ outputs_target=None)))
+ with self.assertRaises(datastore_errors.BadValueError):
+ mkreq(_gen_request(properties=dict(
+ inputs_ref=task_request.FilesRef(
+ isolated='deadbeef',
+ isolatedserver='http://localhost:1',
+ namespace='default-gzip'),
+ outputs_target=task_request.IsolatedOutputsTarget())))
+ with self.assertRaises(datastore_errors.BadValueError):
+ mkreq(_gen_request(properties=dict(
+ outputs_target=task_request.IsolatedOutputsTarget())))
+ mkreq(_gen_request(properties=dict(
+ command=[],
+ inputs_ref=task_request.FilesRef(
+ isolated='deadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
+ isolatedserver='http://localhost:1',
+ namespace='default-gzip'),
+ outputs_target=None)))
+ mkreq(_gen_request(properties=dict(
+ outputs_target=task_request.IsolatedOutputsTarget(
+ isolatedserver='https://isolateserver.appspot.com',
+ namespace='default-gzip'))))
+
def test_make_request_clone(self):
# Compare with test_make_request().
@@ -458,6 +501,10 @@ class TaskRequestApiTest(TestCase):
'idempotent': False,
'inputs_ref': None,
'io_timeout_secs': None,
+ 'outputs_target': {
+ 'isolatedserver': 'https://isolateserver.appspot.com',
+ 'namespace': 'default-gzip',
+ },
'packages': [{'package_name': 'rm', 'version': PINNED_PACKAGE_VERSION}],
}
# Differences from make_request() are:

Powered by Google App Engine
This is Rietveld 408576698