Make wait_for_status robust against multiple calls at different times.
This change removes the dependency between wait_for_status? and
download? by checking for the staged directory if there is the
equivalent of a "cache" miss from the downloader_dict.
I also clean up a previous assumption in the downlaoder.
BUG=chromium-os:27285
TEST=Unittests + download followed by wait_for_status with
same archive_url and different. Got all expected results.
Also ran pylint on both devserver and downloader and fixed a cpl
bugs it caught.
Change-Id: I8c187cd64e40c12442de3e4be8fd4c12db7958f3
Reviewed-on: https://gerrit.chromium.org/gerrit/19263
Commit-Ready: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/downloader_unittest.py b/downloader_unittest.py
index e863485..693689a 100755
--- a/downloader_unittest.py
+++ b/downloader_unittest.py
@@ -113,6 +113,7 @@
self.mox.VerifyAll()
def testInteractionWithDevserver(self):
+ """Tests interaction between the downloader and devserver methods."""
artifacts = self._CommonDownloaderSetup()
class FakeUpdater():
static_dir = self._work_dir
@@ -133,6 +134,18 @@
self.assertTrue(status, 'Success')
self.mox.VerifyAll()
+ def testBuildStaged(self):
+ """Test whether we can correctly check if a build is previously staged."""
+ archive_url = 'x86-awesome-release/R99-1234.0-r1'
+ archive_url_non_staged = 'x86-awesome-release/R99-1234.0-r2'
+ # Create the directory to reflect staging.
+ os.makedirs(os.path.join(self._work_dir, archive_url))
+
+ self.assertTrue(downloader.Downloader.BuildStaged(archive_url,
+ self._work_dir))
+ self.assertFalse(downloader.Downloader.BuildStaged(archive_url_non_staged,
+ self._work_dir))
+
if __name__ == '__main__':
unittest.main()