Reland "Make the mton payload optional when staging artifacts."
Make the mton payload optional when staging artifacts.
Also fixes a bug where multiple wait_for_status calls
would not block.
Originally reviewed in: Ib6704594806de33cea38beb968e30304f1529211
BUG=chromium-os:29192
TEST=Unittests and run locally with x86-zgb-release/R20-2110.0.0-a1-b1695
Change-Id: I5052c0f095157c6f72bf84cbca34fe107eb8bf7a
Reviewed-on: https://gerrit.chromium.org/gerrit/20014
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Ready: Chris Sosa <sosa@chromium.org>
diff --git a/devserver_util_unittest.py b/devserver_util_unittest.py
index d65e7b0..15b41ff 100755
--- a/devserver_util_unittest.py
+++ b/devserver_util_unittest.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -99,6 +99,19 @@
self.assertEqual([full_url, nton_url, mton_url],
[full_url_out, nton_url_out, mton_url_out])
+ def testParsePartialPayloadList(self):
+ """Tests that we can parse a payload list with missing optional payload."""
+ archive_url_prefix = ('gs://chromeos-image-archive/x86-mario-release/'
+ 'R17-1413.0.0-a1-b1346/')
+ nton_url = (archive_url_prefix + 'chromeos_R17-1413.0.0-a1_'
+ 'R17-1413.0.0-a1_x86-mario_delta_dev.bin')
+ full_url = (archive_url_prefix + 'chromeos_R17-1413.0.0-a1_'
+ 'x86-mario_full_dev.bin')
+ full_url_out, nton_url_out, mton_url_out = (
+ devserver_util.ParsePayloadList([full_url, nton_url]))
+ self.assertEqual([full_url, nton_url, None],
+ [full_url_out, nton_url_out, mton_url_out])
+
def testInstallBuild(self):
# TODO(frankf): Implement this test
# self.fail('Not implemented.')
@@ -294,6 +307,38 @@
self.mox.VerifyAll()
+ def testGatherArtifactDownloadsWithoutMton(self):
+ """Gather the correct download requirements without mton delta."""
+ build = 'R17-1413.0.0-a1-b1346'
+ archive_url_prefix = ('gs://chromeos-image-archive/x86-mario-release/' +
+ build)
+ mock_data = 'mock data\nmock_data'
+ payloads = map(lambda x: '/'.join([archive_url_prefix, x]),
+ ['p1', 'p2'])
+ expected_payloads = payloads + map(
+ lambda x: '/'.join([archive_url_prefix, x]),
+ [downloadable_artifact.STATEFUL_UPDATE,
+ downloadable_artifact.AUTOTEST_PACKAGE,
+ downloadable_artifact.TEST_SUITES_PACKAGE])
+ self.mox.StubOutWithMock(gsutil_util, 'GSUtilRun')
+ self.mox.StubOutWithMock(devserver_util, 'ParsePayloadList')
+
+ # GSUtil ls.
+ gsutil_util.GSUtilRun(mox.StrContains(archive_url_prefix),
+ mox.IgnoreArg()).AndReturn(mock_data)
+ devserver_util.ParsePayloadList(mock_data.splitlines()).AndReturn(
+ payloads + [None])
+
+ self.mox.ReplayAll()
+ artifacts = devserver_util.GatherArtifactDownloads(
+ self._static_dir, archive_url_prefix, build, self._install_dir)
+ for index, artifact in enumerate(artifacts):
+ self.assertEqual(artifact._gs_path, expected_payloads[index])
+ self.assertTrue(artifact._tmp_staging_dir.startswith(self._static_dir))
+ print 'Will Download Artifact: %s' % artifact
+
+ self.mox.VerifyAll()
+
if __name__ == '__main__':
unittest.main()