Remove duplicated logic to detect tasks running on devicelab.
The logic was duplicated in os_util and test_util. This CL is removing
the method from test_utils.
Change-Id: Id20f86793099cd6e44cbac772cc233bde0601e1f
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/54687
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Keyong Han <keyonghan@google.com>
diff --git a/recipe_modules/flutter_deps/__init__.py b/recipe_modules/flutter_deps/__init__.py
index 3bf54f3..3183b15 100644
--- a/recipe_modules/flutter_deps/__init__.py
+++ b/recipe_modules/flutter_deps/__init__.py
@@ -1,9 +1,9 @@
DEPS = [
'depot_tools/depot_tools',
'flutter/android_virtual_device',
+ 'flutter/os_utils',
'flutter/osx_sdk',
'flutter/repo_util',
- 'flutter/test_utils',
'flutter/token_util',
'recipe_engine/cas',
'recipe_engine/cipd',
diff --git a/recipe_modules/flutter_deps/api.py b/recipe_modules/flutter_deps/api.py
index 4610e5c..b531e1c 100644
--- a/recipe_modules/flutter_deps/api.py
+++ b/recipe_modules/flutter_deps/api.py
@@ -611,7 +611,7 @@
"""
with self.m.step.nest('Prepare code signing'):
# Unlock keychain for devicelab tasks.
- if self.m.test_utils.is_devicelab_bot():
+ if self.m.os_utils.is_devicelab():
self.m.step(
'unlock login keychain',
['unlock_login_keychain.sh'],
diff --git a/recipe_modules/os_utils/api.py b/recipe_modules/os_utils/api.py
index 41cf039..857e42a 100644
--- a/recipe_modules/os_utils/api.py
+++ b/recipe_modules/os_utils/api.py
@@ -188,9 +188,7 @@
infra_step=True
)
self.m.step(
- 'kill adb', ['killall', '-9', 'adb'],
- ok_ret='any',
- infra_step=True
+ 'kill adb', ['killall', '-9', 'adb'], ok_ret='any', infra_step=True
)
self.m.step(
'kill Xcode', ['killall', '-9', 'Xcode'],
@@ -870,7 +868,9 @@
)
def is_devicelab(self):
- return str(self.m.swarming.bot_id).startswith('flutter-devicelab')
+ return str(self.m.swarming.bot_id).startswith('flutter-devicelab') or str(
+ self.m.swarming.bot_id
+ ).startswith('flutter-win')
def is_ios(self):
device_os = self.m.properties.get('device_os', '')
diff --git a/recipe_modules/test_utils/api.py b/recipe_modules/test_utils/api.py
index 6350e00..41572fc 100644
--- a/recipe_modules/test_utils/api.py
+++ b/recipe_modules/test_utils/api.py
@@ -106,12 +106,12 @@
return True
return False
- def is_devicelab_bot(self):
- """Whether the current bot is a devicelab bot or not."""
- return (
- str(self.m.swarming.bot_id).startswith('flutter-devicelab') or
- str(self.m.swarming.bot_id).startswith('flutter-win')
- )
+ #def is_devicelab_bot(self):
+ # """Whether the current bot is a devicelab bot or not."""
+ # return (
+ # str(self.m.swarming.bot_id).startswith('flutter-devicelab') or
+ # str(self.m.swarming.bot_id).startswith('flutter-win')
+ # )
def run_test(
self,
diff --git a/recipe_modules/test_utils/examples/full.py b/recipe_modules/test_utils/examples/full.py
index fd4a941..2594cf3 100644
--- a/recipe_modules/test_utils/examples/full.py
+++ b/recipe_modules/test_utils/examples/full.py
@@ -15,7 +15,6 @@
def RunSteps(api):
api.test_utils.run_test('mytest', ['ls', '-la'])
- api.test_utils.is_devicelab_bot()
api.test_utils.test_step_name('test')
api.test_utils.flaky_step('test step')
env = {}
diff --git a/recipes/flutter/flutter_drone.py b/recipes/flutter/flutter_drone.py
index 4a18f69..9535f54 100644
--- a/recipes/flutter/flutter_drone.py
+++ b/recipes/flutter/flutter_drone.py
@@ -41,7 +41,7 @@
cmd_list.extend(['--local-web-sdk', env.get('LOCAL_WEB_SDK')])
# Default timeout for tasks in either devicelab or hostonly.
- default_timeout_secs = DEVICELAB_TIMEOUT_SECS if api.test_utils.is_devicelab_bot(
+ default_timeout_secs = DEVICELAB_TIMEOUT_SECS if api.os_utils.is_devicelab(
) else HOSTONLY_TIMEOUT_SECS
deps_timeout_secs = api.properties.get(
'test_timeout_secs'