diff --git a/molecule/infrared/converge.yml b/molecule/infrared/converge.yml index 5d7a6f0..c8685d7 100644 --- a/molecule/infrared/converge.yml +++ b/molecule/infrared/converge.yml @@ -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: diff --git a/molecule/infrared/verify.yml b/molecule/infrared/verify.yml index 29ff36e..2a82f66 100644 --- a/molecule/infrared/verify.yml +++ b/molecule/infrared/verify.yml @@ -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