20 lines
566 B
Python
20 lines
566 B
Python
import os, re
|
|
import testinfra.utils.ansible_runner
|
|
|
|
def test_packages(host):
|
|
package = host.package('logrotate')
|
|
assert package.is_installed
|
|
|
|
def test_config_file(host):
|
|
config = host.file('/etc/logrotate.d/ansible')
|
|
assert config.exists
|
|
assert config.is_file
|
|
assert config.user == 'root'
|
|
assert config.group == 'root'
|
|
assert config.mode == 0o644
|
|
assert not config.contains('weekly')
|
|
assert config.contains('echo test')
|
|
assert config.contains('rotate 2')
|
|
|
|
def test_logrotate(host):
|
|
host.check_output('logrotate -f /etc/logrotate.d/ansible')
|