34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import testinfra.utils.ansible_runner
|
|
|
|
def test_interface_config_file(host):
|
|
path = host.file('/etc/network/interfaces')
|
|
assert path.exists
|
|
assert path.is_file
|
|
assert path.user == 'root'
|
|
assert path.group == 'root'
|
|
assert path.mode == 0o644
|
|
assert path.contains('iface eth1 inet dhcp')
|
|
assert path.contains('iface eth0 inet static')
|
|
assert path.contains(' gateway 192.168.1.1')
|
|
assert path.contains(' post-up ip route add 10.0.0.0/24 via 192.168.1.50')
|
|
|
|
def test_hosts_config_file(host):
|
|
path = host.file('/etc/hosts')
|
|
assert path.exists
|
|
assert path.is_file
|
|
assert path.user == 'root'
|
|
assert path.group == 'root'
|
|
assert path.mode == 0o644
|
|
assert path.contains('192.168.1.10 debian')
|
|
assert path.contains('127.0.0.1 test.local')
|
|
|
|
def test_resolv_config_file(host):
|
|
path = host.file('/etc/resolv.conf')
|
|
assert path.exists
|
|
assert path.is_file
|
|
assert path.user == 'root'
|
|
assert path.group == 'root'
|
|
assert path.mode == 0o644
|
|
assert path.contains('search company.loc cie.loc')
|
|
assert path.contains('nameserver 8.8.8.8')
|
|
assert path.contains('nameserver 1.1.1.1')
|