-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On some platforms the parameters are stored in a `dict`, and the ordering of the elements is not guaranteed to be stable. So when comparing the expected results to the actual file, sort both. Signed-off-by: Rich Megginson <[email protected]>
- Loading branch information
Showing
2 changed files
with
59 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
# input | ||
# * expected_content - the expected contents | ||
# * compare_file - the actual contents | ||
# NOTE: Have to sort because order of dict is not guaranteed to | ||
# be stable on all supported platforms | ||
- name: Get file to compare | ||
slurp: | ||
path: "{{ compare_file }}" | ||
register: __actual_content | ||
|
||
- name: Compare expected to actual | ||
assert: | ||
that: __expected == __actual | ||
vars: | ||
__expected: "{{ expected_content.split('\n') | sort | select | list }}" | ||
__actual: "{{ (__actual_content.content | b64decode).split('\n') | sort | select | list }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters