Swift 2023.2, swiftaio unit tests fails because of python 3.11 dependencies

Bug #2059900 reported by Barun Kumar

This bug report will be marked for expiration in 28 days if no further activity occurs. (find out why)

6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Incomplete
Undecided
Unassigned

Bug Description

=========================== short test summary info ============================
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_root_update_bad_location_header
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_root_update_missing_location_header
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_root_update_redirected
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_root_update_redirected_previous_success
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_shard_update_redirected_twice
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_update_redirection_loop
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_async_updates - A...
FAILED obj/test_updater.py::TestObjectUpdater::test_obj_put_legacy_updates - ...
FAILED proxy/test_mem_server.py::TestReplicatedObjectController::test_PUT_POST_last_modified
= 9 failed, 8507 passed, 1 skipped, 3 deselected, 26 warnings in 554.59s (0:09:14) =

Some detailed logs-
=================================== FAILURES ===================================
_____ TestObjectUpdater.test_obj_put_async_root_update_bad_location_header _____

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
> return object.__getattribute__(self, name)
E AttributeError: 'DebugLogAdapter' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:253: AttributeError

During handling of the above exception, another exception occurred:

self = <test.unit.obj.test_updater.TestObjectUpdater testMethod=test_obj_put_async_root_update_bad_location_header>

    def test_obj_put_async_root_update_bad_location_header(self):
        headers = {
            'Location': 'bad bad bad',
            'X-Backend-Redirect-Timestamp': next(self.ts_iter).internal}
> daemon = self._check_obj_put_async_update_bad_redirect_headers(headers)

/usr/local/src/swift/test/unit/obj/test_updater.py:1041:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/src/swift/test/unit/obj/test_updater.py:1025: in _check_obj_put_async_update_bad_redirect_headers
    daemon.logger.get_increment_counts())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except AttributeError:
> return getattr(self.__dict__['logger'], name)
E AttributeError: 'DebugLogger' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:255: AttributeError
----------------------------- Captured stdout call -----------------------------

___ TestObjectUpdater.test_obj_put_async_root_update_missing_location_header ___

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
> return object.__getattribute__(self, name)
E AttributeError: 'DebugLogAdapter' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:253: AttributeError

During handling of the above exception, another exception occurred:

self = <test.unit.obj.test_updater.TestObjectUpdater testMethod=test_obj_put_async_root_update_missing_location_header>

    def test_obj_put_async_root_update_missing_location_header(self):
        headers = {
            'X-Backend-Redirect-Timestamp': next(self.ts_iter).internal}
> self._check_obj_put_async_update_bad_redirect_headers(headers)

/usr/local/src/swift/test/unit/obj/test_updater.py:1035:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/src/swift/test/unit/obj/test_updater.py:1025: in _check_obj_put_async_update_bad_redirect_headers
    daemon.logger.get_increment_counts())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except AttributeError:
> return getattr(self.__dict__['logger'], name)
E AttributeError: 'DebugLogger' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:255: AttributeError
----------------------------- Captured stdout call -----------------------------

_________ TestObjectUpdater.test_obj_put_async_update_redirection_loop _________

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
> return object.__getattribute__(self, name)
E AttributeError: 'DebugLogAdapter' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:253: AttributeError

During handling of the above exception, another exception occurred:

self = <test.unit.obj.test_updater.TestObjectUpdater testMethod=test_obj_put_async_update_redirection_loop>

    def test_obj_put_async_update_redirection_loop(self):
        policies = list(POLICIES)
        random.shuffle(policies)
        # setup updater
        conf = {
            'devices': self.devices_dir,
            'mount_check': 'false',
            'swift_dir': self.testdir,
        }
        daemon = object_updater.ObjectUpdater(conf, logger=self.logger)
        async_dir = os.path.join(self.sda1, get_async_dir(policies[0]))
        os.mkdir(async_dir)
        dfmanager = DiskFileManager(conf, daemon.logger)

        ts_obj = next(self.ts_iter)
        self._write_async_update(dfmanager, ts_obj, policies[0])
        orig_async_path, orig_async_data = self._check_async_file(async_dir)

        # run once
        ts_redirect = next(self.ts_iter)

        resp_headers_1 = {'Location': '/.shards_a/c_shard_1/o',
                          'X-Backend-Redirect-Timestamp': ts_redirect.internal}
        resp_headers_2 = {'Location': '/.shards_a/c_shard_2/o',
                          'X-Backend-Redirect-Timestamp': ts_redirect.internal}
        fake_responses = (
            # 1st round of redirects, 2nd round of redirects
            [(301, resp_headers_1)] * 3 + [(301, resp_headers_2)] * 3)
        fake_status_codes, fake_headers = zip(*fake_responses)
        with mocked_http_conn(
                *fake_status_codes, headers=fake_headers) as conn:
            with mock.patch('swift.obj.updater.dump_recon_cache'):
                daemon.run_once()
        self._check_update_requests(conn.requests[:3], ts_obj, policies[0])
        self._check_update_requests(conn.requests[3:], ts_obj, policies[0])
        # only *one* set of redirected requests is attempted per cycle
        root_part = daemon.container_ring.get_part('a/c')
        shard_1_part = daemon.container_ring.get_part('.shards_a/c_shard_1')
        shard_2_part = daemon.container_ring.get_part('.shards_a/c_shard_2')
        shard_3_part = daemon.container_ring.get_part('.shards_a/c_shard_3')
        self.assertEqual(['/sda1/%s/a/c/o' % root_part] * 3 +
                         ['/sda1/%s/.shards_a/c_shard_1/o' % shard_1_part] * 3,
                         [req['path'] for req in conn.requests])
        self.assertEqual(
            {'redirects': 2, 'async_pendings': 1, 'async_pendings.a.c': 1},
> daemon.logger.get_increment_counts())

/usr/local/src/swift/test/unit/obj/test_updater.py:1178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DebugLogAdapter swift.unit.fake_logger (NOTSET)>
name = 'get_increment_counts'

    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except AttributeError:
> return getattr(self.__dict__['logger'], name)
E AttributeError: 'DebugLogger' object has no attribute 'get_increment_counts'

/usr/local/src/swift/test/debug_logger.py:255: AttributeError
----------------------------- Captured stdout call -----------------------------

Revision history for this message
Tim Burke (1-tim-z) wrote :

Those stats-related functions moved in https://github.com/openstack/swift/commit/00bfc425 to a new FakeStatsdClient. That was included in 2.32.0, and updated the affected tests to reference (for example) daemon.logger.statsd_client.get_increment_counts

What SHA are you working from? Any chance you've got a dirty working tree?

Changed in swift:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.