py310 unit test failures

Bug #1976555 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
proliantutils
New
Undecided
Unassigned

Bug Description

There are 8 unit test failures with py310. These can be recreated on Ubuntu 22.04 with 'tox -e py310'.

Revision history for this message
Corey Bryant (corey.bryant) wrote :
Download full text (4.2 KiB)

For example:

proliantutils.tests.redfish.test_main.HPESushyTestCase.test_get_system_collection_path_missing_systems_attr
-----------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/usr/lib/python3.10/unittest/mock.py", line 1369, in patched
    return func(*newargs, **newkeywargs)
      File "/home/corey/pkg/zed/upstream/proliantutils/proliantutils/tests/redfish/test_main.py", line 40, in setUp
    self.hpe_sushy = main.HPESushy('https://1.2.3.4',
      File "/home/corey/pkg/zed/upstream/proliantutils/proliantutils/redfish/main.py", line 59, in __init__
    super(HPESushy, self).__init__(
      File "/home/corey/pkg/zed/upstream/proliantutils/.tox/py310/lib/python3.10/site-packages/sushy/main.py", line 203, in __init__
    self._auth.authenticate()
      File "/home/corey/pkg/zed/upstream/proliantutils/.tox/py310/lib/python3.10/site-packages/sushy/auth.py", line 57, in authenticate
    self._do_authenticate()
      File "/home/corey/pkg/zed/upstream/proliantutils/.tox/py310/lib/python3.10/site-packages/sushy/auth.py", line 243, in _do_authenticate
    super(SessionOrBasicAuth, self)._do_authenticate()
      File "/home/corey/pkg/zed/upstream/proliantutils/.tox/py3...

Read more...

Revision history for this message
Julia Kreger (juliaashleykreger) wrote :
Download full text (4.3 KiB)

I'm encountering the same issue on stable/wallaby, while running `tox -epy38`, with my uppers constraints slightly modified as such, just for pip to be happy.

$ git diff
diff --git a/tox.ini b/tox.ini
index 3a356b3..b22b8d2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,7 +14,6 @@ setenv = VIRTUAL_ENV={envdir}
          PYTHONWARNINGS=default::DeprecationWarning
          TESTS_DIR=./proliantutils/tests/
 deps =
- -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
   -r{toxinidir}/requirements.txt
   -r{toxinidir}/test-requirements.txt
 commands =
$ ^C

Anyhow, I see 8 tests failing as above, as proliantutils is attempting to mock internals of sushy, which is not great, but then is attempting to leverage other parts without just submitting code to sushy, which is also not great.

proliantutils.tests.redfish.test_main.HPESushyTestCase.test_get_manager_collection_path
---------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 1346, in patched
    return func(*newargs, **newkeywargs)

      File "/home/jkreger/proliantutils/proliantutils/tests/redfish/test_main.py", line 40, in setUp
    self.hpe_sushy = main.HPESushy('https://1.2.3.4',

      File "/home/jkreger/proliantutils/proliantutils/redfish/main.py", line 59, in __init__
    super(HPESushy, self).__init__(

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/sushy/main.py", line 195, in __init__
    self._auth.authenticate()

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/sushy/auth.py", line 57, in authenticate
    self._do_authenticate()

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/sushy/auth.py", line 244, in _do_authenticate
    super(SessionOrBasicAuth, self)._do_authenticate()

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/sushy/auth.py", line 159, in _do_authenticate
    auth_token, session_uri = self._root_resource.create_session(

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/sushy/main.py", line 418, in create_session
    self._conn._session.auth = None

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 632, in __getattr__
    raise AttributeError("Mock object has no attribute %r" % name)

    AttributeError: Mock object has no attribute '_session'

and...

proliantutils.tests.redfish.resources.system.test_system.HPESystemTestCase.test_update_persistent_boot_uefi_target
------------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/home/jkreger/proliantutils/proliantutils/tests/redfish/resources/system/test_system.py", line 185, in test_update_persistent_boot_uefi_target
    self.sys_inst._conn.patch.assert_has_calls(calls)

      File "/home/jkreger/proliantutils/.tox/py38/lib/python3.8/site-package...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to proliantutils (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/x/proliantutils/+/865882

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to proliantutils (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/x/proliantutils/+/865910

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to proliantutils (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/x/proliantutils/+/865912

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to proliantutils (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/x/proliantutils/+/866025

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to proliantutils (stable/yoga)

Reviewed: https://review.opendev.org/c/x/proliantutils/+/865910
Committed: https://opendev.org/x/proliantutils/commit/a439eb7fa8539477ae8bb143b0ea8a16b39e4b05
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit a439eb7fa8539477ae8bb143b0ea8a16b39e4b05
Author: Nisha Agarwal <email address hidden>
Date: Fri Sep 2 16:57:06 2022 +0000

    fix the broken test cases

    Adds a mock of sushy internal authentication to avoid
    internal exceptions occuring from tests executing which
    are expecting specific precise method behavior/interaction
    from the underlying sushy library.

    This is due to Id9a32ebcc04f4f3fecb4e10cf157a97322707c94
    and Ic52c4353cb1e1674511417223de10fa625b99af1
    which fixed authentication handling so connection retry
    and recovery can be approperately handled.

    Also swaps the header to etag call on a boot mode check
    introduced by I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac
    which is impacted by recent fixes to handle etag requirements
    in some BMCs, such as I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac.

    Closes-Bug: 1976555
    Change-Id: Idb1d362bc890afbc6bd6b4aca42a5eed841d1b35

tags: added: in-stable-yoga
tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to proliantutils (stable/wallaby)

Reviewed: https://review.opendev.org/c/x/proliantutils/+/866025
Committed: https://opendev.org/x/proliantutils/commit/809f641ebf10507e9e12d304b50088f8713dedb2
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 809f641ebf10507e9e12d304b50088f8713dedb2
Author: Nisha Agarwal <email address hidden>
Date: Fri Sep 2 16:57:06 2022 +0000

    fix the broken test cases

    Adds a mock of sushy internal authentication to avoid
    internal exceptions occuring from tests executing which
    are expecting specific precise method behavior/interaction
    from the underlying sushy library.

    This is due to Id9a32ebcc04f4f3fecb4e10cf157a97322707c94
    and Ic52c4353cb1e1674511417223de10fa625b99af1
    which fixed authentication handling so connection retry
    and recovery can be approperately handled.

    Also swaps the header to etag call on a boot mode check
    introduced by I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac
    which is impacted by recent fixes to handle etag requirements
    in some BMCs, such as I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac.

    Closes-Bug: 1976555
    Change-Id: Idb1d362bc890afbc6bd6b4aca42a5eed841d1b35
    (cherry picked from commit a439eb7fa8539477ae8bb143b0ea8a16b39e4b05)
    (cherry picked from commit 6b2910aaf0d353fccb16ef86c564f76abd180b16)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to proliantutils (stable/xena)

Reviewed: https://review.opendev.org/c/x/proliantutils/+/865912
Committed: https://opendev.org/x/proliantutils/commit/6b2910aaf0d353fccb16ef86c564f76abd180b16
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 6b2910aaf0d353fccb16ef86c564f76abd180b16
Author: Nisha Agarwal <email address hidden>
Date: Fri Sep 2 16:57:06 2022 +0000

    fix the broken test cases

    Adds a mock of sushy internal authentication to avoid
    internal exceptions occuring from tests executing which
    are expecting specific precise method behavior/interaction
    from the underlying sushy library.

    This is due to Id9a32ebcc04f4f3fecb4e10cf157a97322707c94
    and Ic52c4353cb1e1674511417223de10fa625b99af1
    which fixed authentication handling so connection retry
    and recovery can be approperately handled.

    Also swaps the header to etag call on a boot mode check
    introduced by I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac
    which is impacted by recent fixes to handle etag requirements
    in some BMCs, such as I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac.

    Closes-Bug: 1976555
    Change-Id: Idb1d362bc890afbc6bd6b4aca42a5eed841d1b35
    (cherry picked from commit a439eb7fa8539477ae8bb143b0ea8a16b39e4b05)

tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to proliantutils (master)

Reviewed: https://review.opendev.org/c/x/proliantutils/+/865882
Committed: https://opendev.org/x/proliantutils/commit/f03714f78c3e930c8001e3a24fbdcddb0e181090
Submitter: "Zuul (22348)"
Branch: master

commit f03714f78c3e930c8001e3a24fbdcddb0e181090
Author: Julia Kreger <email address hidden>
Date: Mon Nov 28 11:03:46 2022 -0800

    Fix etag header test

    Proliantutils has a pattern of testing internal calls inside of
    the Sushy library. This has the unfortunate side effect of becoming
    broken as bugs and related issues are fixed.

    Fixes the check on a response which upstream sushy has discovered
    has become sensitive on several vendors where eTags must be utilized
    to ensure a reliable and correct response from the BMC.

    Related-Bug: #1976555
    Change-Id: I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to proliantutils (stable/zed)

Related fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/x/proliantutils/+/882510

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to proliantutils (stable/zed)

Reviewed: https://review.opendev.org/c/x/proliantutils/+/882510
Committed: https://opendev.org/x/proliantutils/commit/cdd715d5b633075b49e3b743ddfbeb9b76f9e4ca
Submitter: "Zuul (22348)"
Branch: stable/zed

commit cdd715d5b633075b49e3b743ddfbeb9b76f9e4ca
Author: Julia Kreger <email address hidden>
Date: Mon Nov 28 11:03:46 2022 -0800

    Fix etag header test

    Proliantutils has a pattern of testing internal calls inside of
    the Sushy library. This has the unfortunate side effect of becoming
    broken as bugs and related issues are fixed.

    Fixes the check on a response which upstream sushy has discovered
    has become sensitive on several vendors where eTags must be utilized
    to ensure a reliable and correct response from the BMC.

    Related-Bug: #1976555
    Change-Id: I6b802fbb6a3f93f67269c141cad02b58ccd2d3ac
    (cherry picked from commit f03714f78c3e930c8001e3a24fbdcddb0e181090)

tags: added: in-stable-zed
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.