ClusterLabs / crmsh

Command-line interface for High-Availability cluster management on GNU/Linux systems.
GNU General Public License v2.0
131 stars 94 forks source link

How to do the test? #187

Closed liangxin1300 closed 1 year ago

liangxin1300 commented 7 years ago

Hi @krig, I followed with http://crmsh.github.io/development/, pip install nose install crmsh-test rpm cd /usr/share/crmsh and run "./tests/run" these can not work:

Traceback (most recent call last):
  File "/usr/bin/nosetests", line 11, in <module>
    sys.exit(run_exit())
  File "/usr/lib/python2.7/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/site-packages/nose/core.py", line 145, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/usr/lib/python2.7/site-packages/nose/config.py", line 325, in configure
    self.configureWhere(options.where)
  File "/usr/lib/python2.7/site-packages/nose/config.py", line 420, in configureWhere
    "not a directory" % path)
ValueError: Working directory 'test/unittests' not found, or not a directory
I think it's may be a path error, so i replace all "test" with "tests" in the "run" file
but still not work:
E
======================================================================
ERROR: Failure: TypeError (not all arguments converted during string formatting)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/share/crmsh/tests/unittests/__init__.py", line 16, in <module>
    config.path.sharedir = os.path.join(_here, "../../doc")
  File "/usr/lib/python2.7/site-packages/crmsh/config.py", line 365, in __setattr__
    _configuration.set(self.section, name, value)
  File "/usr/lib/python2.7/site-packages/crmsh/config.py", line 330, in set
    DEFAULTS[section][name].validate(value)
  File "/usr/lib/python2.7/site-packages/crmsh/config.py", line 174, in validate
    raise ValueError("Directory not found: " % (val))
TypeError: not all arguments converted during string formatting

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

my os is 12sp2 crmsh rpms is:

crmsh-3.0.0-352.1.noarch
crmsh-test-3.0.0-352.1.noarch
crmsh-scripts-3.0.0-352.1.noarch
krig commented 7 years ago

Hi,

The regression tests need to run after being installed, usually they run as part of the rpm package build if the right environment flag is set, see the spec file in network:ha-clustering:Factory.

They also run on Travis CI, you can look at .travis.yml in the source repository to see how.

liangxin1300 commented 7 years ago

Thank you!