Skip to content

Commit 1e5b779

Browse files
author
Anton Ustyuzhanin
committed
Add Testinfra tests
1 parent a5865f8 commit 1e5b779

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

molecule/default/molecule.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ scenario:
4242
name: default
4343
verifier:
4444
name: testinfra
45+
options:
46+
v: true
4547
lint:
4648
name: flake8

molecule/default/tests/test_default.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,36 @@ def test_hosts_file(host):
1212
assert f.exists
1313
assert f.user == 'root'
1414
assert f.group == 'root'
15+
16+
17+
def test_sssd_ldap_user(host):
18+
user = host.user('test')
19+
assert user.uid == 5000
20+
assert user.gid == 1
21+
22+
23+
def test_sssd_service_state(host):
24+
assert host.service('sssd').is_enabled
25+
assert host.service('sssd').is_running
26+
27+
28+
def test_sshd_service_state(host):
29+
assert host.service('sshd').is_enabled
30+
assert host.service('sshd').is_running
31+
32+
33+
def test_ssh_access(host):
34+
host.run_test(
35+
'/usr/bin/ssh '
36+
'-o StrictHostKeyChecking=no '
37+
'-o BatchMode=yes '
38+
'-T '
39+
'-i /root/.ssh/id_rsa '
40+
'-l test '
41+
'localhost '
42+
'exit'
43+
)
44+
45+
46+
def test_homedir_created(host):
47+
assert host.file('/home/test').is_directory

0 commit comments

Comments
 (0)