Skip to content

Commit

Permalink
Merge pull request #2545 from ssbarnea/master
Browse files Browse the repository at this point in the history
Assure verify step is not skipped with testinfra

Reviewed-by: https://github.com/apps/ansible-zuul
  • Loading branch information
ansible-zuul[bot] authored Feb 11, 2020
2 parents add429c + ef22e7c commit 45c21b1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 0 additions & 4 deletions molecule/command/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ def execute(self):
:return: None
"""
self.print_info()
if not self._config.provisioner.playbooks.verify:
msg = 'Skipping, verify playbook not configured.'
LOG.warning(msg)
return
self._config.verifier.execute()


Expand Down
4 changes: 4 additions & 0 deletions molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@ def verify(self):
:return: None
"""
if not self.playbooks.verify:
LOG.warning('Skipping, verify playbook not configured.')
return

pb = self._get_ansible_playbook(self.playbooks.verify)
pb.execute()

Expand Down
9 changes: 5 additions & 4 deletions molecule/test/unit/provisioner/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,11 @@ def test_syntax(_instance, mocker, _patched_ansible_playbook):
def test_verify(_instance, mocker, _patched_ansible_playbook):
_instance.verify()

_patched_ansible_playbook.assert_called_once_with(
_instance._config.provisioner.playbooks.verify, _instance._config
)
_patched_ansible_playbook.return_value.execute.assert_called_once_with()
if _instance._config.provisioner.playbooks.verify:
_patched_ansible_playbook.assert_called_once_with(
_instance._config.provisioner.playbooks.verify, _instance._config
)
_patched_ansible_playbook.return_value.execute.assert_called_once_with()


def test_write_config(temp_dir, _instance):
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ test =
pytest-xdist>=1.29.0, < 2
pytest>=4.6.3, < 5
shade>=1.31.0, < 2
testinfra >= 3.4.0
lint =
ansible-lint >= 4.1.1a2, < 5
flake8 >= 3.6.0
Expand Down

0 comments on commit 45c21b1

Please sign in to comment.