Merge "Add new tests to molecule/infrared"
This commit is contained in:
commit
fe1ed41095
|
@ -77,11 +77,13 @@
|
|||
export PATH=$PATH:/usr/local/sbin:/usr/sbin
|
||||
source {{ infrared_venv }}/bin/activate
|
||||
ir ansible-role-collect-logs --collect_log_types "testing" \
|
||||
--artcl_collect_dir {{ infrared_location }}/collected_files_test \
|
||||
--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 \
|
||||
--artcl_rsync_collect_list false \
|
||||
--local_working_dir "{{ infrared_location }}" \
|
||||
--disable_artifacts_cleanup true
|
||||
args:
|
||||
|
|
|
@ -22,15 +22,26 @@
|
|||
msg: "ansible-role-collect-logs not installed"
|
||||
when: "'ansible-role-collect-logs' not in plugin_output.stdout"
|
||||
|
||||
- name: Get directory with collected log files
|
||||
stat:
|
||||
path: "{{ infrared_location}}/collected_files_test"
|
||||
register:
|
||||
collected_files_dir
|
||||
|
||||
- name: Ensure directory with collected log files is created
|
||||
assert:
|
||||
that:
|
||||
- collected_files_dir.stat.exists
|
||||
|
||||
- name: Get the stats of collected files
|
||||
stat:
|
||||
path: "{{ item }}"
|
||||
register: collected_files_stats
|
||||
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"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/dummy.log.gz"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/1MB_dummy.log.gz"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/just_file.gz"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/config.conf.gz"
|
||||
|
||||
- name: Ensure all files were collected
|
||||
assert:
|
||||
|
@ -43,11 +54,31 @@
|
|||
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"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/exclude.log.gz"
|
||||
- "{{ infrared_location }}/collected_files_test/localhost/tmp/exclude_append.log.gz"
|
||||
|
||||
- name: Ensure excluded files were not collected
|
||||
assert:
|
||||
that:
|
||||
- not item.stat.exists
|
||||
loop: "{{ excluded_files_stats.results }}"
|
||||
|
||||
- name: Get tar files with logs
|
||||
find: paths={{ infrared_location }}/collected_files_test/ patterns='*.tar'
|
||||
register: tar_files
|
||||
|
||||
- name: Ensure .tar files with logs are deleted
|
||||
assert:
|
||||
that:
|
||||
- tar_files.matched == 0
|
||||
|
||||
- name: Get file generated by find
|
||||
stat:
|
||||
path: /tmp/localhost-rsync-list
|
||||
register:
|
||||
rsync_list
|
||||
|
||||
- name: Ensure that find is used to generate list of files for rsync
|
||||
assert:
|
||||
that:
|
||||
- rsync_list.stat.exists
|
||||
|
|
Loading…
Reference in New Issue