autoupdate.py: Deprecate autoupdate.py
This mechanism is not used in the lab anymore and has been replaced by
gs_cache/nebraska_wrapper.py in crrev.com/c/2258234.
BUG=chromium:1078188
TEST=./devserver_integration_test.py
Change-Id: Ifa007df983aab49c808360df6ba0b62b7031221c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2486466
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/devserver_integration_test.py b/devserver_integration_test.py
index 64a492f..89c5d19 100755
--- a/devserver_integration_test.py
+++ b/devserver_integration_test.py
@@ -26,12 +26,8 @@
from string import Template
-from xml.dom import minidom
-
import requests
-from six.moves import urllib
-
import psutil # pylint: disable=import-error
import setup_chromite # pylint: disable=unused-import
@@ -215,64 +211,6 @@
self.pid = None
self.devserver = None
-
- def VerifyHandleUpdate(self, label, use_test_payload=True,
- appid='{DEV-BUILD}'):
- """Verifies that we can send an update request to the devserver.
-
- This method verifies (using a fake update_request blob) that the devserver
- can interpret the payload and give us back the right payload.
-
- Args:
- label: Label that update is served from e.g. <board>-release/<version>
- use_test_payload: If set to true, expects to serve payload under
- testdata/ and does extra checks i.e. compares hash and content of
- payload.
- appid: The APP ID of the board.
-
- Returns:
- url of the update payload if we verified the update.
- """
- update_label = '/'.join([UPDATE, label])
- response = self._MakeRPC(
- update_label, data=UPDATE_REQUEST.substitute({'appid': appid}),
- critical_update=True)
- self.assertNotEqual('', response)
- self.assertIn('deadline="now"', response)
-
- # Parse the response and check if it contains the right result.
- dom = minidom.parseString(response)
- update = dom.getElementsByTagName('updatecheck')[0]
- expected_static_url = '/'.join([self.devserver_url, STATIC, label])
- url = self.VerifyV3Response(update, expected_static_url)
-
- # Verify the image we download is correct since we already know what it is.
- if use_test_payload:
- connection = urllib.request.urlopen(url)
- contents = connection.read().decode('utf-8')
- connection.close()
- self.assertEqual('Developers, developers, developers!\n', contents)
-
- return url
-
- def VerifyV3Response(self, update, expected_static_url):
- """Verifies the update DOM from a v3 response and returns the url."""
- # Parse the response and check if it contains the right result.
- urls = update.getElementsByTagName('urls')[0]
- url = urls.getElementsByTagName('url')[0]
-
- static_url = url.getAttribute('codebase')
- # Static url's end in /.
- self.assertEqual(expected_static_url + '/', static_url)
-
- manifest = update.getElementsByTagName('manifest')[0]
- packages = manifest.getElementsByTagName('packages')[0]
- package = packages.getElementsByTagName('package')[0]
- filename = package.getAttribute('name')
- self.assertEqual(TEST_UPDATE_PAYLOAD_NAME, filename)
-
- return os.path.join(static_url, filename)
-
def _MakeRPC(self, rpc, data=None, timeout=None, **kwargs):
"""Makes an RPC call to the devserver.
@@ -338,9 +276,6 @@
they are lumped with the remote tests here.
"""
- def testHandleUpdateV3(self):
- self.VerifyHandleUpdate(label=LABEL)
-
def testXBuddyLocalAlias(self):
"""Extensive local image xbuddy unittest.
@@ -375,7 +310,7 @@
xbuddy_path = '/'.join([build_id, item])
logging.info('Testing xbuddy path %s', xbuddy_path)
- response = self._MakeRPC('/'.join([XBUDDY, xbuddy_path]))
+ response = self._MakeRPC('/'.join([XBUDDY, xbuddy_path]), timeout=3)
self.assertEqual(response, data)
expected_dir = '/'.join([self.devserver_url, STATIC, build_id])
@@ -386,14 +321,6 @@
relative_path=True)
self.assertEqual(response, build_id)
- logging.info('Verifying the actual payload data')
- url = self.VerifyHandleUpdate(build_id, use_test_payload=False)
- logging.info('Verify the actual content of the update payload')
- connection = urllib.request.urlopen(url)
- contents = connection.read().decode('utf-8')
- connection.close()
- self.assertEqual(update_data, contents)
-
def testPidFile(self):
"""Test that using a pidfile works correctly."""
with open(self.pidfile, 'r') as f:
@@ -412,37 +339,6 @@
2) time. These tests actually download the artifacts needed.
"""
- def testStageAndUpdate(self):
- """Tests core stage/update autotest workflow where with a test payload."""
- build_id = 'eve-release/R78-12499.0.0'
- archive_url = 'gs://chromeos-image-archive/%s' % build_id
-
- response = self._MakeRPC(IS_STAGED, archive_url=archive_url,
- artifacts='full_payload,stateful')
- self.assertEqual(response, 'False')
-
- logging.info('Staging update artifacts')
- self._MakeRPC(STAGE, archive_url=archive_url,
- artifacts='full_payload,stateful')
- logging.info('Staging complete. '
- 'Verifying files exist and are staged in the staging '
- 'directory.')
- response = self._MakeRPC(IS_STAGED, archive_url=archive_url,
- artifacts='full_payload,stateful')
- self.assertEqual(response, 'True')
- staged_dir = os.path.join(self.test_data_path, build_id)
- self.assertTrue(os.path.isdir(staged_dir))
- self.assertTrue(os.path.exists(
- os.path.join(staged_dir, devserver_constants.UPDATE_FILE)))
- self.assertTrue(os.path.exists(
- os.path.join(staged_dir, devserver_constants.UPDATE_METADATA_FILE)))
- self.assertTrue(os.path.exists(
- os.path.join(staged_dir, devserver_constants.STATEFUL_FILE)))
-
- logging.info('Verifying we can update using the stage update artifacts.')
- self.VerifyHandleUpdate(build_id, use_test_payload=False,
- appid='{01906EA2-3EB2-41F1-8F62-F0B7120EFD2E}')
-
@unittest.skip('crbug.com/640063 Broken test.')
def testStageAutotestAndGetPackages(self):
"""Another stage/update autotest workflow test with a test payload."""