Improve molecule testing of collect arguments
Adds test to ensure artcl_collect_list(_append) and artcl_exclude_list(_append) collect and exclude files as expected. Change-Id: I1a6ff1f876bf2b355b8791959b945ae7c9fffeb9
This commit is contained in:
parent
bdce81b673
commit
c0c53b1634
|
@ -54,8 +54,15 @@
|
|||
|
||||
- name: "Create an empty dummy file"
|
||||
file:
|
||||
path: "/tmp/dummy.log"
|
||||
path: "{{ item }}"
|
||||
state: touch
|
||||
with_items:
|
||||
- "/tmp/dummy.log"
|
||||
- "/tmp/append.log"
|
||||
- "/tmp/exclude.log"
|
||||
- "/tmp/exclude_append.log"
|
||||
- "/tmp/config.conf"
|
||||
- "/tmp/just_file"
|
||||
changed_when: false
|
||||
|
||||
- name: "Create a dummy file of 1MB"
|
||||
|
@ -70,7 +77,10 @@
|
|||
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
||||
source {{ infrared_venv }}/bin/activate
|
||||
ir ansible-role-collect-logs --collect_log_types "testing" \
|
||||
--artcl_collect_list /tmp/dummy.log,/tmp/1MB_dummy.log \
|
||||
--artcl_collect_list /tmp/*.log,/tmp/just_file \
|
||||
--artcl_collect_list_append /tmp/config.conf \
|
||||
--artcl_exclude_list /tmp/exclude.log \
|
||||
--artcl_exclude_list_append /tmp/exclude_append.log \
|
||||
--artcl_gzip true \
|
||||
--local_working_dir "{{ infrared_location }}" \
|
||||
--disable_artifacts_cleanup true
|
||||
|
|
|
@ -29,9 +29,25 @@
|
|||
loop:
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/dummy.log.gz"
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/1MB_dummy.log.gz"
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/just_file.gz"
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/config.conf.gz"
|
||||
|
||||
- name: Ensure all files were collected
|
||||
assert:
|
||||
that:
|
||||
- item.stat.exists
|
||||
loop: "{{ collected_files_stats.results }}"
|
||||
|
||||
- name: Get the stats of excluded files
|
||||
stat:
|
||||
path: "{{ item }}"
|
||||
register: excluded_files_stats
|
||||
loop:
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/exclude.log.gz"
|
||||
- "{{ infrared_location }}/collected_files/localhost/tmp/exclude_append.log.gz"
|
||||
|
||||
- name: Ensure excluded files were not collected
|
||||
assert:
|
||||
that:
|
||||
- not item.stat.exists
|
||||
loop: "{{ excluded_files_stats.results }}"
|
||||
|
|
Loading…
Reference in New Issue