Created
February 11, 2020 12:11
-
-
Save vittorio-nardone/433d4aceab727dc387f84e7cdd3e7eb4 to your computer and use it in GitHub Desktop.
Molecule test for service Apache2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pytest | |
import testinfra.utils.ansible_runner | |
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | |
os.environ['MOLECULE_INVENTORY_FILE'] | |
).get_hosts('all') | |
@pytest.mark.parametrize('pkg', [ | |
'apache2' | |
]) | |
def test_pkg(host, pkg): | |
package = host.package(pkg) | |
assert package.is_installed | |
@pytest.mark.parametrize('svc', [ | |
'apache2' | |
]) | |
def test_svc(host, svc): | |
service = host.service(svc) | |
assert service.is_running | |
assert service.is_enabled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment