Beispiel #1
0
 def setUp(self):
     self.original_environ = os.environ.copy()
     os.environ['DISABLE_CLOUD_STORAGE_IO'] = ''
     self.setUpPyfakefs()
     self.fs.CreateFile(
         os.path.join(util.GetCatapultDir(), 'third_party', 'gsutil',
                      'gsutil'))
Beispiel #2
0
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# All files in this directory should be moved to catapult/base/ after moving
# to the new repo.

import os
import sys

from catapult_base import util


def _AddDirToPythonPath(*path_parts):
    path = os.path.abspath(os.path.join(*path_parts))
    if os.path.isdir(path) and path not in sys.path:
        # Some callsite that use telemetry assumes that sys.path[0] is the directory
        # containing the script, so we add these extra paths to right after it.
        sys.path.insert(1, path)


_AddDirToPythonPath(os.path.join(util.GetCatapultDir(), 'third_party', 'mock'))
_AddDirToPythonPath(os.path.join(util.GetCatapultDir(), 'third_party', 'mox3'))
_AddDirToPythonPath(
    os.path.join(util.GetCatapultDir(), 'third_party', 'pyfakefs'))
Beispiel #3
0
PARTNER_BUCKET = 'chrome-partner-telemetry'
INTERNAL_BUCKET = 'chrome-telemetry'
TELEMETRY_OUTPUT = 'chrome-telemetry-output'

# Uses ordered dict to make sure that bucket's key-value items are ordered from
# the most open to the most restrictive.
BUCKET_ALIASES = collections.OrderedDict((
    ('public', PUBLIC_BUCKET),
    ('partner', PARTNER_BUCKET),
    ('internal', INTERNAL_BUCKET),
    ('output', TELEMETRY_OUTPUT),
))

BUCKET_ALIAS_NAMES = BUCKET_ALIASES.keys()

_GSUTIL_PATH = os.path.join(util.GetCatapultDir(), 'third_party', 'gsutil',
                            'gsutil')

# TODO(tbarzic): A workaround for http://crbug.com/386416 and
#     http://crbug.com/359293. See |_RunCommand|.
_CROS_GSUTIL_HOME_WAR = '/home/chromeos-test/'

# If Environment variables has DISABLE_CLOUD_STORAGE_IO set to '1', any method
# calls that invoke cloud storage network io will throw exceptions.
DISABLE_CLOUD_STORAGE_IO = 'DISABLE_CLOUD_STORAGE_IO'


class CloudStorageError(Exception):
    @staticmethod
    def _GetConfigInstructions():
        command = _GSUTIL_PATH
Beispiel #4
0
 def setUp(self):
     self.setUpPyfakefs()
     self.fs.CreateFile(
         os.path.join(util.GetCatapultDir(), 'third_party', 'gsutil',
                      'gsutil'))