]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: mock a call to shutil.rmtree
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 1 Nov 2024 18:38:11 +0000 (14:38 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 4 Nov 2024 20:38:43 +0000 (15:38 -0500)
Mock out calls to shutil.rmtree in test_deploy_and_rm_iscsi. The test
never asserts that things in the file system are removed, so making the
call a no-op is safe. Calling shutil.rmtree with the fake file system
enabled recently became a problem.  In python 3.12 (or 3.11?) changes to
the shutil module function shutil.rmtree are incompatible with the fake
file system that cephadm tests rely upon heavily.

Part of an effort to get ceph tox environments passing on Python 3.12.

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

index 58f212beff6d6c0cc287edc709bd837b7abd172c..c5094db335fd68fa45e78bb09ba4688d80f6f099 100644 (file)
@@ -495,6 +495,7 @@ def test_deploy_ceph_exporter_container(cephadm_fs, funkypatch):
 def test_deploy_and_rm_iscsi(cephadm_fs, funkypatch):
     # Test that the deploy and remove paths for iscsi (which has sidecar container)
     # create and remove the correct unit files.
+    funkypatch.patch('shutil.rmtree')  # fakefs + shutil.rmtree breaks on py3.12
     mocks = _common_patches(funkypatch)
     _firewalld = mocks['Firewalld']
     fsid = 'b01dbeef-701d-9abe-0000-e1e5a47004a7'