From: Thomas Bechtold Date: Thu, 7 Nov 2019 16:47:02 +0000 (+0100) Subject: ceph-daemon: Add basic unittest infrastructure and cmake integration X-Git-Tag: v15.1.0~982^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31467%2Fhead;p=ceph.git ceph-daemon: Add basic unittest infrastructure and cmake integration To be able to write unittests, add a tox.ini (for testing in venvs) and a first single test case as example. Tests can be executed with eg: $ tox Or by running the usual: $ ./run-make-check.sh Signed-off-by: Thomas Bechtold --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f902ec36507..8109e3af0f32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -491,6 +491,7 @@ endif() add_subdirectory(pybind) add_subdirectory(ceph-volume) add_subdirectory(python-common) +add_subdirectory(ceph-daemon) # Monitor add_subdirectory(mon) diff --git a/src/ceph-daemon/CMakeLists.txt b/src/ceph-daemon/CMakeLists.txt new file mode 100644 index 000000000000..40e74ba30d39 --- /dev/null +++ b/src/ceph-daemon/CMakeLists.txt @@ -0,0 +1,4 @@ +if(WITH_TESTS) + include(AddCephTest) + add_tox_test(ceph-daemon TOX_ENVS) +endif() diff --git a/src/ceph-daemon/tests/__init__.py b/src/ceph-daemon/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/src/ceph-daemon/tests/test_ceph_daemon.py b/src/ceph-daemon/tests/test_ceph_daemon.py new file mode 100644 index 000000000000..65f98e47fc87 --- /dev/null +++ b/src/ceph-daemon/tests/test_ceph_daemon.py @@ -0,0 +1,10 @@ +import imp +import unittest + + +cd = imp.load_source("ceph-daemon", "ceph-daemon") + + +class TestCephDaemon(unittest.TestCase): + def test_is_fsid(self): + self.assertFalse(cd.is_fsid('no-uuid')) diff --git a/src/ceph-daemon/tox.ini b/src/ceph-daemon/tox.ini new file mode 100644 index 000000000000..931aee1491af --- /dev/null +++ b/src/ceph-daemon/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py27, py3 + +[testenv] +skipsdist=true +skip_install=true +deps = pytest +commands=pytest {posargs}