Skip to content

Commit fd978f3

Browse files
Better verifier
1 parent f298ad6 commit fd978f3

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

molecule/default/molecule.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ provisioner:
114114
Ubuntu20:
115115
ansible_python_interpreter: /usr/bin/python3
116116
verifier:
117-
name: ansible
117+
name: testinfra
118+
directory: tests
118119
dependency:
119120
name: galaxy
120121
options:
@@ -131,6 +132,6 @@ scenario:
131132
- create
132133
# - prepare
133134
- converge
134-
# - idempotence
135+
- idempotence
135136
- cleanup
136137
- destroy
Binary file not shown.

molecule/default/tests/test_default.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99

1010
def test_hosts_file(host):
11-
f = host.file('/etc/hosts')
11+
f = host.file('/opt/actions-runner')
1212

13-
assert f.exists
14-
assert f.user == 'root'
15-
assert f.group == 'root'
13+
assert f.exists

molecule/organization/molecule.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ provisioner:
114114
Ubuntu20:
115115
ansible_python_interpreter: /usr/bin/python3
116116
verifier:
117-
name: ansible
117+
name: testinfra
118+
directory: tests
118119
dependency:
119120
name: galaxy
120121
options:
@@ -131,6 +132,6 @@ scenario:
131132
- create
132133
# - prepare
133134
- converge
134-
# - idempotence
135+
- idempotence
135136
- cleanup
136137
- destroy
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import os
2+
3+
import testinfra.utils.ansible_runner
4+
5+
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
6+
os.environ['MOLECULE_INVENTORY_FILE']
7+
).get_hosts('all')
8+
9+
10+
def test_hosts_file(host):
11+
f = host.file('/opt/actions-runner')
12+
13+
assert f.exists

0 commit comments

Comments
 (0)