removed python tests
All checks were successful
test / Linting (push) Successful in 9s
test / Molecule tests (default, debian12) (push) Successful in 1m3s
test / Molecule tests (default, debian11) (push) Successful in 1m5s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m4s
test / Molecule tests (default, ubuntu2204) (push) Successful in 53s
test / Molecule tests (with_custom_packages, debian11) (push) Successful in 54s
test / Molecule tests (with_custom_packages, debian12) (push) Successful in 56s
test / Molecule tests (with_custom_packages, ubuntu2004) (push) Successful in 1m2s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Successful in 1m1s

This commit is contained in:
Bertrand Lanson 2023-07-11 21:59:59 +02:00
parent 7d48edb83c
commit 6e1e96ee93
4 changed files with 0 additions and 111 deletions

View File

@ -1,22 +0,0 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)

View File

@ -1,30 +0,0 @@
"""Role testing files using testinfra."""
def test_hosts_file(host):
"""Validate /etc/hosts file."""
etc_hosts = host.file("/etc/hosts")
assert etc_hosts.exists
assert etc_hosts.user == "root"
assert etc_hosts.group == "root"
def test_python_pip_packages_installed(host):
"""Validate python3 and pip are installed"""
apt_package_python3 = host.package("python3")
apt_package_pip = host.package("python3-pip")
assert apt_package_python3.is_installed
assert apt_package_pip.is_installed
def test_pip_installed_latest(host):
"""Validate pip is installed and up-to-date"""
pip_packages_list = host.pip.get_packages(pip_path='pip')
pip_outdated_list = host.pip.get_outdated_packages(pip_path='pip')
assert 'pip' in pip_packages_list
assert 'pip' not in pip_outdated_list
def test_packages_not_installed(host):
"""Validate docker, yamllint and vault-cli are not installed"""
pip_packages_list = host.pip.get_packages(pip_path='pip')
assert 'docker' not in pip_packages_list
assert 'yamllint' not in pip_packages_list
assert 'vault-cli' not in pip_packages_list

View File

@ -1,22 +0,0 @@
"""PyTest Fixtures."""
from __future__ import absolute_import
import os
import pytest
def pytest_runtest_setup(item):
"""Run tests only when under molecule with testinfra installed."""
try:
import testinfra
except ImportError:
pytest.skip("Test requires testinfra", allow_module_level=True)
if "MOLECULE_INVENTORY_FILE" in os.environ:
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
else:
pytest.skip(
"Test should run only from inside molecule.", allow_module_level=True
)

View File

@ -1,37 +0,0 @@
"""Role testing files using testinfra."""
from packaging import version
def test_hosts_file(host):
"""Validate /etc/hosts file."""
etc_hosts = host.file("/etc/hosts")
assert etc_hosts.exists
assert etc_hosts.user == "root"
assert etc_hosts.group == "root"
def test_python_pip_packages_installed(host):
"""Validate python3 and pip are installed"""
apt_package_python3 = host.package("python3")
apt_package_pip = host.package("python3-pip")
assert apt_package_python3.is_installed
assert apt_package_pip.is_installed
def test_pip_installed_latest(host):
"""Validate pip is installed and up-to-date"""
pip_packages_list = host.pip.get_packages(pip_path='pip')
pip_outdated_list = host.pip.get_outdated_packages(pip_path='pip')
assert 'pip' in pip_packages_list
assert 'pip' not in pip_outdated_list
def test_packages_installed(host):
"""Validate docker, yamllint and vault-cli are installed"""
pip_packages_list = host.pip.get_packages(pip_path='pip')
pip_outdated_list = host.pip.get_outdated_packages(pip_path='pip')
assert 'docker' in pip_packages_list
assert 'docker' not in pip_outdated_list
assert 'yamllint' in pip_packages_list
assert 'yamllint' in pip_outdated_list
assert version.parse(pip_packages_list['yamllint']['version']) == version.parse("1.24")
assert 'vault-cli' in pip_packages_list
assert 'vault-cli' in pip_outdated_list
assert version.parse(pip_packages_list['vault-cli']['version']) < version.parse("3.1.0")