forked from networktocode/ntc-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ntc_parse.yml
22 lines (20 loc) · 1.01 KB
/
test_ntc_parse.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
- name: Test ntc_parse plugin
hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Find all test .raw files
find:
paths: ./ntc-templates/tests
pattern: "*.raw"
recurse: yes
register: raw_files
- assert:
that: "{{(lookup('file', item['path']))|ntc_parse(item['path'].split('/')[-2]|replace('_', ' '),
item['path'].split('/')[-3],
'./ntc-templates/templates')}} == (
{{lookup('file', item['path']|replace('.raw', '.parsed'))|from_yaml}}['parsed_sample'])"
msg: "EXPECTED: {{lookup('file', item['path']|replace('.raw', '.parsed'))|from_yaml}}['parsed_sample']
DESIRED: {{(lookup('file', item['path']))|ntc_parse(item['path'].split('/')[-2]|replace('_', ' '), item['path'].split('/')[-3], './ntc-templates/templates')}}"
with_items: "{{raw_files['files']}}"