From 70b843ba43438f89d8770631eaecd9781f12dc53 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Sun, 13 Mar 2022 01:45:04 +0900 Subject: [PATCH] TEST --- .../targets/synchronize/tasks/main.yml | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/integration/targets/synchronize/tasks/main.yml b/tests/integration/targets/synchronize/tasks/main.yml index 94a7080..a140387 100644 --- a/tests/integration/targets/synchronize/tasks/main.yml +++ b/tests/integration/targets/synchronize/tasks/main.yml @@ -30,12 +30,24 @@ with_items: - foo.txt - bar.txt - - name: copy file to new filename - copy: + - name: synchronize file to new filename + synchronize: src: "{{ output_dir }}/foo.txt" dest: "{{ output_dir }}/foo.result" - when: - - ansible_facts.virtualization_type != 'docker' + register: sync_result + - assert: + that: + - '''changed'' in sync_result' + - sync_result.changed == true + - '''cmd'' in sync_result' + - '''rsync'' in sync_result.cmd' + - '''msg'' in sync_result' + - sync_result.msg.startswith('>f+') + - 'sync_result.msg.endswith(''+ foo.txt + + '')' + when: + - ansible_facts.virtualization_type != 'docker' - block: - name: test that the file was really copied over @@ -45,13 +57,23 @@ - foo.txt - bar.txt delegate_to: "{{ inventory_hostname }}" - delegate_facts: true - - name: copy file to new filename - copy: + - name: synchronize file to new filename + synchronize: src: "{{ output_dir }}/foo.txt" dest: "{{ output_dir }}/foo.result" + register: sync_result delegate_to: "{{ inventory_hostname }}" - delegate_facts: true + - assert: + that: + - '''changed'' in sync_result' + - sync_result.changed == true + - '''cmd'' in sync_result' + - '''rsync'' in sync_result.cmd' + - '''msg'' in sync_result' + - sync_result.msg.startswith('>f+') + - 'sync_result.msg.endswith(''+ foo.txt + + '')' when: - ansible_facts.virtualization_type == 'docker'