tripleo-ansible/tripleo_ansible/roles/tripleo_transfer/molecule/default/verify.yml

48 lines
1.6 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Verify
hosts: localhost
connection: local
any_errors_fatal: true
tasks:
- name: Collect file system data
find:
paths:
- "{{ test_src_dir }}"
- "{{ test_dst_dir }}"
get_checksum: true
recurse: true
register: _fs_data
- name: Verify that the src files copied to the dst
assert:
that:
- _fs_data | json_query(srcfilequery) == _fs_data | json_query(dstfilequery)
vars:
srcfilequery: files[?path =='{{ test_src_dir }}/{{ item }}'].checksum
dstfilequery: files[?path =='{{ test_dst_dir }}/{{ item }}'].checksum
loop: "{{ test_src_files }}"
- set_fact:
result_file_list: "{{ _fs_data | json_query('files[*].path') }}"
test_dst_files: "{{ test_dst_files | map('regex_replace', '(.*)', test_dst_dir ~ '/\\1') }}"
- name: Verify that the dst file are not there any more
assert:
that:
- test_dst_files is not subset(result_file_list)