]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: update container engine test imports
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 28 Sep 2023 21:01:11 +0000 (17:01 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Sun, 10 Dec 2023 15:13:31 +0000 (10:13 -0500)
Update container engine tests file to use the canonical module for
container engines rather than importing them indirectly from cephadm.py.
This future proofs the test in case the imports in cephadm.py change.

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

index 7c5ef51312715a590f47e90e8589e4082400bf1c..49f9f9a2e50aeb4396f58004575c08f2e2dc5e2a 100644 (file)
@@ -4,7 +4,7 @@ import pytest
 
 from tests.fixtures import with_cephadm_ctx, import_cephadm
 
-_cephadm = import_cephadm()
+from cephadmlib import container_engines
 
 
 _find_program_loc = 'cephadmlib.container_engine_base.find_program'
@@ -29,7 +29,7 @@ def test_container_engine():
 def test_podman():
     with mock.patch(_find_program_loc) as find_program:
         find_program.return_value = "/usr/bin/podman"
-        pm = _cephadm.Podman()
+        pm = container_engines.Podman()
         find_program.assert_called()
         with pytest.raises(RuntimeError):
             pm.version
@@ -44,7 +44,7 @@ def test_podman():
 def test_podman_badversion():
     with mock.patch(_find_program_loc) as find_program:
         find_program.return_value = "/usr/bin/podman"
-        pm = _cephadm.Podman()
+        pm = container_engines.Podman()
         find_program.assert_called()
         with mock.patch(_call_throws_loc) as call_throws:
             call_throws.return_value = ("4.10.beta2", None, None)
@@ -56,5 +56,5 @@ def test_podman_badversion():
 def test_docker():
     with mock.patch(_find_program_loc) as find_program:
         find_program.return_value = "/usr/bin/docker"
-        docker = _cephadm.Docker()
+        docker = container_engines.Docker()
         assert str(docker) == "docker (/usr/bin/docker)"