Skip to content

Commit

Permalink
Have remote tests scan all facts.
Browse files Browse the repository at this point in the history
Also, fixes problem of key errors if expected fact not present in scan,
will fail more gracefully with informative error message now.

Closes #40
  • Loading branch information
kdelee committed Sep 27, 2017
1 parent a28352b commit 34c3dc0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions camayoc/tests/remote/rho/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_scan(isolated_filesystem, profile):

reportfile = '{}-report.csv'.format(profile['name'])
rho_scan = pexpect.spawn(
'rho scan --profile {} --reportfile {}'
'rho scan --profile {} --reportfile {} --facts all'
.format(profile['name'], reportfile),
timeout=300,
)
Expand All @@ -96,19 +96,19 @@ def test_scan(isolated_filesystem, profile):
known_facts = {}
for host in cfg['rho']['hosts']:
# find the facts for the scanned host we are inspecting
if host['ip'] == row['connection.host']:
if host['ip'] == row.get('connection.host'):
known_facts = host['facts']
break
for fact in known_facts.keys():
try:
assert (str(known_facts[fact]) in str(row[fact]))
assert (str(known_facts[fact]) in str(row.get(fact)))
except AssertionError:
msg = 'Test failed on host {} in profile {}. \
Scan found {} = {} instead of {}.'.format(
host['ip'],
profile['name'],
fact,
row[fact],
row.get(fact),
known_facts[fact],
)
scan_errors.append(msg)
Expand Down

0 comments on commit 34c3dc0

Please sign in to comment.