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

Unified Diff: appengine/swarming/swarming_bot/bot_code/task_runner_test.py

Issue 2443663002: Pass args in file from task_runner to run_isolated (Closed)
Patch Set: Respond to code review comments other than changes to options processing Created 4 years, 2 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/swarming_bot/bot_code/task_runner_test.py
diff --git a/appengine/swarming/swarming_bot/bot_code/task_runner_test.py b/appengine/swarming/swarming_bot/bot_code/task_runner_test.py
index 83a7f85e64e490a00d91dbdfd4fec4be049e4093..7435b5a289a38e96bda3d172102cc08555dbde8f 100755
--- a/appengine/swarming/swarming_bot/bot_code/task_runner_test.py
+++ b/appengine/swarming/swarming_bot/bot_code/task_runner_test.py
@@ -363,9 +363,14 @@ class TestTaskRunner(TestTaskRunnerBase):
# Mock running run_isolated with a script.
SCRIPT_ISOLATED = (
'import json, sys;\n'
- 'if len(sys.argv) != 2:\n'
- ' raise Exception(sys.argv);\n'
- 'with open(sys.argv[1], \'wb\') as f:\n'
+ 'args = []\n'
+ 'if len(sys.argv) != 3 or sys.argv[1] != \'-f\':\n'
+ ' raise Exception(sys.argv)\n'
+ 'with open(sys.argv[2], \'r\') as argsfile:\n'
+ ' args = json.loads(argsfile.read())\n'
+ 'if len(args) != 1:\n'
+ ' raise Exception(args);\n'
+ 'with open(args[0], \'wb\') as f:\n'
' json.dump({\n'
' \'exit_code\': 0,\n'
' \'had_hard_timeout\': False,\n'
@@ -378,9 +383,13 @@ class TestTaskRunner(TestTaskRunnerBase):
' }, f)\n'
'sys.stdout.write(\'hi\\n\')')
self.mock(
- task_runner, 'get_isolated_cmd',
+ task_runner, 'get_run_isolated',
+ lambda :
+ [sys.executable, '-u', '-c', SCRIPT_ISOLATED])
+ self.mock(
+ task_runner, 'get_isolated_args',
lambda _work_dir, _details, isolated_result, bot_file, min_free_space:
- [sys.executable, '-u', '-c', SCRIPT_ISOLATED, isolated_result])
+ [isolated_result])
expected = {
u'exit_code': 0,
u'hard_timeout': False,

Powered by Google App Engine
This is Rietveld 408576698