mirror of
https://github.com/ceph/ceph
synced 2025-01-01 00:22:25 +00:00
mgr/dashboard_v2: mocking of rados and rbd modules
Signed-off-by: Ricardo Dias <rdias@suse.com>
This commit is contained in:
parent
41205565c6
commit
c803df1335
@ -3,7 +3,7 @@
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code
|
||||
extension-pkg-whitelist=
|
||||
extension-pkg-whitelist=rados,rbd
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
|
@ -26,8 +26,10 @@ else:
|
||||
import logging
|
||||
import sys
|
||||
# pylint: disable=W0403
|
||||
from . import ceph_module_mock
|
||||
from .cephmock import ceph_module_mock, rados_mock, rbd_mock
|
||||
sys.modules['ceph_module'] = ceph_module_mock
|
||||
sys.modules['rados'] = rados_mock
|
||||
sys.modules['rbd'] = rbd_mock
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.root.handlers[0].setLevel(logging.WARNING)
|
||||
|
0
src/pybind/mgr/dashboard_v2/cephmock/__init__.py
Normal file
0
src/pybind/mgr/dashboard_v2/cephmock/__init__.py
Normal file
@ -36,3 +36,6 @@ class BaseMgrModule(object):
|
||||
|
||||
def _ceph_log(self, *args):
|
||||
pass
|
||||
|
||||
def _ceph_get_context(self):
|
||||
return None
|
12
src/pybind/mgr/dashboard_v2/cephmock/rados_mock.py
Normal file
12
src/pybind/mgr/dashboard_v2/cephmock/rados_mock.py
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
class Rados(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def connect(self):
|
||||
pass
|
||||
|
||||
def open_ioctx(self, pool_name):
|
||||
pass
|
31
src/pybind/mgr/dashboard_v2/cephmock/rbd_mock.py
Normal file
31
src/pybind/mgr/dashboard_v2/cephmock/rbd_mock.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
RBD_FEATURE_LAYERING = "RBD_FEATURE_LAYERING"
|
||||
RBD_FEATURE_STRIPINGV2 = "RBD_FEATURE_STRIPINGV2"
|
||||
RBD_FEATURE_EXCLUSIVE_LOCK = "RBD_FEATURE_EXCLUSIVE_LOCK"
|
||||
RBD_FEATURE_OBJECT_MAP = "RBD_FEATURE_OBJECT_MAP"
|
||||
RBD_FEATURE_FAST_DIFF = "RBD_FEATURE_FAST_DIFF"
|
||||
RBD_FEATURE_DEEP_FLATTEN = "RBD_FEATURE_DEEP_FLATTEN"
|
||||
RBD_FEATURE_JOURNALING = "RBD_FEATURE_JOURNALING"
|
||||
RBD_FEATURE_DATA_POOL = "RBD_FEATURE_DATA_POOL"
|
||||
RBD_FEATURE_OPERATIONS = "RBD_FEATURE_OPERATIONS"
|
||||
|
||||
|
||||
class RBD(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def list(self, ioctx):
|
||||
pass
|
||||
|
||||
|
||||
class Image(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def stat(self):
|
||||
pass
|
||||
|
||||
def features(self):
|
||||
pass
|
@ -8,6 +8,8 @@ setenv=
|
||||
UNITTEST=true
|
||||
WEBTEST_INTERACTIVE=false
|
||||
COVERAGE_FILE= .coverage.{envname}
|
||||
PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3:{toxinidir}/../../../../build/lib/cython_modules/lib.2
|
||||
LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
|
||||
commands=
|
||||
{envbindir}/py.test --cov=. --cov-report= --junitxml=junit.{envname}.xml tests/
|
||||
|
||||
@ -28,7 +30,10 @@ commands =
|
||||
coverage xml
|
||||
|
||||
[testenv:lint]
|
||||
setenv =
|
||||
PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3:{toxinidir}/../../../../build/lib/cython_modules/lib.2
|
||||
LD_LIBRARY_PATH = {toxinidir}/../../../../build/lib
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
commands=
|
||||
pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py ceph_module_mock.py controllers tests
|
||||
pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests cephmock
|
||||
pycodestyle --max-line-length=100 --exclude=python2.7,.tox,venv,frontend .
|
||||
|
Loading…
Reference in New Issue
Block a user