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

Unified Diff: appengine/swarming/handlers_bot_test.py

Issue 2689483004: swarming: Add server-side implementation for supplemental bot_config (Closed)
Patch Set: Rebased Created 3 years, 10 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_bot.py ('k') | appengine/swarming/server/bot_groups_config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_bot_test.py
diff --git a/appengine/swarming/handlers_bot_test.py b/appengine/swarming/handlers_bot_test.py
index 43d5d1c6342323bf91e11798c5af6d1ff27033ca..e756bce97c4fb22adfab41b6e1fa53055de5951c 100755
--- a/appengine/swarming/handlers_bot_test.py
+++ b/appengine/swarming/handlers_bot_test.py
@@ -224,7 +224,7 @@ class BotApiTest(test_env_handlers.AppTestBase):
params['state']['bot_group_cfg_version'] = 'badversion'
response = self.post_json('/swarming/api/v1/bot/poll', params)
expected = {
- u'cmd': u'restart',
+ u'cmd': u'bot_restart',
u'message': u'Restarting to pick up new bots.cfg config',
}
self.assertEqual(expected, response)
@@ -245,8 +245,8 @@ class BotApiTest(test_env_handlers.AppTestBase):
params = self.do_handshake()
response = self.post_json('/swarming/api/v1/bot/poll', params)
expected = {
- u'cmd': u'restart',
- u'message': 'Mocked restart message',
+ u'cmd': u'host_reboot',
+ u'message': u'Mocked restart message',
}
self.assertEqual(expected, response)
@@ -435,7 +435,9 @@ class BotApiTest(test_env_handlers.AppTestBase):
require_service_account=None,
ip_whitelist=None,
owners=None,
- dimensions={u'pool': [u'server-side']})
+ dimensions={u'pool': [u'server-side']},
+ bot_config_script=None,
+ bot_config_script_content=None)
self.mock(bot_auth, 'validate_bot_id_and_fetch_config',
lambda *args, **kwargs: cfg)
@@ -462,6 +464,22 @@ class BotApiTest(test_env_handlers.AppTestBase):
},
}], actions)
+ def test_poll_extra_bot_config(self):
+ cfg = bot_groups_config.BotGroupConfig(
+ version='default',
+ require_luci_machine_token=False,
+ require_service_account=None,
+ ip_whitelist=None,
+ owners=None,
+ dimensions={},
+ bot_config_script='foo.py',
+ bot_config_script_content='print "Hi";import sys; sys.exit(1)')
+ self.mock(bot_auth, 'validate_bot_id_and_fetch_config',
+ lambda *args, **kwargs: cfg)
+ params = self.do_handshake()
+ self.assertEqual(
+ u'print "Hi";import sys; sys.exit(1)', params['bot_config'])
+
def test_complete_task_isolated(self):
# Successfully poll a task.
self.mock(random, 'getrandbits', lambda _: 0x88)
« no previous file with comments | « appengine/swarming/handlers_bot.py ('k') | appengine/swarming/server/bot_groups_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698