Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while executing molecule verify: RuntimeError: One or more hosts is required with the docker backend #398

Closed
dj-wasabi opened this issue Aug 23, 2016 · 3 comments

Comments

@dj-wasabi
Copy link
Contributor

When doing an molecule verify with TestInfra:

 (molecule_test) $ molecule verify
WARNING:vagrant:The Vagrant executable cannot be found. Please check if it is in the system path.
--> Executing testinfra tests found in tests/.
============================= test session starts ==============================
platform linux2 -- Python 2.7.5, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
rootdir: /git/ansible/ansible-zabbix-proxy, inifile:
plugins: cov-2.3.1, xdist-1.14, testinfra-1.4.1
collected 0 items / 1 errorss

==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_default.py ____________________
/usr/lib/python2.7/site-packages/testinfra/plugin.py:124: in pytest_generate_tests
    ansible_inventory=metafunc.config.option.ansible_inventory,
/usr/lib/python2.7/site-packages/testinfra/__init__.py:35: in get_backends
    _BACKENDS_CACHE[key] = backend.get_backends(hosts, **kwargs)
/usr/lib/python2.7/site-packages/testinfra/backend/__init__.py:87: in get_backends
    for name in klass.get_hosts(host, **kw):
/usr/lib/python2.7/site-packages/testinfra/backend/base.py:126: in get_hosts
    cls.get_connection_type(),),
E   RuntimeError: One or more hosts is required with the docker backend
============================ pytest-warning summary ============================
WP1 None Modules are already imported so can not be re-written: testinfra
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
================== 1 pytest-warnings, 1 error in 0.27 seconds ==================
ERROR: 

  RAN: '/usr/bin/testinfra tests/test_default.py --connection=docker'

  STDOUT:


  STDERR:

Molecule: 1.9.0
Ansible: 2.1.1.0
TestInfra: 1.4.1

Running testinfra manually does work.

@retr0h
Copy link
Contributor

retr0h commented Aug 23, 2016

For those which run molecule init under 1.9 the test files will be created properly. Unfortunately, your tests were created with an older version of testinfra. I didn't think of the repercussions appropriately with this change.

Updating your tests with this, will fix your problem.

@retr0h
Copy link
Contributor

retr0h commented Aug 24, 2016

Closing since this is resolved.

@retr0h retr0h closed this as completed Aug 24, 2016
@mrmuli
Copy link

mrmuli commented Jul 17, 2017

now here
also don't forget to update your MOLECULE_INVENTORY_FILE env var

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants