]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cephadm: fix iscsi test_unit_run relying on how cephadm was being imported
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 26 Sep 2022 19:14:20 +0000 (15:14 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 27 Sep 2022 18:41:54 +0000 (14:41 -0400)
commit9fbf1546cb5fbc4640ee0fcb8b8132611f838de5
tree5adb1ef2a202f6e140aabf65b231d6f811ad3dbe
parentd0893e7558d99b8b5d3ef72eb1e270bcc84a6b9a
cephadm: fix iscsi test_unit_run relying on how cephadm was being imported

The iscsi test_unit_run test case was relying upon a strange side-effect
of how the cephadm module was being imported in fixtures.py. In short,
it expected the podman container_engine not to be a subclass of Podman.

```
(Pdb) p ctx.container_engine
<Mock spec='Podman' id='140676342644256'>
(Pdb) p ctx.container_engine.__class__
<class 'cephadm.Podman'>
(Pdb) p isinstance(ctx.container_engine, Podman)
False
(Pdb) p id(ctx.container_engine.__class__)
94372514199712
(Pdb) p id(Podman)
94372516682112
```

In order to clean up fixtures.py and other imports of cephadm as a
module, we fix the test to expect a mock docker. We choose docker
because it only requires changes the path of the container engine. If we
changed it to a real podman subclass we'd have to change many arguments
in the expected CLI text.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/tests/test_cephadm.py