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

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: Rebase to latest master 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
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | client/run_isolated.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0ce4d540bccab5bc724d3e84c4f3cf593d46cc63..2feb95828ab875e2755667ae81d5db84e4685f31 100755
--- a/appengine/swarming/swarming_bot/bot_code/task_runner_test.py
+++ b/appengine/swarming/swarming_bot/bot_code/task_runner_test.py
@@ -358,9 +358,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] != \'-a\':\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'
@@ -373,9 +378,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,
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | client/run_isolated.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698