Cleanup tests' import of debug_logger
Change-Id: I19ca860deaa6dbf388bdcd1f0b0f77f72ff19689
This commit is contained in:
parent
8823b45b93
commit
2a312d1cd5
@ -44,7 +44,8 @@ from swift.common.utils import set_swift_dir
|
||||
|
||||
from test import get_config, listen_zero
|
||||
|
||||
from test.unit import debug_logger, FakeMemcache
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeMemcache
|
||||
# importing skip_if_no_xattrs so that functional tests can grab it from the
|
||||
# test.functional namespace. Importing SkipTest so this works under both
|
||||
# nose and testr test runners.
|
||||
|
@ -49,8 +49,7 @@ from swift.common.storage_policy import (StoragePolicy, ECStoragePolicy,
|
||||
VALID_EC_TYPES)
|
||||
from swift.common.utils import Timestamp, md5
|
||||
from test import get_config
|
||||
# import to namespace for backward compat
|
||||
from test.debug_logger import debug_logger, DebugLogger, FakeLogger # noqa
|
||||
from test.debug_logger import FakeLogger
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.ring import Ring, RingData, RingBuilder
|
||||
from swift.obj import server
|
||||
|
@ -23,7 +23,8 @@ import random
|
||||
from swift.account import auditor
|
||||
from swift.common.storage_policy import POLICIES
|
||||
from swift.common.utils import Timestamp
|
||||
from test.unit import debug_logger, patch_policies, with_tempdir
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies, with_tempdir
|
||||
from test.unit.account.test_backend import (
|
||||
AccountBrokerPreTrackContainerCountSetup)
|
||||
|
||||
|
@ -29,6 +29,7 @@ from swift.common.exceptions import ClientException
|
||||
from swift.common.utils import normalize_timestamp, Timestamp
|
||||
|
||||
from test import unit
|
||||
from test.debug_logger import debug_logger
|
||||
from swift.common.storage_policy import StoragePolicy, POLICIES
|
||||
|
||||
|
||||
@ -208,7 +209,7 @@ class TestReaper(unittest.TestCase):
|
||||
r = reaper.AccountReaper(conf)
|
||||
r.myips = myips
|
||||
if fakelogger:
|
||||
r.logger = unit.debug_logger('test-reaper')
|
||||
r.logger = debug_logger('test-reaper')
|
||||
return r
|
||||
|
||||
def fake_reap_account(self, *args, **kwargs):
|
||||
@ -302,7 +303,7 @@ class TestReaper(unittest.TestCase):
|
||||
conf = {
|
||||
'mount_check': 'false',
|
||||
}
|
||||
r = reaper.AccountReaper(conf, logger=unit.debug_logger())
|
||||
r = reaper.AccountReaper(conf, logger=debug_logger())
|
||||
mock_path = 'swift.account.reaper.direct_delete_object'
|
||||
for policy in POLICIES:
|
||||
r.reset_stats()
|
||||
@ -566,7 +567,7 @@ class TestReaper(unittest.TestCase):
|
||||
|
||||
def test_reap_account(self):
|
||||
containers = ('c1', 'c2', 'c3', 'c4')
|
||||
broker = FakeAccountBroker(containers, unit.FakeLogger())
|
||||
broker = FakeAccountBroker(containers, debug_logger())
|
||||
self.called_amount = 0
|
||||
self.r = r = self.init_reaper({}, fakelogger=True)
|
||||
r.start_time = time.time()
|
||||
@ -602,7 +603,7 @@ class TestReaper(unittest.TestCase):
|
||||
self.assertEqual(len(self.r.account_ring.devs), 3)
|
||||
|
||||
def test_reap_account_no_container(self):
|
||||
broker = FakeAccountBroker(tuple(), unit.FakeLogger())
|
||||
broker = FakeAccountBroker(tuple(), debug_logger())
|
||||
self.r = r = self.init_reaper({}, fakelogger=True)
|
||||
self.called_amount = 0
|
||||
r.start_time = time.time()
|
||||
@ -739,7 +740,7 @@ class TestReaper(unittest.TestCase):
|
||||
container_reaped[0] += 1
|
||||
|
||||
fake_ring = FakeRing()
|
||||
fake_logger = unit.FakeLogger()
|
||||
fake_logger = debug_logger()
|
||||
with patch('swift.account.reaper.AccountBroker',
|
||||
FakeAccountBroker), \
|
||||
patch(
|
||||
@ -804,7 +805,7 @@ class TestReaper(unittest.TestCase):
|
||||
self.assertFalse(foo.called)
|
||||
|
||||
with patch('swift.account.reaper.AccountReaper.reap_device') as foo:
|
||||
r.logger = unit.debug_logger('test-reaper')
|
||||
r.logger = debug_logger('test-reaper')
|
||||
r.devices = 'thisdeviceisbad'
|
||||
r.run_once()
|
||||
self.assertTrue(r.logger.get_lines_for_level(
|
||||
|
@ -20,7 +20,6 @@ import posix
|
||||
import unittest
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
from test.unit import FakeLogger
|
||||
import itertools
|
||||
import random
|
||||
from io import BytesIO
|
||||
@ -38,8 +37,8 @@ from swift.account.server import AccountController
|
||||
from swift.common.utils import (normalize_timestamp, replication, public,
|
||||
mkdirs, storage_directory, Timestamp)
|
||||
from swift.common.request_helpers import get_sys_meta_prefix, get_reserved_name
|
||||
from test.unit import patch_policies, debug_logger, mock_check_drive, \
|
||||
make_timestamp_iter
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies, mock_check_drive, make_timestamp_iter
|
||||
from swift.common.storage_policy import StoragePolicy, POLICIES
|
||||
|
||||
|
||||
@ -2626,7 +2625,7 @@ class TestAccountController(unittest.TestCase):
|
||||
self.assertEqual(self.logger.get_lines_for_level('info'), [])
|
||||
|
||||
def test_GET_log_requests_true(self):
|
||||
self.controller.logger = FakeLogger()
|
||||
self.controller.logger = debug_logger()
|
||||
self.controller.log_requests = True
|
||||
|
||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
||||
@ -2635,7 +2634,7 @@ class TestAccountController(unittest.TestCase):
|
||||
self.assertTrue(self.controller.logger.log_dict['info'])
|
||||
|
||||
def test_GET_log_requests_false(self):
|
||||
self.controller.logger = FakeLogger()
|
||||
self.controller.logger = debug_logger()
|
||||
self.controller.log_requests = False
|
||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
||||
resp = req.get_response(self.controller)
|
||||
@ -2646,7 +2645,7 @@ class TestAccountController(unittest.TestCase):
|
||||
req = Request.blank(
|
||||
'/sda1/p/a',
|
||||
environ={'REQUEST_METHOD': 'HEAD', 'REMOTE_ADDR': '1.2.3.4'})
|
||||
self.controller.logger = FakeLogger()
|
||||
self.controller.logger = debug_logger()
|
||||
with mock.patch(
|
||||
'time.time',
|
||||
mock.MagicMock(side_effect=[10000.0, 10001.0, 10002.0,
|
||||
@ -2655,9 +2654,9 @@ class TestAccountController(unittest.TestCase):
|
||||
'os.getpid', mock.MagicMock(return_value=1234)):
|
||||
req.get_response(self.controller)
|
||||
self.assertEqual(
|
||||
self.controller.logger.log_dict['info'],
|
||||
[(('1.2.3.4 - - [01/Jan/1970:02:46:42 +0000] "HEAD /sda1/p/a" 404 '
|
||||
'- "-" "-" "-" 2.0000 "-" 1234 -',), {})])
|
||||
self.controller.logger.get_lines_for_level('info'),
|
||||
['1.2.3.4 - - [01/Jan/1970:02:46:42 +0000] "HEAD /sda1/p/a" 404 '
|
||||
'- "-" "-" "-" 2.0000 "-" 1234 -'])
|
||||
|
||||
def test_policy_stats_with_legacy(self):
|
||||
ts = itertools.count()
|
||||
|
@ -24,7 +24,7 @@ from swift.common.middleware.crypto import crypto_utils
|
||||
from swift.common.middleware.crypto.crypto_utils import (
|
||||
CRYPTO_KEY_CALLBACK, Crypto, CryptoWSGIContext)
|
||||
from swift.common.swob import HTTPException
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.crypto.crypto_helpers import fetch_crypto_keys
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class TestCryptoWsgiContext(unittest.TestCase):
|
||||
app = None
|
||||
crypto = Crypto({})
|
||||
|
||||
self.fake_logger = FakeLogger()
|
||||
self.fake_logger = debug_logger()
|
||||
self.crypto_context = CryptoWSGIContext(
|
||||
FakeFilter(), 'object', self.fake_logger)
|
||||
|
||||
|
@ -28,7 +28,7 @@ from swift.common.middleware.crypto.crypto_utils import CRYPTO_KEY_CALLBACK, \
|
||||
from swift.common.swob import Request, HTTPException, HTTPOk, \
|
||||
HTTPPreconditionFailed, HTTPNotFound, HTTPPartialContent, bytes_to_wsgi
|
||||
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.crypto.crypto_helpers import md5hex, \
|
||||
fetch_crypto_keys, FAKE_IV, encrypt, fake_get_crypto_meta
|
||||
from test.unit.common.middleware.helpers import FakeSwift, FakeAppThatExcepts
|
||||
@ -52,7 +52,7 @@ class TestDecrypterObjectRequests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.app = FakeSwift()
|
||||
self.decrypter = decrypter.Decrypter(self.app, {})
|
||||
self.decrypter.logger = FakeLogger()
|
||||
self.decrypter.logger = debug_logger()
|
||||
|
||||
def _make_response_headers(self, content_length, plaintext_etag, keys,
|
||||
body_key, key_id=None):
|
||||
@ -983,7 +983,7 @@ class TestDecrypterContainerRequests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.app = FakeSwift()
|
||||
self.decrypter = decrypter.Decrypter(self.app, {})
|
||||
self.decrypter.logger = FakeLogger()
|
||||
self.decrypter.logger = debug_logger()
|
||||
|
||||
def _make_cont_get_req(self, resp_body, format, override=False,
|
||||
callback=fetch_crypto_keys):
|
||||
|
@ -30,7 +30,8 @@ from swift.common.swob import (
|
||||
wsgi_to_bytes, bytes_to_wsgi)
|
||||
from swift.common.utils import FileLikeIter
|
||||
|
||||
from test.unit import FakeLogger, EMPTY_ETAG
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import EMPTY_ETAG
|
||||
from test.unit.common.middleware.crypto.crypto_helpers import (
|
||||
fetch_crypto_keys, md5hex, FAKE_IV, encrypt)
|
||||
from test.unit.common.middleware.helpers import FakeSwift, FakeAppThatExcepts
|
||||
@ -42,7 +43,7 @@ class TestEncrypter(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.app = FakeSwift()
|
||||
self.encrypter = encrypter.Encrypter(self.app, {})
|
||||
self.encrypter.logger = FakeLogger()
|
||||
self.encrypter.logger = debug_logger()
|
||||
|
||||
def _verify_user_metadata(self, req_hdrs, name, value, key):
|
||||
# verify encrypted version of user metadata
|
||||
|
@ -29,7 +29,8 @@ from swift.common.ring import Ring
|
||||
from swift.common.swob import Request, str_to_wsgi
|
||||
from swift.obj import diskfile
|
||||
|
||||
from test.unit import FakeLogger, skip_if_no_xattrs
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import skip_if_no_xattrs
|
||||
from test.unit.common.middleware.crypto.crypto_helpers import (
|
||||
md5hex, encrypt, TEST_KEYMASTER_CONF)
|
||||
from test.unit.helpers import setup_servers, teardown_servers
|
||||
@ -438,7 +439,7 @@ class TestCryptoPipelineChanges(unittest.TestCase):
|
||||
partition, nodes = ring_object.get_nodes('a', self.container_name, 'o')
|
||||
conf = {'devices': self._test_context["testdir"],
|
||||
'mount_check': 'false'}
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[policy]
|
||||
ondisk_data = []
|
||||
exp_enc_body = None
|
||||
for node_index, node in enumerate(nodes):
|
||||
|
@ -24,7 +24,8 @@ from swift.common.request_helpers import is_user_meta, \
|
||||
from swift.common.swob import HTTPNotImplemented
|
||||
from swift.common.utils import split_path, md5
|
||||
|
||||
from test.unit import FakeLogger, FakeRing
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeRing
|
||||
|
||||
|
||||
class LeakTrackingIter(object):
|
||||
@ -88,7 +89,7 @@ class FakeSwift(object):
|
||||
self.uploaded = {}
|
||||
# mapping of (method, path) --> (response class, headers, body)
|
||||
self._responses = {}
|
||||
self.logger = FakeLogger('fake-swift')
|
||||
self.logger = debug_logger('fake-swift')
|
||||
self.account_ring = FakeRing()
|
||||
self.container_ring = FakeRing()
|
||||
self.get_object_ring = lambda policy_index: FakeRing()
|
||||
|
@ -24,7 +24,7 @@ from swift.common import swob
|
||||
from swift.common.middleware.s3api.s3api import filter_factory
|
||||
from swift.common.middleware.s3api.etree import fromstring
|
||||
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.s3api.helpers import FakeSwift
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ from swift.common.utils import md5
|
||||
from keystonemiddleware.auth_token import AuthProtocol
|
||||
from keystoneauth1.access import AccessInfoV2
|
||||
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.s3api import S3ApiTestCase
|
||||
from test.unit.common.middleware.s3api.helpers import FakeSwift
|
||||
from test.unit.common.middleware.s3api.test_s3token import \
|
||||
|
@ -35,7 +35,7 @@ from swift.common.middleware.s3api.s3response import InvalidArgument, \
|
||||
AccessDenied, SignatureDoesNotMatch, RequestTimeTooSkewed, BadDigest
|
||||
from swift.common.utils import md5
|
||||
|
||||
from test.unit import DebugLogger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
Fake_ACL_MAP = {
|
||||
# HEAD Bucket
|
||||
@ -110,7 +110,7 @@ class TestRequest(S3ApiTestCase):
|
||||
'Date': self.get_date_header()})
|
||||
s3_req = req_klass(req.environ, conf=self.s3api.conf)
|
||||
s3_req.set_acl_handler(
|
||||
get_acl_handler(s3_req.controller_name)(s3_req, DebugLogger()))
|
||||
get_acl_handler(s3_req.controller_name)(s3_req, debug_logger()))
|
||||
with patch('swift.common.middleware.s3api.s3request.S3Request.'
|
||||
'_get_response') as mock_get_resp, \
|
||||
patch('swift.common.middleware.s3api.subresource.ACL.'
|
||||
|
@ -27,7 +27,7 @@ from shutil import rmtree
|
||||
from tempfile import mkdtemp
|
||||
from eventlet import sleep
|
||||
from mock import patch, call
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.helpers import FakeSwift
|
||||
from swift.common import utils, constraints
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
|
@ -26,7 +26,7 @@ from swift.common.middleware import container_sync
|
||||
from swift.proxy.controllers.base import get_cache_key
|
||||
from swift.proxy.controllers.info import InfoController
|
||||
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
|
||||
class FakeApp(object):
|
||||
@ -90,7 +90,7 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
def test_current_invalid(self):
|
||||
self.conf = {'swift_dir': self.tempdir, 'current': 'foo'}
|
||||
self.sync = container_sync.ContainerSync(self.app, self.conf,
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
self.assertIsNone(self.sync.realm)
|
||||
self.assertIsNone(self.sync.cluster)
|
||||
info = {}
|
||||
@ -136,7 +136,7 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
def test_missing_from_realms_conf(self):
|
||||
self.conf = {'swift_dir': self.tempdir, 'current': 'foo/bar'}
|
||||
self.sync = container_sync.ContainerSync(self.app, self.conf,
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
self.assertEqual('FOO', self.sync.realm)
|
||||
self.assertEqual('BAR', self.sync.cluster)
|
||||
info = {}
|
||||
|
@ -23,7 +23,8 @@ from swift.common.middleware import copy
|
||||
from swift.common.storage_policy import POLICIES
|
||||
from swift.common.swob import Request, HTTPException
|
||||
from swift.common.utils import closing_if_possible, md5
|
||||
from test.unit import patch_policies, debug_logger, FakeRing
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies, FakeRing
|
||||
from test.unit.common.middleware.helpers import FakeSwift
|
||||
from test.unit.proxy.controllers.test_obj import set_http_connect, \
|
||||
PatchedObjControllerApp
|
||||
|
@ -20,7 +20,7 @@ from swift.common.swob import Request, Response
|
||||
from swift.common.http import HTTP_FORBIDDEN
|
||||
from swift.common.utils import split_path
|
||||
from swift.proxy.controllers.base import get_cache_key
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
UNKNOWN_ID = keystoneauth.UNKNOWN_ID
|
||||
|
||||
@ -97,7 +97,7 @@ class FakeApp(object):
|
||||
class SwiftAuth(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.test_auth = keystoneauth.filter_factory({})(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
|
||||
def _make_request(self, path=None, headers=None, **kwargs):
|
||||
if not path:
|
||||
@ -352,7 +352,7 @@ class SwiftAuthMultiple(SwiftAuth):
|
||||
def setUp(self):
|
||||
self.test_auth = keystoneauth.filter_factory(
|
||||
{'reseller_prefix': 'AUTH, PRE2'})(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
|
||||
|
||||
class ServiceTokenFunctionality(unittest.TestCase):
|
||||
@ -541,7 +541,7 @@ class ServiceTokenFunctionality(unittest.TestCase):
|
||||
class BaseTestAuthorize(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.test_auth = keystoneauth.filter_factory({})(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
|
||||
def _make_request(self, path, **kwargs):
|
||||
return Request.blank(path, **kwargs)
|
||||
@ -929,7 +929,7 @@ class TestAuthorize(BaseTestAuthorizeCheck):
|
||||
def test_names_allowed_in_acls_inside_default_domain_with_config(self):
|
||||
conf = {'allow_names_in_acls': 'yes'}
|
||||
self.test_auth = keystoneauth.filter_factory(conf)(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
id = self._get_identity_for_v2(user_domain_id='default',
|
||||
project_domain_id='default')
|
||||
env = {'keystone.token_info': _fake_token_info(version='3')}
|
||||
@ -956,7 +956,7 @@ class TestAuthorize(BaseTestAuthorizeCheck):
|
||||
def test_names_disallowed_in_acls_inside_default_domain(self):
|
||||
conf = {'allow_names_in_acls': 'false'}
|
||||
self.test_auth = keystoneauth.filter_factory(conf)(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
id = self._get_identity_for_v2(user_domain_id='default',
|
||||
project_domain_id='default')
|
||||
env = {'keystone.token_info': _fake_token_info(version='3')}
|
||||
@ -1278,7 +1278,7 @@ class TestIsNameAllowedInACLWithConfiguredDomain(TestIsNameAllowedInACL):
|
||||
super(TestIsNameAllowedInACLWithConfiguredDomain, self).setUp()
|
||||
conf = {'default_domain_id': 'mydefault'}
|
||||
self.test_auth = keystoneauth.filter_factory(conf)(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
self.default_id = 'mydefault'
|
||||
|
||||
|
||||
@ -1303,7 +1303,7 @@ class TestSetProjectDomain(BaseTestAuthorize):
|
||||
project_domain_id=req_project_domain_id)
|
||||
|
||||
# reset fake logger
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
num_warnings = 0
|
||||
|
||||
# check account requests
|
||||
@ -1519,7 +1519,7 @@ class TestAuthorizeReader(BaseTestAuthorizeCheck):
|
||||
def _setup(self, system_reader_roles):
|
||||
self.test_auth = keystoneauth.filter_factory(
|
||||
{}, system_reader_roles=system_reader_roles)(FakeApp())
|
||||
self.test_auth.logger = FakeLogger()
|
||||
self.test_auth.logger = debug_logger()
|
||||
|
||||
# Zero test: make sure that reader role has no default access
|
||||
# when not in the list of system_reader_roles[].
|
||||
|
@ -19,7 +19,7 @@ import unittest
|
||||
from swift.common.swob import Request, HTTPOk, HTTPNoContent
|
||||
from swift.common.middleware import listing_formats
|
||||
from swift.common.request_helpers import get_reserved_name
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.helpers import FakeSwift
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ from swift.common.middleware import proxy_logging
|
||||
from swift.common.swob import Request, Response
|
||||
from swift.common import constraints
|
||||
from swift.common.storage_policy import StoragePolicy
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies
|
||||
from test.unit.common.middleware.helpers import FakeAppThatExcepts
|
||||
|
||||
|
@ -19,7 +19,7 @@ import eventlet
|
||||
import mock
|
||||
from contextlib import contextmanager
|
||||
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
from swift.common.middleware import ratelimit
|
||||
from swift.proxy.controllers.base import get_cache_key, \
|
||||
headers_to_container_info
|
||||
@ -147,7 +147,7 @@ class TestRateLimit(unittest.TestCase):
|
||||
'container_ratelimit_50': 100,
|
||||
'container_ratelimit_75': 30}
|
||||
test_ratelimit = ratelimit.filter_factory(conf_dict)(FakeApp())
|
||||
test_ratelimit.logger = FakeLogger()
|
||||
test_ratelimit.logger = debug_logger()
|
||||
self.assertIsNone(ratelimit.get_maxrate(
|
||||
test_ratelimit.container_ratelimits, 0))
|
||||
self.assertIsNone(ratelimit.get_maxrate(
|
||||
@ -319,7 +319,7 @@ class TestRateLimit(unittest.TestCase):
|
||||
'account_whitelist': 'a',
|
||||
'account_blacklist': 'b'}
|
||||
self.test_ratelimit = ratelimit.filter_factory(conf_dict)(FakeApp())
|
||||
self.test_ratelimit.logger = FakeLogger()
|
||||
self.test_ratelimit.logger = debug_logger()
|
||||
self.test_ratelimit.BLACK_LIST_SLEEP = 0
|
||||
req = Request.blank('/v1/b/c')
|
||||
req.environ['swift.cache'] = FakeMemcache()
|
||||
|
@ -18,7 +18,7 @@ import unittest
|
||||
|
||||
from swift.common.middleware import read_only
|
||||
from swift.common.swob import Request
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
|
||||
class FakeApp(object):
|
||||
@ -43,7 +43,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={}):
|
||||
@ -59,7 +59,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={}):
|
||||
@ -79,7 +79,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
conf = {}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={'sysmeta': {'read-only': 'true'}}):
|
||||
@ -99,7 +99,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
conf = {}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={'sysmeta': {'read-only': 'false'}}):
|
||||
@ -115,7 +115,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={'sysmeta': {'read-only': 'false'}}):
|
||||
@ -132,7 +132,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={}):
|
||||
@ -147,7 +147,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch('swift.common.middleware.read_only.get_info',
|
||||
return_value={'sysmeta': {'read-only': 'on'}}):
|
||||
@ -162,7 +162,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
def get_fake_read_only(*args, **kwargs):
|
||||
if 'b' in args:
|
||||
@ -181,7 +181,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
conf = {}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
def get_fake_read_only(*args, **kwargs):
|
||||
if 'b' in args:
|
||||
@ -200,7 +200,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
conf = {}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
def fake_account_read_only(self, req, account):
|
||||
if account == 'a':
|
||||
@ -221,7 +221,7 @@ class TestReadOnly(unittest.TestCase):
|
||||
conf = {}
|
||||
|
||||
ro = read_only.filter_factory(conf)(FakeApp())
|
||||
ro.logger = FakeLogger()
|
||||
ro.logger = debug_logger()
|
||||
|
||||
with mock.patch(
|
||||
'swift.common.middleware.read_only.ReadOnlyMiddleware.' +
|
||||
|
@ -18,7 +18,7 @@ from swift.common.middleware import copy, proxy_logging
|
||||
from swift.common.swob import Request, HTTPOk
|
||||
from swift.common.utils import close_if_possible
|
||||
from swift.common.wsgi import make_subrequest
|
||||
from test.unit import FakeLogger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common.middleware.helpers import FakeSwift
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class FakeFilter(object):
|
||||
|
||||
class FakeApp(object):
|
||||
def __init__(self, conf):
|
||||
self.fake_logger = FakeLogger()
|
||||
self.fake_logger = debug_logger()
|
||||
self.fake_swift = self.app = FakeSwift()
|
||||
self.register = self.fake_swift.register
|
||||
for filter in reversed([
|
||||
|
@ -22,14 +22,15 @@ import six
|
||||
|
||||
from mock import patch
|
||||
from swift.common.container_sync_realms import ContainerSyncRealms
|
||||
from test.unit import FakeLogger, temptree
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import temptree
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
||||
def test_no_file_there(self):
|
||||
unique = uuid.uuid4().hex
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
csr = ContainerSyncRealms(unique, logger)
|
||||
self.assertEqual(
|
||||
logger.all_log_lines(),
|
||||
@ -43,7 +44,7 @@ class TestUtils(unittest.TestCase):
|
||||
fname = 'container-sync-realms.conf'
|
||||
fcontents = ''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
|
||||
def _mock_getmtime(path):
|
||||
@ -65,7 +66,7 @@ class TestUtils(unittest.TestCase):
|
||||
fname = 'container-sync-realms.conf'
|
||||
fcontents = ''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(logger.all_log_lines(), {})
|
||||
@ -76,7 +77,7 @@ class TestUtils(unittest.TestCase):
|
||||
fname = 'container-sync-realms.conf'
|
||||
fcontents = 'invalid'
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
if six.PY2:
|
||||
@ -103,7 +104,7 @@ key = 9ff3b71c849749dbaec4ccdd3cbab62b
|
||||
cluster_dfw1 = http://dfw1.host/v1/
|
||||
'''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(logger.all_log_lines(), {})
|
||||
@ -131,7 +132,7 @@ key2 = f6351bd1cc36413baa43f7ba1b45e51d
|
||||
cluster_lon3 = http://lon3.host/v1/
|
||||
'''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(logger.all_log_lines(), {})
|
||||
@ -155,7 +156,7 @@ cluster_lon3 = http://lon3.host/v1/
|
||||
[US]
|
||||
'''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(logger.all_log_lines(), {})
|
||||
@ -173,7 +174,7 @@ cluster_lon3 = http://lon3.host/v1/
|
||||
mtime_check_interval = invalid
|
||||
'''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(
|
||||
@ -187,7 +188,7 @@ mtime_check_interval = invalid
|
||||
fname = 'container-sync-realms.conf'
|
||||
fcontents = ''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
self.assertEqual(
|
||||
|
@ -28,7 +28,7 @@ from collections import defaultdict
|
||||
import errno
|
||||
|
||||
from swift.common import daemon, utils
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
|
||||
class MyDaemon(daemon.Daemon):
|
||||
|
@ -23,7 +23,7 @@ from shutil import rmtree
|
||||
from eventlet import Timeout
|
||||
|
||||
from swift.common.db_auditor import DatabaseAuditor
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
|
||||
class FakeDatabaseBroker(object):
|
||||
|
@ -40,7 +40,8 @@ from swift.common.exceptions import DriveNotMounted
|
||||
from swift.common.swob import HTTPException
|
||||
|
||||
from test import unit
|
||||
from test.unit import FakeLogger, attach_fake_replication_rpc
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import attach_fake_replication_rpc
|
||||
from test.unit.common.test_db import ExampleBroker
|
||||
|
||||
|
||||
@ -303,7 +304,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
self.recon_cache = mkdtemp()
|
||||
rmtree(self.recon_cache, ignore_errors=1)
|
||||
os.mkdir(self.recon_cache)
|
||||
self.logger = unit.debug_logger('test-replicator')
|
||||
self.logger = debug_logger('test-replicator')
|
||||
|
||||
def tearDown(self):
|
||||
for patcher in self._patchers:
|
||||
@ -509,9 +510,8 @@ class TestDBReplicator(unittest.TestCase):
|
||||
FakeBroker(), -1)), False)
|
||||
|
||||
def test_run_once_no_local_device_in_ring(self):
|
||||
logger = unit.debug_logger('test-replicator')
|
||||
replicator = TestReplicator({'recon_cache_path': self.recon_cache},
|
||||
logger=logger)
|
||||
logger=self.logger)
|
||||
with patch('swift.common.db_replicator.whataremyips',
|
||||
return_value=['127.0.0.1']):
|
||||
replicator.run_once()
|
||||
@ -519,29 +519,28 @@ class TestDBReplicator(unittest.TestCase):
|
||||
"Can't find itself 127.0.0.1 with port 1000 "
|
||||
"in ring file, not replicating",
|
||||
]
|
||||
self.assertEqual(expected, logger.get_lines_for_level('error'))
|
||||
self.assertEqual(expected, self.logger.get_lines_for_level('error'))
|
||||
|
||||
def test_run_once_with_local_device_in_ring(self):
|
||||
logger = unit.debug_logger('test-replicator')
|
||||
base = 'swift.common.db_replicator.'
|
||||
with patch(base + 'whataremyips', return_value=['1.1.1.1']), \
|
||||
patch(base + 'ring', FakeRingWithNodes()):
|
||||
replicator = TestReplicator({'bind_port': 6200,
|
||||
'recon_cache_path': self.recon_cache},
|
||||
logger=logger)
|
||||
logger=self.logger)
|
||||
replicator.run_once()
|
||||
self.assertFalse(logger.get_lines_for_level('error'))
|
||||
self.assertFalse(self.logger.get_lines_for_level('error'))
|
||||
|
||||
def test_run_once_no_ips(self):
|
||||
replicator = TestReplicator({}, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
self._patch(patch.object, db_replicator, 'whataremyips',
|
||||
lambda *a, **kw: [])
|
||||
|
||||
replicator.run_once()
|
||||
|
||||
self.assertEqual(
|
||||
replicator.logger.log_dict['error'],
|
||||
[(('ERROR Failed to get my own IPs?',), {})])
|
||||
replicator.logger.get_lines_for_level('error'),
|
||||
['ERROR Failed to get my own IPs?'])
|
||||
|
||||
def test_run_once_node_is_not_mounted(self):
|
||||
db_replicator.ring = FakeRingWithSingleNode()
|
||||
@ -549,7 +548,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
# returned by itself.
|
||||
conf = {'mount_check': 'true', 'bind_ip': '1.1.1.1',
|
||||
'bind_port': 6200}
|
||||
replicator = TestReplicator(conf, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator(conf, logger=self.logger)
|
||||
self.assertEqual(replicator.mount_check, True)
|
||||
self.assertEqual(replicator.port, 6200)
|
||||
|
||||
@ -566,13 +565,13 @@ class TestDBReplicator(unittest.TestCase):
|
||||
replicator.run_once()
|
||||
|
||||
self.assertEqual(
|
||||
replicator.logger.log_dict['warning'],
|
||||
[(('Skipping: %s', (err, )), {})])
|
||||
replicator.logger.get_lines_for_level('warning'),
|
||||
['Skipping: %s' % (err,)])
|
||||
|
||||
def test_run_once_node_is_mounted(self):
|
||||
db_replicator.ring = FakeRingWithSingleNode()
|
||||
conf = {'mount_check': 'true', 'bind_port': 6200}
|
||||
replicator = TestReplicator(conf, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator(conf, logger=self.logger)
|
||||
self.assertEqual(replicator.mount_check, True)
|
||||
self.assertEqual(replicator.port, 6200)
|
||||
|
||||
@ -631,12 +630,11 @@ class TestDBReplicator(unittest.TestCase):
|
||||
@mock.patch('swift.common.db_replicator.dump_recon_cache')
|
||||
@mock.patch('swift.common.db_replicator.time.time', return_value=1234.5678)
|
||||
def test_stats(self, mock_time, mock_recon_cache):
|
||||
logger = unit.debug_logger('test-replicator')
|
||||
replicator = TestReplicator({}, logger=logger)
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
replicator._zero_stats()
|
||||
self.assertEqual(replicator.stats['start'], mock_time.return_value)
|
||||
replicator._report_stats()
|
||||
self.assertEqual(logger.get_lines_for_level('info'), [
|
||||
self.assertEqual(self.logger.get_lines_for_level('info'), [
|
||||
'Attempted to replicate 0 dbs in 0.00000 seconds (0.00000/s)',
|
||||
'Removed 0 dbs',
|
||||
'0 successes, 0 failures',
|
||||
@ -651,7 +649,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
})
|
||||
|
||||
mock_recon_cache.reset_mock()
|
||||
logger.clear()
|
||||
self.logger.clear()
|
||||
replicator.stats.update({
|
||||
'attempted': 30,
|
||||
'success': 25,
|
||||
@ -670,7 +668,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
mock_time.return_value += 246.813576
|
||||
replicator._report_stats()
|
||||
self.maxDiff = None
|
||||
self.assertEqual(logger.get_lines_for_level('info'), [
|
||||
self.assertEqual(self.logger.get_lines_for_level('info'), [
|
||||
'Attempted to replicate 30 dbs in 246.81358 seconds (0.12155/s)',
|
||||
'Removed 9 dbs',
|
||||
'25 successes, 1 failures',
|
||||
@ -688,7 +686,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
# verify return values from replicate_object
|
||||
db_replicator.ring = FakeRingWithNodes()
|
||||
db_path = '/path/to/file'
|
||||
replicator = TestReplicator({}, logger=FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
info = FakeBroker().get_replication_info()
|
||||
# make remote appear to be in sync
|
||||
rinfo = {'point': info['max_row'], 'id': 'remote_id'}
|
||||
@ -991,7 +989,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
self.assertEqual(5, replicator._repl_to_node.call_count)
|
||||
|
||||
def test_replicate_account_out_of_place(self):
|
||||
replicator = TestReplicator({}, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
replicator.ring = FakeRingWithNodes().Ring('path')
|
||||
replicator.brokerclass = FakeAccountBroker
|
||||
replicator._repl_to_node = lambda *args: True
|
||||
@ -1007,7 +1005,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
self.assertEqual(error_msgs, [expected])
|
||||
|
||||
def test_replicate_container_out_of_place(self):
|
||||
replicator = TestReplicator({}, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
replicator.ring = FakeRingWithNodes().Ring('path')
|
||||
replicator._repl_to_node = lambda *args: True
|
||||
replicator.delete_db = self.stub_delete_db
|
||||
@ -1018,12 +1016,12 @@ class TestDBReplicator(unittest.TestCase):
|
||||
replicator._replicate_object(str(part), '/path/to/file', node_id)
|
||||
self.assertEqual(['/path/to/file'], self.delete_db_calls)
|
||||
self.assertEqual(
|
||||
replicator.logger.log_dict['error'],
|
||||
[(('Found /path/to/file for /a%20c%20t/c%20o%20n when it should '
|
||||
'be on partition 0; will replicate out and remove.',), {})])
|
||||
replicator.logger.get_lines_for_level('error'),
|
||||
['Found /path/to/file for /a%20c%20t/c%20o%20n when it should '
|
||||
'be on partition 0; will replicate out and remove.'])
|
||||
|
||||
def test_replicate_container_out_of_place_no_node(self):
|
||||
replicator = TestReplicator({}, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
replicator.ring = FakeRingWithSingleNode().Ring('path')
|
||||
replicator._repl_to_node = lambda *args: True
|
||||
|
||||
@ -1062,7 +1060,7 @@ class TestDBReplicator(unittest.TestCase):
|
||||
|
||||
def test_delete_db(self):
|
||||
db_replicator.lock_parent_directory = lock_parent_directory
|
||||
replicator = TestReplicator({}, logger=unit.FakeLogger())
|
||||
replicator = TestReplicator({}, logger=self.logger)
|
||||
replicator._zero_stats()
|
||||
replicator.extract_device = lambda _: 'some_device'
|
||||
|
||||
@ -1373,8 +1371,8 @@ class TestDBReplicator(unittest.TestCase):
|
||||
|
||||
def test_replicator_sync_with_broker_replication_missing_table(self):
|
||||
rpc = db_replicator.ReplicatorRpc('/', '/', FakeBroker,
|
||||
mount_check=False)
|
||||
rpc.logger = unit.debug_logger()
|
||||
mount_check=False,
|
||||
logger=self.logger)
|
||||
broker = FakeBroker()
|
||||
broker.get_repl_missing_table = True
|
||||
|
||||
@ -1808,6 +1806,7 @@ class TestHandoffsOnly(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.root = mkdtemp()
|
||||
self.logger = debug_logger()
|
||||
|
||||
# object disks; they're just here to make sure they don't trip us up
|
||||
os.mkdir(os.path.join(self.root, 'sdc'))
|
||||
@ -1831,13 +1830,12 @@ class TestHandoffsOnly(unittest.TestCase):
|
||||
rmtree(self.root, ignore_errors=True)
|
||||
|
||||
def test_scary_warnings(self):
|
||||
logger = unit.FakeLogger()
|
||||
replicator = TestReplicator({
|
||||
'handoffs_only': 'yes',
|
||||
'devices': self.root,
|
||||
'bind_port': 6201,
|
||||
'mount_check': 'no',
|
||||
}, logger=logger)
|
||||
}, logger=self.logger)
|
||||
|
||||
with patch.object(db_replicator, 'whataremyips',
|
||||
return_value=['10.0.0.1']), \
|
||||
@ -1846,7 +1844,7 @@ class TestHandoffsOnly(unittest.TestCase):
|
||||
replicator.run_once()
|
||||
|
||||
self.assertEqual(
|
||||
logger.get_lines_for_level('warning'),
|
||||
self.logger.get_lines_for_level('warning'),
|
||||
[('Starting replication pass with handoffs_only enabled. This '
|
||||
'mode is not intended for normal operation; use '
|
||||
'handoffs_only with care.'),
|
||||
@ -2081,14 +2079,14 @@ class TestReplicatorSync(unittest.TestCase):
|
||||
self.root = mkdtemp()
|
||||
self.rpc = self.replicator_rpc(
|
||||
self.root, self.datadir, self.backend, mount_check=False,
|
||||
logger=unit.debug_logger())
|
||||
logger=debug_logger())
|
||||
FakeReplConnection = attach_fake_replication_rpc(self.rpc)
|
||||
self._orig_ReplConnection = db_replicator.ReplConnection
|
||||
db_replicator.ReplConnection = FakeReplConnection
|
||||
self._orig_Ring = db_replicator.ring.Ring
|
||||
self._ring = unit.FakeRing()
|
||||
db_replicator.ring.Ring = lambda *args, **kwargs: self._get_ring()
|
||||
self.logger = unit.debug_logger()
|
||||
self.logger = debug_logger()
|
||||
|
||||
def tearDown(self):
|
||||
db_replicator.ReplConnection = self._orig_ReplConnection
|
||||
|
@ -33,7 +33,8 @@ from swift.common.swob import RESPONSE_REASONS
|
||||
from swift.common.storage_policy import POLICIES
|
||||
from six.moves.http_client import HTTPException
|
||||
|
||||
from test.unit import patch_policies, debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies
|
||||
|
||||
|
||||
class FakeConn(object):
|
||||
|
@ -30,8 +30,8 @@ from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.storage_policy import StoragePolicy
|
||||
from swift.common.middleware.proxy_logging import ProxyLoggingMiddleware
|
||||
|
||||
from test.unit import with_tempdir, write_fake_ring, patch_policies, \
|
||||
debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import with_tempdir, write_fake_ring, patch_policies
|
||||
from test.unit.common.middleware.helpers import FakeSwift, LeakTrackingIter
|
||||
|
||||
if six.PY3:
|
||||
|
@ -35,7 +35,7 @@ from eventlet.pools import Pool
|
||||
from swift.common import memcached
|
||||
from swift.common.utils import md5
|
||||
from mock import patch, MagicMock
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
|
||||
class MockedMemcachePool(memcached.MemcacheConnPool):
|
||||
|
@ -22,8 +22,9 @@ from functools import partial
|
||||
|
||||
from six.moves.configparser import ConfigParser
|
||||
from tempfile import NamedTemporaryFile
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
patch_policies, FakeRing, temptree, DEFAULT_TEST_EC_TYPE, FakeLogger)
|
||||
patch_policies, FakeRing, temptree, DEFAULT_TEST_EC_TYPE)
|
||||
import swift.common.storage_policy
|
||||
from swift.common.storage_policy import (
|
||||
StoragePolicyCollection, POLICIES, PolicyError, parse_storage_policies,
|
||||
@ -1495,11 +1496,11 @@ class TestStoragePolicies(unittest.TestCase):
|
||||
policy = StoragePolicy(0, name='zero', is_default=True,
|
||||
diskfile_module='replication.fs')
|
||||
|
||||
dfm = policy.get_diskfile_manager({'devices': 'sdb1'}, FakeLogger())
|
||||
dfm = policy.get_diskfile_manager({'devices': 'sdb1'}, debug_logger())
|
||||
self.assertEqual('sdb1', dfm.devices)
|
||||
dfm = policy.get_diskfile_manager({'devices': 'sdb2'}, FakeLogger())
|
||||
dfm = policy.get_diskfile_manager({'devices': 'sdb2'}, debug_logger())
|
||||
self.assertEqual('sdb2', dfm.devices)
|
||||
dfm2 = policy.get_diskfile_manager({'devices': 'sdb2'}, FakeLogger())
|
||||
dfm2 = policy.get_diskfile_manager({'devices': 'sdb2'}, debug_logger())
|
||||
self.assertEqual('sdb2', dfm2.devices)
|
||||
self.assertIsNot(dfm, dfm2)
|
||||
|
||||
|
@ -18,8 +18,9 @@ from __future__ import print_function
|
||||
|
||||
import hashlib
|
||||
|
||||
from test.unit import temptree, debug_logger, make_timestamp_iter, \
|
||||
with_tempdir, mock_timestamp_now, FakeIterable
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import temptree, make_timestamp_iter, with_tempdir, \
|
||||
mock_timestamp_now, FakeIterable
|
||||
|
||||
import ctypes
|
||||
import contextlib
|
||||
@ -79,7 +80,7 @@ from swift.common.container_sync_realms import ContainerSyncRealms
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.storage_policy import POLICIES, reload_storage_policies
|
||||
from swift.common.swob import Request, Response
|
||||
from test.unit import FakeLogger, requires_o_tmpfile_support_in_tmp, \
|
||||
from test.unit import requires_o_tmpfile_support_in_tmp, \
|
||||
quiet_eventlet_exceptions
|
||||
|
||||
threading = eventlet.patcher.original('threading')
|
||||
@ -1519,7 +1520,8 @@ class TestUtils(unittest.TestCase):
|
||||
self.handleError(record)
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(CrashyLogger())
|
||||
handler = CrashyLogger()
|
||||
logger.addHandler(handler)
|
||||
|
||||
# Set up some real file descriptors for stdio. If you run
|
||||
# nosetests with "-s", you already have real files there, but
|
||||
@ -1547,6 +1549,8 @@ class TestUtils(unittest.TestCase):
|
||||
logger.info("I like ham")
|
||||
self.assertGreater(crashy_calls[0], 1)
|
||||
|
||||
logger.removeHandler(handler)
|
||||
|
||||
def test_parse_options(self):
|
||||
# Get a file that is definitely on disk
|
||||
with NamedTemporaryFile() as f:
|
||||
@ -2895,7 +2899,7 @@ key = 9ff3b71c849749dbaec4ccdd3cbab62b
|
||||
cluster_dfw1 = http://dfw1.host/v1/
|
||||
'''
|
||||
with temptree([fname], [fcontents]) as tempdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
fpath = os.path.join(tempdir, fname)
|
||||
csr = ContainerSyncRealms(fpath, logger)
|
||||
for realms_conf in (None, csr):
|
||||
@ -3633,7 +3637,7 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
'bytes': 1234, 'hash': 'asdf', 'name': 'zxcv',
|
||||
'content_type': 'text/plain; hello="world"; swift_bytes=15'}
|
||||
utils.override_bytes_from_content_type(listing_dict,
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
self.assertEqual(listing_dict['bytes'], 15)
|
||||
self.assertEqual(listing_dict['content_type'],
|
||||
'text/plain;hello="world"')
|
||||
@ -3642,7 +3646,7 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
'bytes': 1234, 'hash': 'asdf', 'name': 'zxcv',
|
||||
'content_type': 'text/plain; hello="world"; swift_bytes=hey'}
|
||||
utils.override_bytes_from_content_type(listing_dict,
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
self.assertEqual(listing_dict['bytes'], 1234)
|
||||
self.assertEqual(listing_dict['content_type'],
|
||||
'text/plain;hello="world"')
|
||||
@ -3941,15 +3945,15 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
def test_cache_from_env(self):
|
||||
# should never get logging when swift.cache is found
|
||||
env = {'swift.cache': 42}
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertEqual(42, utils.cache_from_env(env))
|
||||
self.assertEqual(0, len(logger.get_lines_for_level('error')))
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertEqual(42, utils.cache_from_env(env, False))
|
||||
self.assertEqual(0, len(logger.get_lines_for_level('error')))
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertEqual(42, utils.cache_from_env(env, True))
|
||||
self.assertEqual(0, len(logger.get_lines_for_level('error')))
|
||||
@ -3957,15 +3961,15 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
# check allow_none controls logging when swift.cache is not found
|
||||
err_msg = 'ERROR: swift.cache could not be found in env!'
|
||||
env = {}
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertIsNone(utils.cache_from_env(env))
|
||||
self.assertTrue(err_msg in logger.get_lines_for_level('error'))
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertIsNone(utils.cache_from_env(env, False))
|
||||
self.assertTrue(err_msg in logger.get_lines_for_level('error'))
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
with mock.patch('swift.common.utils.logging', logger):
|
||||
self.assertIsNone(utils.cache_from_env(env, True))
|
||||
self.assertEqual(0, len(logger.get_lines_for_level('error')))
|
||||
@ -3993,7 +3997,7 @@ cluster_dfw1 = http://dfw1.host/v1/
|
||||
# Not a directory - arg is file path
|
||||
self.assertRaises(OSError, utils.fsync_dir, temppath)
|
||||
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
|
||||
def _mock_fsync(fd):
|
||||
raise OSError(errno.EBADF, os.strerror(errno.EBADF))
|
||||
@ -5566,7 +5570,7 @@ class TestStatsdLogging(unittest.TestCase):
|
||||
}, 'some-name', log_route='some-route')
|
||||
statsd_client = logger.logger.statsd_client
|
||||
|
||||
fl = FakeLogger()
|
||||
fl = debug_logger()
|
||||
statsd_client.logger = fl
|
||||
mock_socket = MockUdpSocket()
|
||||
|
||||
@ -5579,7 +5583,7 @@ class TestStatsdLogging(unittest.TestCase):
|
||||
def test_no_exception_when_cant_send_udp_packet(self):
|
||||
logger = utils.get_logger({'log_statsd_host': 'some.host.com'})
|
||||
statsd_client = logger.logger.statsd_client
|
||||
fl = FakeLogger()
|
||||
fl = debug_logger()
|
||||
statsd_client.logger = fl
|
||||
mock_socket = MockUdpSocket(sendto_errno=errno.EPERM)
|
||||
statsd_client._open_socket = lambda *_: mock_socket
|
||||
@ -6327,7 +6331,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_non_dir_drive(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
# Create a file, that represents a non-dir drive
|
||||
@ -6345,7 +6349,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_mount_check_drive(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
# Create a file, that represents a non-dir drive
|
||||
@ -6364,7 +6368,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_non_dir_contents(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
with open(os.path.join(data, "partition1"), "w"):
|
||||
@ -6386,7 +6390,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
with temptree([]) as tmpdir:
|
||||
expected_objs = list()
|
||||
expected_dirs = list()
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
# Create a file, that represents a non-dir drive
|
||||
@ -6431,7 +6435,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_ignore_metadata(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
partition = os.path.join(data, "partition2")
|
||||
@ -6454,7 +6458,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_hooks(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
partition = os.path.join(data, "partition1")
|
||||
@ -6502,7 +6506,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
|
||||
def test_filters(self):
|
||||
with temptree([]) as tmpdir:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
partition = os.path.join(data, "partition1")
|
||||
@ -7243,7 +7247,7 @@ class TestDocumentItersToHTTPResponseBody(unittest.TestCase):
|
||||
def test_no_parts(self):
|
||||
body = utils.document_iters_to_http_response_body(
|
||||
iter([]), 'dontcare',
|
||||
multipart=False, logger=FakeLogger())
|
||||
multipart=False, logger=debug_logger())
|
||||
self.assertEqual(body, '')
|
||||
|
||||
def test_single_part(self):
|
||||
@ -7253,7 +7257,7 @@ class TestDocumentItersToHTTPResponseBody(unittest.TestCase):
|
||||
resp_body = b''.join(
|
||||
utils.document_iters_to_http_response_body(
|
||||
iter(doc_iters), b'dontcare',
|
||||
multipart=False, logger=FakeLogger()))
|
||||
multipart=False, logger=debug_logger()))
|
||||
self.assertEqual(resp_body, body)
|
||||
|
||||
def test_multiple_parts(self):
|
||||
@ -7277,7 +7281,7 @@ class TestDocumentItersToHTTPResponseBody(unittest.TestCase):
|
||||
resp_body = b''.join(
|
||||
utils.document_iters_to_http_response_body(
|
||||
iter(doc_iters), b'boundaryboundary',
|
||||
multipart=True, logger=FakeLogger()))
|
||||
multipart=True, logger=debug_logger()))
|
||||
self.assertEqual(resp_body, (
|
||||
b"--boundaryboundary\r\n" +
|
||||
# This is a little too strict; we don't actually care that the
|
||||
@ -7300,7 +7304,7 @@ class TestDocumentItersToHTTPResponseBody(unittest.TestCase):
|
||||
useful_iter_mock.__iter__.return_value = ['']
|
||||
body_iter = utils.document_iters_to_http_response_body(
|
||||
iter([{'part_iter': useful_iter_mock}]), 'dontcare',
|
||||
multipart=False, logger=FakeLogger())
|
||||
multipart=False, logger=debug_logger())
|
||||
body = ''
|
||||
for s in body_iter:
|
||||
body += s
|
||||
@ -7311,7 +7315,7 @@ class TestDocumentItersToHTTPResponseBody(unittest.TestCase):
|
||||
del useful_iter_mock.close
|
||||
body_iter = utils.document_iters_to_http_response_body(
|
||||
iter([{'part_iter': useful_iter_mock}]), 'dontcare',
|
||||
multipart=False, logger=FakeLogger())
|
||||
multipart=False, logger=debug_logger())
|
||||
body = ''
|
||||
for s in body_iter:
|
||||
body += s
|
||||
|
@ -45,8 +45,9 @@ from swift.common import wsgi, utils
|
||||
from swift.common.storage_policy import POLICIES
|
||||
|
||||
from test import listen_zero
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
temptree, with_tempdir, write_fake_ring, patch_policies, FakeLogger)
|
||||
temptree, with_tempdir, write_fake_ring, patch_policies)
|
||||
|
||||
from paste.deploy import loadwsgi
|
||||
|
||||
@ -871,7 +872,7 @@ class TestWSGI(unittest.TestCase):
|
||||
mock_per_port().new_worker_socks.side_effect = StopAtCreatingSockets
|
||||
mock_workers().no_fork_sock.return_value = None
|
||||
mock_workers().new_worker_socks.side_effect = StopAtCreatingSockets
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
stub__initrp = [
|
||||
{'__file__': 'test', 'workers': 2, 'bind_port': 12345}, # conf
|
||||
logger,
|
||||
@ -1349,7 +1350,7 @@ class CommonTestMixin(object):
|
||||
|
||||
class TestServersPerPortStrategy(unittest.TestCase, CommonTestMixin):
|
||||
def setUp(self):
|
||||
self.logger = FakeLogger()
|
||||
self.logger = debug_logger()
|
||||
self.conf = {
|
||||
'workers': 100, # ignored
|
||||
'user': 'bob',
|
||||
@ -1565,7 +1566,7 @@ class TestServersPerPortStrategy(unittest.TestCase, CommonTestMixin):
|
||||
|
||||
class TestWorkersStrategy(unittest.TestCase, CommonTestMixin):
|
||||
def setUp(self):
|
||||
self.logger = FakeLogger()
|
||||
self.logger = debug_logger()
|
||||
self.conf = {
|
||||
'workers': 2,
|
||||
'user': 'bob',
|
||||
|
@ -19,7 +19,8 @@ import os
|
||||
|
||||
from swift.common.utils import normalize_timestamp
|
||||
from swift.container import auditor
|
||||
from test.unit import debug_logger, with_tempdir
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import with_tempdir
|
||||
from test.unit.container import test_backend
|
||||
|
||||
|
||||
|
@ -45,8 +45,9 @@ from swift.common.storage_policy import POLICIES
|
||||
import mock
|
||||
|
||||
from test import annotate_failure
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (patch_policies, with_tempdir, make_timestamp_iter,
|
||||
EMPTY_ETAG, FakeLogger, mock_timestamp_now)
|
||||
EMPTY_ETAG, mock_timestamp_now)
|
||||
from test.unit.common import test_db
|
||||
|
||||
|
||||
@ -4490,7 +4491,7 @@ class TestContainerBroker(unittest.TestCase):
|
||||
def test_find_shard_ranges_errors(self, tempdir):
|
||||
db_path = os.path.join(tempdir, 'test_container.db')
|
||||
broker = ContainerBroker(db_path, account='a', container='c',
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
broker.initialize(next(self.ts).internal, 0)
|
||||
for i in range(2):
|
||||
broker.put_object(
|
||||
@ -4713,7 +4714,7 @@ class TestContainerBroker(unittest.TestCase):
|
||||
db_path = os.path.join(
|
||||
tempdir, 'containers', 'part', 'suffix', 'hash', 'container.db')
|
||||
broker = ContainerBroker(db_path, account='a', container='c',
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
broker.initialize(next(self.ts).internal, 0)
|
||||
broker.enable_sharding(next(self.ts))
|
||||
|
||||
@ -4748,7 +4749,7 @@ class TestContainerBroker(unittest.TestCase):
|
||||
retiring_db_path = os.path.join(
|
||||
tempdir, 'containers', 'part', 'suffix', 'hash', 'container.db')
|
||||
broker = ContainerBroker(retiring_db_path, account='a', container='c',
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
broker.initialize(next(self.ts).internal, 0)
|
||||
pre_epoch = next(self.ts)
|
||||
broker.enable_sharding(next(self.ts))
|
||||
@ -4792,7 +4793,7 @@ class TestContainerBroker(unittest.TestCase):
|
||||
retiring_db_path = os.path.join(
|
||||
tempdir, 'containers', 'part', 'suffix', 'hash', 'container.db')
|
||||
broker = ContainerBroker(retiring_db_path, account='a', container='c',
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
broker.initialize(next(self.ts).internal, 0)
|
||||
brokers = broker.get_brokers()
|
||||
self.assertEqual(retiring_db_path, brokers[0].db_file)
|
||||
|
@ -35,7 +35,8 @@ from swift.common import swob
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.utils import split_path, Timestamp, encode_timestamps
|
||||
|
||||
from test.unit import debug_logger, FakeRing, fake_http_connect
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeRing, fake_http_connect
|
||||
from test.unit.common.middleware import helpers
|
||||
|
||||
|
||||
|
@ -33,10 +33,10 @@ from swift.common.utils import Timestamp, encode_timestamps, ShardRange, \
|
||||
get_db_files, make_db_file_path
|
||||
from swift.common.storage_policy import POLICIES
|
||||
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.common import test_db_replicator
|
||||
from test.unit import patch_policies, make_timestamp_iter, mock_check_drive, \
|
||||
debug_logger, EMPTY_ETAG, FakeLogger, attach_fake_replication_rpc, \
|
||||
FakeHTTPResponse
|
||||
EMPTY_ETAG, attach_fake_replication_rpc, FakeHTTPResponse
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
@ -1429,7 +1429,7 @@ class TestReplicatorSync(test_db_replicator.TestReplicatorSync):
|
||||
remote_broker.initialize(put_timestamp, POLICIES.default.idx)
|
||||
|
||||
def check_replicate(expected_shard_ranges, from_broker, to_broker):
|
||||
daemon = replicator.ContainerReplicator({}, logger=FakeLogger())
|
||||
daemon = replicator.ContainerReplicator({}, logger=debug_logger())
|
||||
part, node = self._get_broker_part_node(to_broker)
|
||||
info = broker.get_replication_info()
|
||||
success = daemon._repl_to_node(node, from_broker, part, info)
|
||||
@ -1593,7 +1593,7 @@ class TestReplicatorSync(test_db_replicator.TestReplicatorSync):
|
||||
part, node = self._get_broker_part_node(remote_broker)
|
||||
info = broker.get_replication_info()
|
||||
daemon = replicator.ContainerReplicator({})
|
||||
daemon.logger = FakeLogger()
|
||||
daemon.logger = debug_logger()
|
||||
success = daemon._repl_to_node(node, broker, part, info)
|
||||
self.assertFalse(success)
|
||||
# broker only has its own shard range so expect objects to be sync'd
|
||||
@ -1630,7 +1630,7 @@ class TestReplicatorSync(test_db_replicator.TestReplicatorSync):
|
||||
db_replicator.ReplConnection = fake_repl_connection
|
||||
part, node = self._get_broker_part_node(remote_broker)
|
||||
daemon = replicator.ContainerReplicator({'node_timeout': '0.001'})
|
||||
daemon.logger = FakeLogger()
|
||||
daemon.logger = debug_logger()
|
||||
with mock.patch.object(daemon.ring, 'get_part_nodes',
|
||||
return_value=[node]), \
|
||||
mock.patch.object(daemon, '_post_replicate_hook'):
|
||||
|
@ -44,7 +44,8 @@ from swift.common import constraints
|
||||
from swift.common.utils import (Timestamp, mkdirs, public, replication,
|
||||
storage_directory, lock_parent_directory,
|
||||
ShardRange, RESERVED_STR)
|
||||
from test.unit import fake_http_connect, debug_logger, mock_check_drive
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import fake_http_connect, mock_check_drive
|
||||
from swift.common.storage_policy import (POLICIES, StoragePolicy)
|
||||
from swift.common.request_helpers import get_sys_meta_prefix, get_reserved_name
|
||||
|
||||
|
@ -47,9 +47,9 @@ from swift.common.utils import ShardRange, Timestamp, hash_path, \
|
||||
encode_timestamps, parse_db_filename, quorum_size, Everything, md5
|
||||
from test import annotate_failure
|
||||
|
||||
from test.unit import debug_logger, FakeRing, \
|
||||
make_timestamp_iter, unlink_files, mocked_http_conn, mock_timestamp_now, \
|
||||
attach_fake_replication_rpc
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeRing, make_timestamp_iter, unlink_files, \
|
||||
mocked_http_conn, mock_timestamp_now, attach_fake_replication_rpc
|
||||
|
||||
|
||||
class BaseTestSharder(unittest.TestCase):
|
||||
|
@ -21,7 +21,7 @@ from textwrap import dedent
|
||||
import mock
|
||||
import errno
|
||||
from swift.common.utils import Timestamp
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from swift.container import sync
|
||||
from swift.common.db import DatabaseConnectionError
|
||||
from swift.common import utils
|
||||
|
@ -21,7 +21,7 @@ import logging
|
||||
import unittest
|
||||
import tempfile
|
||||
from shutil import rmtree
|
||||
from test.unit import debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
|
||||
from swift.container.backend import DATADIR
|
||||
from swift.container import sync_store
|
||||
|
@ -22,7 +22,8 @@ from contextlib import closing
|
||||
from gzip import GzipFile
|
||||
from shutil import rmtree
|
||||
from tempfile import mkdtemp
|
||||
from test.unit import debug_logger, mock_check_drive
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import mock_check_drive
|
||||
|
||||
from eventlet import spawn, Timeout
|
||||
|
||||
|
@ -47,8 +47,9 @@ from swift.proxy import server as proxy_server
|
||||
import swift.proxy.controllers.obj
|
||||
|
||||
from test import listen_zero
|
||||
from test.unit import write_fake_ring, DEFAULT_TEST_EC_TYPE, debug_logger, \
|
||||
connect_tcp, readuntil2crlfs
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import write_fake_ring, DEFAULT_TEST_EC_TYPE, connect_tcp, \
|
||||
readuntil2crlfs
|
||||
|
||||
|
||||
def setup_servers(the_object_server=object_server, extra_conf=None):
|
||||
|
@ -27,9 +27,10 @@ from shutil import rmtree
|
||||
from tempfile import mkdtemp
|
||||
import textwrap
|
||||
from os.path import dirname, basename
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
debug_logger, DEFAULT_TEST_EC_TYPE,
|
||||
make_timestamp_iter, patch_policies, skip_if_no_xattrs)
|
||||
DEFAULT_TEST_EC_TYPE, make_timestamp_iter, patch_policies,
|
||||
skip_if_no_xattrs)
|
||||
from test.unit.obj.common import write_diskfile
|
||||
from swift.obj import auditor, replicator
|
||||
from swift.obj.watchers.dark_data import DarkDataWatcher
|
||||
|
@ -40,10 +40,10 @@ import pyeclib.ec_iface
|
||||
|
||||
from eventlet import hubs, timeout, tpool
|
||||
from swift.obj.diskfile import MD5_OF_EMPTY_STRING, update_auditor_status
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (mock as unit_mock, temptree, mock_check_drive,
|
||||
patch_policies, debug_logger, EMPTY_ETAG,
|
||||
make_timestamp_iter, DEFAULT_TEST_EC_TYPE,
|
||||
requires_o_tmpfile_support_in_tmp,
|
||||
patch_policies, EMPTY_ETAG, make_timestamp_iter,
|
||||
DEFAULT_TEST_EC_TYPE, requires_o_tmpfile_support_in_tmp,
|
||||
encode_frag_archive_bodies, skip_if_no_xattrs)
|
||||
from swift.obj import diskfile
|
||||
from swift.common import utils
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
from time import time
|
||||
from unittest import main, TestCase
|
||||
from test.unit import FakeRing, mocked_http_conn, debug_logger, \
|
||||
make_timestamp_iter
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeRing, mocked_http_conn, make_timestamp_iter
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
from collections import defaultdict
|
||||
|
@ -43,10 +43,11 @@ from swift.common.storage_policy import (StoragePolicy, ECStoragePolicy,
|
||||
POLICIES, EC_POLICY)
|
||||
from swift.obj.reconstructor import SYNC, REVERT
|
||||
|
||||
from test.unit import (patch_policies, debug_logger, mocked_http_conn,
|
||||
FabricatedRing, make_timestamp_iter,
|
||||
DEFAULT_TEST_EC_TYPE, encode_frag_archive_bodies,
|
||||
quiet_eventlet_exceptions, skip_if_no_xattrs)
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (patch_policies, mocked_http_conn, FabricatedRing,
|
||||
make_timestamp_iter, DEFAULT_TEST_EC_TYPE,
|
||||
encode_frag_archive_bodies, quiet_eventlet_exceptions,
|
||||
skip_if_no_xattrs)
|
||||
from test.unit.obj.common import write_diskfile
|
||||
|
||||
|
||||
|
@ -30,8 +30,9 @@ from errno import ENOENT, ENOTEMPTY, ENOTDIR
|
||||
from eventlet.green import subprocess
|
||||
from eventlet import Timeout, sleep
|
||||
|
||||
from test.unit import (debug_logger, patch_policies, make_timestamp_iter,
|
||||
mocked_http_conn, mock_check_drive, skip_if_no_xattrs)
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (patch_policies, make_timestamp_iter, mocked_http_conn,
|
||||
mock_check_drive, skip_if_no_xattrs)
|
||||
from swift.common import utils
|
||||
from swift.common.utils import (hash_path, mkdirs, normalize_timestamp,
|
||||
storage_directory)
|
||||
|
@ -41,7 +41,8 @@ from eventlet.green import httplib
|
||||
from swift import __version__ as swift_version
|
||||
from swift.common.http import is_success
|
||||
from test import listen_zero
|
||||
from test.unit import FakeLogger, debug_logger, mocked_http_conn, \
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import mocked_http_conn, \
|
||||
make_timestamp_iter, DEFAULT_TEST_EC_TYPE, skip_if_no_xattrs, \
|
||||
connect_tcp, readuntil2crlfs, patch_policies, encode_frag_archive_bodies, \
|
||||
mock_check_drive
|
||||
@ -7491,7 +7492,7 @@ class TestObjectController(unittest.TestCase):
|
||||
outbuf = StringIO()
|
||||
self.object_controller = object_server.ObjectController(
|
||||
{'devices': self.testdir, 'mount_check': 'false',
|
||||
'replication_server': 'true'}, logger=FakeLogger())
|
||||
'replication_server': 'true'}, logger=debug_logger())
|
||||
|
||||
def start_response(*args):
|
||||
"""Sends args to outbuf"""
|
||||
@ -7580,7 +7581,7 @@ class TestObjectController(unittest.TestCase):
|
||||
self.object_controller = object_server.ObjectController(
|
||||
{'devices': self.testdir, 'mount_check': 'false',
|
||||
'replication_server': 'false', 'log_requests': 'false'},
|
||||
logger=FakeLogger())
|
||||
logger=debug_logger())
|
||||
|
||||
def start_response(*args):
|
||||
# Sends args to outbuf
|
||||
|
@ -35,9 +35,10 @@ from swift.obj.reconstructor import RebuildingECDiskFileStream, \
|
||||
from swift.obj.replicator import ObjectReplicator
|
||||
|
||||
from test import listen_zero
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.obj.common import BaseTest
|
||||
from test.unit import patch_policies, debug_logger, \
|
||||
encode_frag_archive_bodies, skip_if_no_xattrs, quiet_eventlet_exceptions
|
||||
from test.unit import patch_policies, encode_frag_archive_bodies, \
|
||||
skip_if_no_xattrs, quiet_eventlet_exceptions
|
||||
|
||||
|
||||
class TestBaseSsync(BaseTest):
|
||||
|
@ -35,8 +35,9 @@ from swift.obj import ssync_receiver, ssync_sender
|
||||
from swift.obj.reconstructor import ObjectReconstructor
|
||||
|
||||
from test import listen_zero, unit
|
||||
from test.unit import (debug_logger, patch_policies, make_timestamp_iter,
|
||||
mock_check_drive, skip_if_no_xattrs)
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (patch_policies, make_timestamp_iter, mock_check_drive,
|
||||
skip_if_no_xattrs)
|
||||
from test.unit.obj.common import write_diskfile
|
||||
|
||||
|
||||
|
@ -27,9 +27,9 @@ from swift.common.utils import Timestamp
|
||||
from swift.obj import ssync_sender, diskfile, ssync_receiver
|
||||
from swift.obj.replicator import ObjectReplicator
|
||||
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit.obj.common import BaseTest
|
||||
from test.unit import patch_policies, make_timestamp_iter, skip_if_no_xattrs, \
|
||||
debug_logger
|
||||
from test.unit import patch_policies, make_timestamp_iter, skip_if_no_xattrs
|
||||
|
||||
|
||||
class NullBufferedHTTPConnection(object):
|
||||
|
@ -24,9 +24,9 @@ from gzip import GzipFile
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
from test import listen_zero
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
make_timestamp_iter, debug_logger, patch_policies, mocked_http_conn,
|
||||
FakeLogger)
|
||||
make_timestamp_iter, patch_policies, mocked_http_conn)
|
||||
from time import time
|
||||
from distutils.dir_util import mkpath
|
||||
|
||||
@ -289,7 +289,7 @@ class TestObjectUpdater(unittest.TestCase):
|
||||
self.stats.successes += 1
|
||||
self.stats.unlinks += 1
|
||||
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
ou = MockObjectUpdater({
|
||||
'devices': self.devices_dir,
|
||||
'mount_check': 'false',
|
||||
@ -359,7 +359,7 @@ class TestObjectUpdater(unittest.TestCase):
|
||||
self.stats.successes += 1
|
||||
self.stats.unlinks += 1
|
||||
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
ou = MockObjectUpdater({
|
||||
'devices': self.devices_dir,
|
||||
'mount_check': 'false',
|
||||
|
@ -36,9 +36,10 @@ from swift.common.utils import split_path, ShardRange, Timestamp, \
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
from swift.common.http import is_success
|
||||
from swift.common.storage_policy import StoragePolicy, StoragePolicyCollection
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
fake_http_connect, FakeRing, FakeMemcache, PatchPolicies,
|
||||
make_timestamp_iter, mocked_http_conn, patch_policies, debug_logger)
|
||||
make_timestamp_iter, mocked_http_conn, patch_policies)
|
||||
from swift.common.request_helpers import (
|
||||
get_sys_meta_prefix, get_object_transient_sysmeta
|
||||
)
|
||||
|
@ -34,7 +34,8 @@ from test.unit import fake_http_connect, FakeRing, FakeMemcache, \
|
||||
from swift.common.storage_policy import StoragePolicy
|
||||
from swift.common.request_helpers import get_sys_meta_prefix
|
||||
|
||||
from test.unit import patch_policies, mocked_http_conn, debug_logger
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import patch_policies, mocked_http_conn
|
||||
from test.unit.common.ring.test_ring import TestRingBase
|
||||
from test.unit.proxy.test_server import node_error_count
|
||||
|
||||
|
@ -48,11 +48,12 @@ from swift.proxy.controllers.base import \
|
||||
from swift.common.storage_policy import POLICIES, ECDriverError, \
|
||||
StoragePolicy, ECStoragePolicy
|
||||
|
||||
from test.unit import FakeRing, fake_http_connect, \
|
||||
debug_logger, patch_policies, SlowBody, FakeStatus, \
|
||||
DEFAULT_TEST_EC_TYPE, encode_frag_archive_bodies, make_ec_object_stub, \
|
||||
fake_ec_node_response, StubResponse, mocked_http_conn, \
|
||||
quiet_eventlet_exceptions
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
FakeRing, fake_http_connect, patch_policies, SlowBody, FakeStatus,
|
||||
DEFAULT_TEST_EC_TYPE, encode_frag_archive_bodies, make_ec_object_stub,
|
||||
fake_ec_node_response, StubResponse, mocked_http_conn,
|
||||
quiet_eventlet_exceptions)
|
||||
from test.unit.proxy.test_server import node_error_count
|
||||
|
||||
|
||||
|
@ -52,11 +52,11 @@ from six.moves import range
|
||||
from six.moves.urllib.parse import quote, parse_qsl
|
||||
|
||||
from test import listen_zero
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import (
|
||||
connect_tcp, readuntil2crlfs, FakeLogger, fake_http_connect, FakeRing,
|
||||
FakeMemcache, debug_logger, patch_policies, write_fake_ring,
|
||||
mocked_http_conn, DEFAULT_TEST_EC_TYPE, make_timestamp_iter,
|
||||
skip_if_no_xattrs)
|
||||
connect_tcp, readuntil2crlfs, fake_http_connect, FakeRing, FakeMemcache,
|
||||
patch_policies, write_fake_ring, mocked_http_conn, DEFAULT_TEST_EC_TYPE,
|
||||
make_timestamp_iter, skip_if_no_xattrs)
|
||||
from test.unit.helpers import setup_servers, teardown_servers
|
||||
from swift.proxy import server as proxy_server
|
||||
from swift.proxy.controllers.obj import ReplicatedObjectController
|
||||
@ -784,7 +784,7 @@ class TestProxyServer(unittest.TestCase):
|
||||
swift_dir = mkdtemp()
|
||||
try:
|
||||
baseapp = proxy_server.Application({'swift_dir': swift_dir},
|
||||
FakeLogger(),
|
||||
debug_logger(),
|
||||
FakeRing(), FakeRing())
|
||||
resp = baseapp.handle_request(
|
||||
Request.blank('/', environ={'CONTENT_LENGTH': '-1'}))
|
||||
@ -800,10 +800,10 @@ class TestProxyServer(unittest.TestCase):
|
||||
def test_adds_transaction_id(self):
|
||||
swift_dir = mkdtemp()
|
||||
try:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
baseapp = proxy_server.Application({'swift_dir': swift_dir},
|
||||
logger,
|
||||
container_ring=FakeLogger(),
|
||||
container_ring=debug_logger(),
|
||||
account_ring=FakeRing())
|
||||
baseapp.handle_request(
|
||||
Request.blank('/info',
|
||||
@ -820,10 +820,10 @@ class TestProxyServer(unittest.TestCase):
|
||||
def test_adds_transaction_id_length_limit(self):
|
||||
swift_dir = mkdtemp()
|
||||
try:
|
||||
logger = FakeLogger()
|
||||
logger = debug_logger()
|
||||
baseapp = proxy_server.Application({'swift_dir': swift_dir},
|
||||
logger,
|
||||
container_ring=FakeLogger(),
|
||||
container_ring=debug_logger(),
|
||||
account_ring=FakeRing())
|
||||
baseapp.handle_request(
|
||||
Request.blank('/info',
|
||||
@ -840,7 +840,7 @@ class TestProxyServer(unittest.TestCase):
|
||||
baseapp = proxy_server.Application({'swift_dir': swift_dir,
|
||||
'deny_host_headers':
|
||||
'invalid_host.com'},
|
||||
container_ring=FakeLogger(),
|
||||
container_ring=debug_logger(),
|
||||
account_ring=FakeRing())
|
||||
resp = baseapp.handle_request(
|
||||
Request.blank('/v1/a/c/o',
|
||||
@ -882,7 +882,7 @@ class TestProxyServer(unittest.TestCase):
|
||||
nodes = list(nodes)
|
||||
conf = dict(conf, policy_config=policy_conf)
|
||||
baseapp = proxy_server.Application(conf,
|
||||
logger=FakeLogger(),
|
||||
logger=debug_logger(),
|
||||
container_ring=FakeRing(),
|
||||
account_ring=FakeRing())
|
||||
if node_timings:
|
||||
@ -1519,7 +1519,7 @@ class TestProxyServerConfigLoading(unittest.TestCase):
|
||||
|
||||
conf_path = self._write_conf(conf_body)
|
||||
with mock.patch('swift.proxy.server.get_logger',
|
||||
return_value=FakeLogger()):
|
||||
return_value=debug_logger()):
|
||||
app = loadapp(conf_path, allow_modify_pipeline=False)
|
||||
return app
|
||||
|
||||
@ -1779,7 +1779,7 @@ class TestProxyServerConfigLoading(unittest.TestCase):
|
||||
# duplicate DEFAULT sections
|
||||
conf_path = self._write_conf(conf_body)
|
||||
with mock.patch('swift.proxy.server.get_logger',
|
||||
return_value=FakeLogger()):
|
||||
return_value=debug_logger()):
|
||||
app = loadapp(conf_path, allow_modify_pipeline=False)
|
||||
|
||||
exp_options = {
|
||||
@ -2300,7 +2300,7 @@ class TestReplicatedObjectController(
|
||||
def check_file(policy, cont, devs, check_val):
|
||||
partition, nodes = policy.object_ring.get_nodes('a', cont, 'o')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
df_mgr = diskfile.DiskFileManager(conf, FakeLogger())
|
||||
df_mgr = diskfile.DiskFileManager(conf, debug_logger())
|
||||
for dev in devs:
|
||||
file = df_mgr.get_diskfile(dev, partition, 'a',
|
||||
cont, 'o',
|
||||
@ -2424,7 +2424,7 @@ class TestReplicatedObjectController(
|
||||
'a', 'c1', 'wrong-o')
|
||||
node = nodes[0]
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
df_mgr = diskfile.DiskFileManager(conf, FakeLogger())
|
||||
df_mgr = diskfile.DiskFileManager(conf, debug_logger())
|
||||
df = df_mgr.get_diskfile(node['device'], partition, 'a',
|
||||
'c1', 'wrong-o', policy=POLICIES[2])
|
||||
with df.open():
|
||||
@ -3662,7 +3662,7 @@ class TestReplicatedObjectController(
|
||||
with open(os.path.join(swift_dir, 'mime.types'), 'w') as fp:
|
||||
fp.write('foo/bar foo\n')
|
||||
proxy_server.Application({'swift_dir': swift_dir},
|
||||
FakeLogger(),
|
||||
debug_logger(),
|
||||
FakeRing(), FakeRing())
|
||||
self.assertEqual(proxy_server.mimetypes.guess_type('blah.foo')[0],
|
||||
'foo/bar')
|
||||
@ -4731,7 +4731,7 @@ class TestReplicatedObjectController(
|
||||
|
||||
# zero error-limited primary nodes -> no handoff warnings
|
||||
self.app.log_handoffs = True
|
||||
self.app.logger = FakeLogger()
|
||||
self.app.logger = debug_logger()
|
||||
self.app.request_node_count = lambda r: 7
|
||||
object_ring.max_more_nodes = 20
|
||||
partition, nodes = object_ring.get_nodes('account',
|
||||
@ -4746,7 +4746,7 @@ class TestReplicatedObjectController(
|
||||
|
||||
# one error-limited primary node -> one handoff warning
|
||||
self.app.log_handoffs = True
|
||||
self.app.logger = FakeLogger()
|
||||
self.app.logger = debug_logger()
|
||||
self.app.request_node_count = lambda r: 7
|
||||
self.app._error_limiting = {} # clear out errors
|
||||
set_node_errors(self.app, object_ring._devs[0], 999,
|
||||
@ -4756,14 +4756,15 @@ class TestReplicatedObjectController(
|
||||
for node in self.app.iter_nodes(object_ring, partition):
|
||||
collected_nodes.append(node)
|
||||
self.assertEqual(len(collected_nodes), 7)
|
||||
self.assertEqual(self.app.logger.log_dict['warning'], [
|
||||
(('Handoff requested (5)',), {})])
|
||||
self.assertEqual(
|
||||
self.app.logger.get_lines_for_level('warning'), [
|
||||
'Handoff requested (5)'])
|
||||
self.assertEqual(self.app.logger.get_increments(),
|
||||
['handoff_count'])
|
||||
|
||||
# two error-limited primary nodes -> two handoff warnings
|
||||
self.app.log_handoffs = True
|
||||
self.app.logger = FakeLogger()
|
||||
self.app.logger = debug_logger()
|
||||
self.app.request_node_count = lambda r: 7
|
||||
self.app._error_limiting = {} # clear out errors
|
||||
for i in range(2):
|
||||
@ -4774,9 +4775,11 @@ class TestReplicatedObjectController(
|
||||
for node in self.app.iter_nodes(object_ring, partition):
|
||||
collected_nodes.append(node)
|
||||
self.assertEqual(len(collected_nodes), 7)
|
||||
self.assertEqual(self.app.logger.log_dict['warning'], [
|
||||
(('Handoff requested (5)',), {}),
|
||||
(('Handoff requested (6)',), {})])
|
||||
self.assertEqual(
|
||||
self.app.logger.get_lines_for_level('warning'), [
|
||||
'Handoff requested (5)',
|
||||
'Handoff requested (6)',
|
||||
])
|
||||
self.assertEqual(self.app.logger.get_increments(),
|
||||
['handoff_count',
|
||||
'handoff_count'])
|
||||
@ -4784,7 +4787,7 @@ class TestReplicatedObjectController(
|
||||
# all error-limited primary nodes -> four handoff warnings,
|
||||
# plus a handoff-all metric
|
||||
self.app.log_handoffs = True
|
||||
self.app.logger = FakeLogger()
|
||||
self.app.logger = debug_logger()
|
||||
self.app.request_node_count = lambda r: 10
|
||||
object_ring.set_replicas(4) # otherwise we run out of handoffs
|
||||
self.app._error_limiting = {} # clear out errors
|
||||
@ -4796,11 +4799,13 @@ class TestReplicatedObjectController(
|
||||
for node in self.app.iter_nodes(object_ring, partition):
|
||||
collected_nodes.append(node)
|
||||
self.assertEqual(len(collected_nodes), 10)
|
||||
self.assertEqual(self.app.logger.log_dict['warning'], [
|
||||
(('Handoff requested (7)',), {}),
|
||||
(('Handoff requested (8)',), {}),
|
||||
(('Handoff requested (9)',), {}),
|
||||
(('Handoff requested (10)',), {})])
|
||||
self.assertEqual(
|
||||
self.app.logger.get_lines_for_level('warning'), [
|
||||
'Handoff requested (7)',
|
||||
'Handoff requested (8)',
|
||||
'Handoff requested (9)',
|
||||
'Handoff requested (10)',
|
||||
])
|
||||
self.assertEqual(self.app.logger.get_increments(),
|
||||
['handoff_count',
|
||||
'handoff_count',
|
||||
@ -6614,7 +6619,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
partition, nodes = self.ec_policy.object_ring.get_nodes(
|
||||
'a', self.ec_policy.name, 'o1')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
got_pieces = set()
|
||||
got_indices = set()
|
||||
@ -6704,7 +6709,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
'a', self.ec_policy.name, 'o2')
|
||||
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
got_durable = []
|
||||
fragment_archives = []
|
||||
@ -6789,7 +6794,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
int(self.ec_policy)).get_nodes('a', self.ec_policy.name, 'o3')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
for node in nodes:
|
||||
df = df_mgr.get_diskfile(node['device'], partition,
|
||||
@ -6843,7 +6848,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
int(self.ec_policy)).get_nodes('a', self.ec_policy.name, 'pimento')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
found = 0
|
||||
for node in nodes:
|
||||
@ -6915,7 +6920,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
'a', 'ec-con', 'quorum')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
for node in nodes:
|
||||
df = df_mgr.get_diskfile(node['device'], partition,
|
||||
@ -6974,7 +6979,7 @@ class BaseTestECObjectController(BaseTestObjectController):
|
||||
'a', 'ec-con', 'quorum')
|
||||
conf = {'devices': _testdir, 'mount_check': 'false'}
|
||||
|
||||
df_mgr = diskfile.DiskFileRouter(conf, FakeLogger())[self.ec_policy]
|
||||
df_mgr = diskfile.DiskFileRouter(conf, debug_logger())[self.ec_policy]
|
||||
|
||||
for node in nodes:
|
||||
df = df_mgr.get_diskfile(node['device'], partition,
|
||||
|
@ -29,8 +29,9 @@ from swift.obj import server as object_server
|
||||
from swift.proxy import server as proxy
|
||||
import swift.proxy.controllers
|
||||
from swift.proxy.controllers.base import get_object_info
|
||||
from test.unit import FakeMemcache, debug_logger, FakeRing, \
|
||||
fake_http_connect, patch_policies, skip_if_no_xattrs
|
||||
from test.debug_logger import debug_logger
|
||||
from test.unit import FakeMemcache, FakeRing, fake_http_connect, \
|
||||
patch_policies, skip_if_no_xattrs
|
||||
|
||||
|
||||
class FakeServerConnection(WSGIContext):
|
||||
|
Loading…
Reference in New Issue
Block a user