2 test failing local unit test run

Bug #2032941 reported by Rajat Dhasmana
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-brick
Fix Released
Undecided
Unassigned

Bug Description

After merging patch[1] 2 of the tests started failing locally since they started returning nvme_hostid in the response.
This is environment specific since this value is read from '/etc/nvme/hostid' file and system's not having this file won't face this issue.

==============================
Failed 2 tests - output below:
==============================

os_brick.tests.initiator.test_connector.ConnectorUtilsTestCase.test_brick_get_connector_properties
--------------------------------------------------------------------------------------------------

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

      File "/opt/stack/os-brick/os_brick/tests/initiator/test_connector.py", line 114, in test_brick_get_connector_properties
    self._test_brick_get_connector_properties(False, False, False)

      File "/usr/lib/python3.10/unittest/mock.py", line 1379, in patched
    return func(*newargs, **newkeywargs)

      File "/opt/stack/os-brick/os_brick/tests/initiator/test_connector.py", line 88, in _test_brick_get_connector_properties
    self.assertEqual(props, props_actual)

      File "/opt/stack/os-brick/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 394, in assertEqual
    self.assertThat(observed, matcher, message)

      File "/opt/stack/os-brick/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 481, in assertThat
    raise mismatch_error

    testtools.matchers._impl.MismatchError: !=:
reference = {'do_local_attach': False,
 'host': 'fakehost',
 'initiator': 'fakeinitiator',
 'ip': '10.0.0.1',
 'multipath': False,
 'nvme_native_multipath': False,
 'os_type': 'linux2',
 'platform': 's390x'}
actual = {'do_local_attach': False,
 'host': 'fakehost',
 'initiator': 'fakeinitiator',
 'ip': '10.0.0.1',
 'multipath': False,
 'nvme_hostid': '351765db-360b-43d6-a0b4-c1644adaf38b',
 'nvme_native_multipath': False,
 'os_type': 'linux2',
 'platform': 's390x'}

os_brick.tests.initiator.test_connector.ConnectorUtilsTestCase.test_brick_connector_properties_override_hostname
----------------------------------------------------------------------------------------------------------------

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

      File "/opt/stack/os-brick/os_brick/tests/initiator/test_connector.py", line 148, in test_brick_connector_properties_override_hostname
    self._test_brick_get_connector_properties(False, False, False,

      File "/usr/lib/python3.10/unittest/mock.py", line 1379, in patched
    return func(*newargs, **newkeywargs)

      File "/opt/stack/os-brick/os_brick/tests/initiator/test_connector.py", line 88, in _test_brick_get_connector_properties
    self.assertEqual(props, props_actual)

      File "/opt/stack/os-brick/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 394, in assertEqual
    self.assertThat(observed, matcher, message)

      File "/opt/stack/os-brick/.tox/py310/lib/python3.10/site-packages/testtools/testcase.py", line 481, in assertThat
    raise mismatch_error

    testtools.matchers._impl.MismatchError: !=:
reference = {'do_local_attach': False,
 'host': 'myhostname',
 'initiator': 'fakeinitiator',
 'ip': '10.0.0.1',
 'multipath': False,
 'nvme_native_multipath': False,
 'os_type': 'linux2',
 'platform': 's390x'}
actual = {'do_local_attach': False,
 'host': 'myhostname',
 'initiator': 'fakeinitiator',
 'ip': '10.0.0.1',
 'multipath': False,
 'nvme_hostid': '351765db-360b-43d6-a0b4-c1644adaf38b',
 'nvme_native_multipath': False,
 'os_type': 'linux2',
 'platform': 's390x'}

======
Totals
======
Ran: 1036 tests in 0.6154 sec.
 - Passed: 1034
 - Skipped: 0
 - Expected Fail: 0
 - Unexpected Success: 0
 - Failed: 2
Sum of execute time for each test: 3.3117 sec.

[1] https://review.opendev.org/c/openstack/os-brick/+/880222

summary: - 2 test failing in local run
+ 2 test failing unit test run
summary: - 2 test failing unit test run
+ 2 test failing local unit test run
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to os-brick (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/os-brick/+/892669

Changed in os-brick:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-brick (master)

Reviewed: https://review.opendev.org/c/openstack/os-brick/+/892669
Committed: https://opendev.org/openstack/os-brick/commit/71627c56ac14bd3d31e78979d430eccee9a92d91
Submitter: "Zuul (22348)"
Branch: master

commit 71627c56ac14bd3d31e78979d430eccee9a92d91
Author: whoami-rajat <email address hidden>
Date: Thu Aug 24 12:02:43 2023 +0000

    Fix unit tests when hostid file exists

    After merging change I0b60f9078f23f8464d8234841645ed520e8ba655, we
    noticed an issue with existing unit tests which started failing.
    The reason is 'nvme_hostid' was an additional parameter returned
    in the response while fetching connector properties from nvme
    connector.
    This is environment specific and won't occur in environments where
    '/etc/nvme/hostid' file doesn't exist due to which these tests
    passed in gate but failed in the local run when hostid file
    was present.
    This patch mocks the get_nvme_host_id method for tests so the
    hostid is never returned irrespective of the environment.

    Closes-Bug: #2032941
    Change-Id: I8b1aaedfdb9bef6e34813e39dede9afe98371d2b

Changed in os-brick:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/os-brick 6.4.0

This issue was fixed in the openstack/os-brick 6.4.0 release.

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.