From: Sebastian Wagner Date: Fri, 13 Dec 2019 16:28:18 +0000 (+0100) Subject: mgr/ansible: Integrate mgr/ansible/tox into mgr/tox X-Git-Tag: v15.1.0~450^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2387f0d124c79cf3dbe14d1863c4829e0cf781c;p=ceph.git mgr/ansible: Integrate mgr/ansible/tox into mgr/tox Reason to make this switch is to be able to do proper refactorings in the orchestrators. Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index f7e200b1f88..3d58d0904f0 100644 --- a/src/pybind/mgr/CMakeLists.txt +++ b/src/pybind/mgr/CMakeLists.txt @@ -2,7 +2,6 @@ if(WITH_MGR_DASHBOARD_FRONTEND) add_subdirectory(dashboard) endif() add_subdirectory(insights) -add_subdirectory(ansible) if(WITH_TESTS) include(AddCephTest) diff --git a/src/pybind/mgr/ansible/.gitignore b/src/pybind/mgr/ansible/.gitignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/pybind/mgr/ansible/CMakeLists.txt b/src/pybind/mgr/ansible/CMakeLists.txt deleted file mode 100644 index 476be7a98c8..00000000000 --- a/src/pybind/mgr/ansible/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -if(WITH_TESTS) - include(AddCephTest) - add_tox_test(mgr-ansible) -endif() diff --git a/src/pybind/mgr/ansible/requirements.txt b/src/pybind/mgr/ansible/requirements.txt deleted file mode 100644 index c6ddb76f9f1..00000000000 --- a/src/pybind/mgr/ansible/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -tox==2.9.1 -pytest -mock -requests-mock --e ../../../python-common diff --git a/src/pybind/mgr/ansible/tests/test_client_playbooks.py b/src/pybind/mgr/ansible/tests/test_client_playbooks.py index cadcd9b8450..0bb75c5add0 100644 --- a/src/pybind/mgr/ansible/tests/test_client_playbooks.py +++ b/src/pybind/mgr/ansible/tests/test_client_playbooks.py @@ -1,7 +1,8 @@ import logging import unittest -import mock +from tests import mock import json +import os import requests_mock @@ -20,7 +21,7 @@ PB_NAME = "test_playbook" PB_UUID = "1733c3ac" # Playbook execution data file -PB_EVENTS_FILE = "./tests/pb_execution_events.data" +PB_EVENTS_FILE = os.path.dirname( __file__) + "/pb_execution_events.data" # create console handler and set level to info logger = logging.getLogger() diff --git a/src/pybind/mgr/ansible/tests/test_output_wizards.py b/src/pybind/mgr/ansible/tests/test_output_wizards.py index 02d72e95aef..fb856ce7d40 100644 --- a/src/pybind/mgr/ansible/tests/test_output_wizards.py +++ b/src/pybind/mgr/ansible/tests/test_output_wizards.py @@ -1,7 +1,7 @@ """ Test output wizards """ import unittest -import mock +from tests import mock from ..ansible_runner_svc import EVENT_DATA_URL from ..output_wizards import ProcessHostsList, ProcessPlaybookResult, \ diff --git a/src/pybind/mgr/ansible/tox.ini b/src/pybind/mgr/ansible/tox.ini deleted file mode 100644 index c4d96b914ff..00000000000 --- a/src/pybind/mgr/ansible/tox.ini +++ /dev/null @@ -1,15 +0,0 @@ -[tox] -envlist = py{27,3} -skipsdist = true -toxworkdir = {env:CEPH_BUILD_DIR}/ansible -minversion = 2.8.1 - -[testenv] -deps = - -rrequirements.txt -setenv= - UNITTEST = true - py27: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.2 - py3: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3 -commands= - {envbindir}/py.test tests/ diff --git a/src/pybind/mgr/requirements.txt b/src/pybind/mgr/requirements.txt index c60dc4a8982..2b0e951104c 100644 --- a/src/pybind/mgr/requirements.txt +++ b/src/pybind/mgr/requirements.txt @@ -3,3 +3,4 @@ mock; python_version <= '3.3' ipaddress; python_version < '3.3' ../../python-common kubernetes +requests-mock \ No newline at end of file diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 8257ba615fb..7cce321c687 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -5,11 +5,11 @@ skipsdist = true [testenv] setenv = UNITTEST = true deps = -r requirements.txt -commands = pytest -v --cov --cov-append --cov-report=term --doctest-modules {posargs:mgr_util.py tests/ cephadm/} +commands = pytest -v --cov --cov-append --cov-report=term --doctest-modules {posargs:mgr_util.py tests/ cephadm/ ansible/} [testenv:mypy] basepython = python3 deps = -r requirements.txt mypy -commands = mypy --config-file=../../mypy.ini orchestrator.py cephadm/module.py rook/module.py \ No newline at end of file +commands = mypy --config-file=../../mypy.ini orchestrator.py cephadm/module.py rook/module.py ansible/module.py \ No newline at end of file