cinder/cinder/tests/unit/privsep
Gorka Eguileor 2d47a8fdd8 Fix test_nvmet_driver tests
Unit tests fails when running on systems without nvmet support.

This is caused by the nvmet library trying to do some safe reads on
sysfs.  Writtings won't happen though.

This patch ensures that we always use a mocked nvmet library instead of
trying to use the real library when available like we are doing now.

Example of failure:

cinder.tests.unit.targets.test_nvmet_driver.TestNVMETDriver.test__namespace_dict_shared
---------------------------------------------------------------------------------------

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

      File "/home/zuul/src/code.engineering.redhat.com/cinder/cinder/tests/unit/targets/test_nvmet_driver.py", line 34, in setUp
    self.target = nvmet.NVMET(root_helper=utils.get_root_helper(),

      File "/home/zuul/src/code.engineering.redhat.com/cinder/cinder/volume/targets/nvmet.py", line 40, in __init__
    self._nvmet_root = nvmet.Root()

      File "/usr/lib/python3.9/site-packages/nvmet/nvme.py", line 241, in __init__
    raise CFSError("%s does not exist.  Giving up." %

    nvmet.nvme.CFSError: /sys/kernel/config/nvmet does not exist.  Giving up.

Change-Id: I1845ce07886d7cd6256be55c71e9da3fd9122fe4
2023-10-03 17:39:53 +02:00
..
targets Fix test_nvmet_driver tests 2023-10-03 17:39:53 +02:00
__init__.py LVM-nvmet: Use nvmetcli as library instead of CLI 2022-11-24 15:38:41 +01:00