diff options
author | Kyle Shimabukuro <kyleshima@chromium.org> | 2022-05-11 12:17:46 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-18 05:44:09 +0000 |
commit | 77ca4ba85006dfb3cddc6c7cdd6fc854f6a6c1eb (patch) | |
tree | 9421ccfd68d98ced1f3af90225b1c67ab35e8045 | |
parent | 074a5ef5d6d24b3dd3506ee43a8bb22e09e785c4 (diff) | |
download | autotest-77ca4ba85006dfb3cddc6c7cdd6fc854f6a6c1eb.tar.gz |
Use non-empty credentials in autoupdate tests
The default telemetry login uses an empty password, which will soon be
changed since empty passwords will be disallowed. Changing the default
password on the telemetry side breaks the AU tests, since they will use
the old (empty) password to sign in while on the source version, and the
new (non-empty) password to sign in on the target version.
To fix this, add arguments to login_LoginSuccess to specify the
credentials, and modify the AU server tests to explicitly pass in
consistent credentials. Even on m2n tests and autoupdate_EndToEndTest,
which provision the DUT to older milestones, the actual client test code
should come from the target build. This is because autotest downloads
the autotest artifacts from the chromeos-image-archive bucket using the
build in the job_repo_url, and pushes those to the DUT to run client
tests.
BUG=chromium:1325411
TEST=autoupdate_Basic.m2n.full, autoupdate_DataPreserved.m2n.full,
autoupdate_EndToEndTest.m2n.full
Change-Id: Ic919d4f8fd5edf4a26e6a27624698ad5f4feb98a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3642508
Reviewed-by: David Haddock <dhaddock@chromium.org>
Tested-by: Kyle Shimabukuro <kyleshima@chromium.org>
Commit-Queue: Kyle Shimabukuro <kyleshima@chromium.org>
5 files changed, 36 insertions, 10 deletions
diff --git a/client/cros/update_engine/update_engine_util.py b/client/cros/update_engine/update_engine_util.py index 96e19e1286..40808db56a 100644 --- a/client/cros/update_engine/update_engine_util.py +++ b/client/cros/update_engine/update_engine_util.py @@ -95,6 +95,9 @@ class UpdateEngineUtil(object): # Feature name _REPEATED_UPDATES_FEATURE = 'feature-repeated-updates' + # Credentials to use for the fake login in login tests. + _LOGIN_TEST_USERNAME = 'autotest' + _LOGIN_TEST_PASSWORD = 'password' def __init__(self, run_func=_DEFAULT_RUN, get_file=_DEFAULT_COPY): """ diff --git a/client/site_tests/autoupdate_UserData/autoupdate_UserData.py b/client/site_tests/autoupdate_UserData/autoupdate_UserData.py index 4c9a68a856..d347f3829e 100644 --- a/client/site_tests/autoupdate_UserData/autoupdate_UserData.py +++ b/client/site_tests/autoupdate_UserData/autoupdate_UserData.py @@ -82,7 +82,9 @@ class autoupdate_UserData(update_engine_test.UpdateEngineTest): def _perform_after_update_checks(self): """Check the user preferences and files are the same.""" with chrome.Chrome(dont_override_profile=True, - autotest_ext=True) as cr: + autotest_ext=True, + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD) as cr: # Check test file is still present. if not os.path.exists(self._TEST_FILE): raise error.TestFail('Test file was not present after update.') @@ -113,7 +115,9 @@ class autoupdate_UserData(update_engine_test.UpdateEngineTest): if payload_url: with nebraska_wrapper.NebraskaWrapper( log_dir=self.resultsdir, payload_url=payload_url) as nebraska: - with chrome.Chrome(autotest_ext=True) as cr: + with chrome.Chrome(autotest_ext=True, + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD) as cr: self._cr = cr utils.run(['echo', 'hello', '>', self._TEST_FILE]) self._modify_input_methods() diff --git a/client/site_tests/login_LoginSuccess/login_LoginSuccess.py b/client/site_tests/login_LoginSuccess/login_LoginSuccess.py index f1f0ced9af..50225cd3e7 100644 --- a/client/site_tests/login_LoginSuccess/login_LoginSuccess.py +++ b/client/site_tests/login_LoginSuccess/login_LoginSuccess.py @@ -39,12 +39,16 @@ class login_LoginSuccess(test.test): def run_once(self, stress_run=False, arc_mode=None, + username=None, + password=None, dont_override_profile=False): """ Runs the test. @param stress_run: True if we are doing a stress run and want to double the timeout. + @param username: Username to use instead of the default telemetry one. + @param password: Password to use instead of the default telemetry one. @param arc_mode: This value is passed to Chrome and determines how the ARC/Android instance should start. Possible values are defined in common_lib/cros/arc_common.py. @@ -55,6 +59,8 @@ class login_LoginSuccess(test.test): self._SESSION_STOP_TIMEOUT *= 2 self._listener.listen_for_session_state_change('started') with chrome.Chrome(arc_mode=arc_mode, + username=username, + password=password, dont_override_profile=dont_override_profile): self._listener.wait_for_signals(desc='Session started.', timeout=self._SESSION_START_TIMEOUT) diff --git a/server/site_tests/autoupdate_Basic/autoupdate_Basic.py b/server/site_tests/autoupdate_Basic/autoupdate_Basic.py index 6e6b2be7e4..88d3f90978 100644 --- a/server/site_tests/autoupdate_Basic/autoupdate_Basic.py +++ b/server/site_tests/autoupdate_Basic/autoupdate_Basic.py @@ -79,8 +79,11 @@ class autoupdate_Basic(update_engine_test.UpdateEngineTest): self._run_client_test_and_check_result(self._LOGIN_TEST_PIN, tag='before') else: - self._run_client_test_and_check_result(self._LOGIN_TEST, - tag='before') + self._run_client_test_and_check_result( + self._LOGIN_TEST, + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD, + tag='before') # Record DUT state before the update. active, inactive = kernel_utils.get_kernel_state(self._host) @@ -105,6 +108,9 @@ class autoupdate_Basic(update_engine_test.UpdateEngineTest): tag='after', setup_pin=False) else: - self._run_client_test_and_check_result(self._LOGIN_TEST, - tag='after', - dont_override_profile=True) + self._run_client_test_and_check_result( + self._LOGIN_TEST, + tag='after', + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD, + dont_override_profile=True) diff --git a/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py b/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py index 4f32646fc2..b02d6bacc8 100755 --- a/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py +++ b/server/site_tests/autoupdate_EndToEndTest/autoupdate_EndToEndTest.py @@ -137,10 +137,17 @@ class autoupdate_EndToEndTest(update_engine_test.UpdateEngineTest): update_url, host=self._host, is_release_bucket=True).run_provision() - self._run_client_test_and_check_result(self._LOGIN_TEST, - tag='source') + self._run_client_test_and_check_result( + self._LOGIN_TEST, + tag='source', + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD) # Start the update to the target image. self.run_update_test(test_conf, m2n) # Check we can login after the update. - self._run_client_test_and_check_result(self._LOGIN_TEST, tag='target') + self._run_client_test_and_check_result( + self._LOGIN_TEST, + tag='target', + username=self._LOGIN_TEST_USERNAME, + password=self._LOGIN_TEST_PASSWORD) |