Commit 6041d420 authored by rockot's avatar rockot Committed by Commit bot

Revert of [Telemetry] Fix WPR files not being downloaded when required....

Revert of [Telemetry] Fix WPR files not being downloaded when required. (patchset #4 id:60001 of https://codereview.chromium.org/834173006/)

Reason for revert:
Possible suspect for newly introduced telemetry unit test flake, e.g.:

https://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/1965/steps/telemetry_unittests/logs/stdio

Reverting to see what happens.

Original issue's description:
> [Telemetry] Fix WPR files not being downloaded when required.
>
> BUG=
>
> Committed: https://crrev.com/672e7140315568e9bfc442770a23fee66e045cb2
> Cr-Commit-Position: refs/heads/master@{#311496}

TBR=nednguyen@google.com,aiolos@chromium.org,lizeb@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/852863003

Cr-Commit-Position: refs/heads/master@{#311551}
parent 77f5922a
......@@ -182,7 +182,6 @@ class CloudStorageModuleStub(object):
self.local_file_hashes = {}
self.local_hash_files = {}
self.permission_level = CloudStorageModuleStub.INTERNAL_PERMISSION
self.downloaded_files = []
def SetPermissionLevelForTesting(self, permission_level):
self.permission_level = permission_level
......@@ -261,7 +260,6 @@ class CloudStorageModuleStub(object):
local_hash = self.local_file_hashes[local_path]
if only_if_changed and remote_hash == local_hash:
return False
self.downloaded_files.append(remote_path)
self.local_file_hashes[local_path] = remote_hash
self.local_hash_files[local_path + '.sha1'] = remote_hash
return remote_hash
......
......@@ -73,9 +73,12 @@ class WprArchiveInfo(object):
exists.
"""
# Download all .wpr files.
if self._data:
return
if not self._bucket:
logging.warning('User story set in %s has no bucket specified, and '
'cannot be downloaded from cloud_storage.', )
for archive_path in self._data['archives']:
archive_path = self._WprFileNameToPath(archive_path)
try:
......
......@@ -8,7 +8,6 @@ import tempfile
import unittest
from telemetry.page import page
from telemetry.unittest_util import system_stub
from telemetry.util import cloud_storage
from telemetry.wpr import archive_info
......@@ -60,23 +59,6 @@ class WprArchiveInfoTest(unittest.TestCase):
with open(file_path + '.sha1', 'rb') as f:
self.assertEquals(cloud_storage.CalculateHash(file_path), f.read())
def testDownloadArchivesIfNeeded(self):
overrides = system_stub.Override(archive_info, ['cloud_storage'])
try:
cloud_storage_stub = overrides.cloud_storage
# Second hash doesn't match, need to fetch it.
cloud_storage_stub.SetRemotePathsForTesting(
{cloud_storage.PUBLIC_BUCKET: {recording1: "dummyhash",
recording2: "dummyhash22"}})
cloud_storage_stub.SetCalculatedHashesForTesting(
{os.path.join(self.tmp_dir, recording1): "dummyhash",
os.path.join(self.tmp_dir, recording2): "dummyhash2",})
self.archive_info.DownloadArchivesIfNeeded()
self.assertEquals(len(cloud_storage_stub.downloaded_files), 1)
self.assertEquals(cloud_storage_stub.downloaded_files[0], recording2)
finally:
overrides.Restore()
def testReadingArchiveInfo(self):
self.assertIsNotNone(self.archive_info.WprFilePathForUserStory(page1))
self.assertEquals(recording1, os.path.basename(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment