From 6145fc6e09b8f5393cc83fae69e9d3814c56f829 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 14 Jan 2020 12:52:08 +0500 Subject: [PATCH] Install useful packages --- molecule/default/tests/test_default.py | 13 +++++++------ tasks/main.yml | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index eedd64a..7c069f0 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -1,4 +1,5 @@ import os +import pytest import testinfra.utils.ansible_runner @@ -6,9 +7,9 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' +@pytest.mark.parametrize( + 'package_name', + ['bash-completion', 'colordiff', 'curl', 'less', 'vim'], +) +def test_packages(host, package_name): + assert host.package(package_name).is_installed diff --git a/tasks/main.yml b/tasks/main.yml index ed97d53..45fa676 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1 +1,5 @@ --- +- name: Install useful packages + apt: + update_cache: true + name: ['bash-completion', 'colordiff', 'curl', 'less', 'vim']