Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/clusterfuzz/_internal/platforms/android/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@

def add_test_accounts_if_needed():
"""Add test account to work with GmsCore, etc."""
# Short-circuit: UWORKERs do not have Datastore access to retrieve
# credentials.
if environment.is_uworker():
return

last_test_account_check_time = persistent_cache.get_value(
constants.LAST_TEST_ACCOUNT_CHECK_KEY,
constructor=datetime.datetime.utcfromtimestamp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.
"""Tests for device functions."""

import unittest

from clusterfuzz._internal.platforms.android import device
from clusterfuzz._internal.tests.test_libs import android_helpers

Expand All @@ -23,3 +25,20 @@ class InitializeEnvironmentTest(android_helpers.AndroidTest):
def test(self):
"""Ensure that initialize_environment throws no exceptions."""
device.initialize_environment()


class AddTestAccountsIfNeededTest(unittest.TestCase):
"""Tests for add_test_accounts_if_needed."""

def setUp(self):
Comment thread
jardondiego marked this conversation as resolved.
from clusterfuzz._internal.tests.test_libs import helpers
helpers.patch(self, [
'clusterfuzz._internal.system.environment.is_uworker',
'clusterfuzz._internal.base.persistent_cache.get_value',
])

def test_uworker_bypass(self):
"""Test that uworker environment skips test account setup."""
self.mock.is_uworker.return_value = True
device.add_test_accounts_if_needed()
self.mock.get_value.assert_not_called()
Loading