From 591380012541163ae3c5fdd108ab646a12f7b28a Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Mon, 4 Oct 2021 10:59:49 +0900 Subject: [PATCH] Add delegate_to option to each syncronized task Signed-off-by: Hideki Saito --- .azure-pipelines/azure-pipelines.yml | 14 ++++++++++++ .../273_check_synchronize_on_devel_branch.yml | 2 +- .../targets/synchronize/tasks/main.yml | 22 +++++++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 6de1a7a..c0be539 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -51,10 +51,22 @@ stages: parameters: testFormat: devel/linux/{0}/1 targets: + - name: CentOS 6 + test: centos6 + - name: CentOS 7 + test: centos7 + - name: CentOS 8 + test: centos8 - name: Fedora 33 test: fedora33 - name: Fedora 34 test: fedora34 + - name: openSUSE 15 py2 + test: opensuse15py2 + - name: openSUSE 15 py3 + test: opensuse15 + - name: Ubuntu 18.04 + test: ubuntu1804 - name: Ubuntu 20.04 test: ubuntu2004 - stage: Docker_2_11 @@ -147,6 +159,8 @@ stages: targets: - name: MacOS 11.1 test: macos/11.1 + - name: RHEL 7.9 + test: rhel/7.9 - name: RHEL 8.4 test: rhel/8.4 - name: FreeBSD 12.2 diff --git a/changelogs/fragments/273_check_synchronize_on_devel_branch.yml b/changelogs/fragments/273_check_synchronize_on_devel_branch.yml index 4a7b932..328d455 100644 --- a/changelogs/fragments/273_check_synchronize_on_devel_branch.yml +++ b/changelogs/fragments/273_check_synchronize_on_devel_branch.yml @@ -1,3 +1,3 @@ --- trivial: -- CI tests - remove unsupported platform from devel branch tests. +- CI tests - fix integration test for synchronize to address changing behavior of devel. diff --git a/tests/integration/targets/synchronize/tasks/main.yml b/tests/integration/targets/synchronize/tasks/main.yml index 0c18fac..931f20a 100644 --- a/tests/integration/targets/synchronize/tasks/main.yml +++ b/tests/integration/targets/synchronize/tasks/main.yml @@ -2,18 +2,23 @@ package: name: rsync when: ansible_distribution != "MacOSX" -- name: cleanup old files - shell: rm -rf {{output_dir}}/* +- name: Clean up the working directory and files + file: + path: "{{ output_dir }}" + state: absent +- name: Create the working directory + file: + path: "{{ output_dir }}" + state: directory - name: create test new files copy: dest={{output_dir}}/{{item}} mode=0644 content="hello world" with_items: - foo.txt - bar.txt -- stat: - path: "{{ output_dir }}" - name: synchronize file to new filename synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.result register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - '''changed'' in sync_result' @@ -36,6 +41,7 @@ - name: test that the file is not copied a second time synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.result register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - sync_result.changed == False @@ -52,6 +58,7 @@ dest: '{{output_dir}}/foo.result' mode: push register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - '''changed'' in sync_result' @@ -77,6 +84,7 @@ dest: '{{output_dir}}/foo.result' mode: push register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - sync_result.changed == False @@ -93,6 +101,7 @@ dest: '{{output_dir}}/foo.result' mode: pull register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - '''changed'' in sync_result' @@ -118,6 +127,7 @@ dest: '{{output_dir}}/foo.result' mode: pull register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - sync_result.changed == False @@ -134,6 +144,7 @@ - foo.txt - bar.txt register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - sync_result.changed @@ -156,6 +167,7 @@ - name: synchronize files using rsync_path (issue#7182) synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.rsync_path rsync_path="sudo rsync" register: sync_result + delegate_to: "{{ inventory_hostname }}" - assert: that: - '''changed'' in sync_result' @@ -188,6 +200,7 @@ dest: '{{output_dir}}/{{item}}/foo.txt' with_items: - directory_a + delegate_to: "{{ inventory_hostname }}" - name: synchronize files using link_dest synchronize: src: '{{output_dir}}/directory_a/foo.txt' @@ -195,6 +208,7 @@ link_dest: - '{{output_dir}}/directory_a' register: sync_result + delegate_to: "{{ inventory_hostname }}" - name: get stat information for directory_a stat: path: '{{ output_dir }}/directory_a/foo.txt'