Molecule: 3.0.2 testinfra not working on freshly initialized role

Created on 3 Mar 2020  路  5Comments  路  Source: ansible-community/molecule




Issue Type

  • Bug report

Molecule and Ansible details

docker run -v $(pwd):$(pwd) -w $(pwd) quay.io/ansible/molecule:3.0.2 molecule init role --verifier-name testinfra foobar
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):$(pwd) -w $(pwd) quay.io/ansible/molecule:3.0.2 molecule test

Molecule installation method (one of):

  • docker

Ansible installation method (one of):

  • docker

Detail any linters or test runners used:

Desired Behavior

The default tests should run without any problems

Actual Behaviour

an error is thrown

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --connection=ansible --ansible-inventory=/root/.cache/molecule/foobar/default/inventory/ansible_inventory.yml
  inifile: None
  rootdir: /home/xxx/Downloads/Projects/test/foobar/molecule/default
bug

All 5 comments

Are you actually planning to remove testinfra? Because that is atm, the main way we test stuff.

The pinned issue #2560 (Migrating to molecule v3) states:

if you use testinfra, add it as a pip dependency, it is no longer installed by default

From what I read in the doc/tickets (and believe I understood), there is absolutely no intent to remove testinfra. In an effort to lower the number of mandatory dependencies, It is just not the default verifier any more. I do use testinfa and migrated. An example result here: https://travis-ci.org/ansible-ThoTeam/nexus3-oss/jobs/655689626#L2239

Oh. IMHO that's a bad decision. I guess, for most of the molecule users testinfra is still the default.
And it is a really bad user experience, when I can initialize something with your docker image, but the run itself without custom changes just fails.

Workaround

docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):$(pwd) -w $(pwd) --user root quay.io/ansible/molecule:3.0.2 /bin/sh -c "pip3 install testinfra; molecule test -s default"

Closing because it was fixed on master, next release will include testinfra inside the container.

Was this page helpful?
0 / 5 - 0 ratings