Skip to content

Commit

Permalink
Pull in arista-ansible-role-test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
grybak-arista committed Jul 15, 2016
2 parents da7c890 + 0a8c968 commit 1223fe1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/arista-ansible-role-test/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,22 @@ def __call__(self):
format(desc, hostname)
)
assert device[hostname]['changed'] == True, msg

# Compare changes with expected values, sorted at global level
updates = '\n'.join(device[hostname]['updates'])
updates = re.split(r'\n(?=\S)', updates)
updates = '\n'.join(sorted(updates))
# The output from the playbook is sanitized - the phrase
# network-admin in username entries is changed to
# network-********. Replace the asterisks with admin again
# for matching the results.
updates = re.sub("username ([^\n]*) role network-\*{8}",
r'username \1 role network-admin',
updates)

absent = re.split(r'\n(?=\S)', self.testcase.absent.rstrip())
absent = '\n'.join(sorted(absent))

msg = ("{} - Some part of absent configuration found "
"on device '{}'".format(desc, hostname))
assert updates == absent, msg
Expand Down

0 comments on commit 1223fe1

Please sign in to comment.