Add remote tests for synchronize
Increase our testing of the synchronize ansible module. Change-Id: If7786d4bb7e3dad59255eb941a9bc0d41601f4cd Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
40a895b03c
commit
6814c36abb
12
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-bad-pull.yaml
vendored
Normal file
12
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-bad-pull.yaml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Execute common-copy role
|
||||
include_role:
|
||||
name: common-copy
|
||||
|
||||
- name: Test pull mode
|
||||
synchronize:
|
||||
dest: "/tmp"
|
||||
mode: pull
|
||||
src: "{{ destdir.path }}/"
|
||||
verify_host: true
|
12
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-bad-push.yaml
vendored
Normal file
12
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-bad-push.yaml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Execute common-copy role
|
||||
include_role:
|
||||
name: common-copy
|
||||
|
||||
- name: Test push mode
|
||||
synchronize:
|
||||
dest: "{{ destdir.path }}/"
|
||||
mode: push
|
||||
src: "/tmp"
|
||||
verify_host: true
|
53
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-good.yaml
vendored
Normal file
53
tests/fixtures/config/remote-action-modules/git/org_project/playbooks/synchronize-good.yaml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Execute common-copy role
|
||||
include_role:
|
||||
name: common-copy
|
||||
|
||||
- name: Ensure executor push directory
|
||||
file:
|
||||
path: "{{ zuul.executor.log_root }}/push"
|
||||
state: directory
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Test pull mode
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}/push"
|
||||
mode: pull
|
||||
src: "{{ destdir.path }}/"
|
||||
verify_host: true
|
||||
|
||||
- name: Validate push
|
||||
stat:
|
||||
path: "{{ zuul.executor.log_root }}/push/common-file"
|
||||
register: _push
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Assert push
|
||||
assert:
|
||||
that:
|
||||
- _push.stat.exists
|
||||
- _push.stat.isreg
|
||||
|
||||
- name: Ensure controller pull directory
|
||||
file:
|
||||
path: "{{ destdir.path }}/pull"
|
||||
state: directory
|
||||
|
||||
- name: Test push mode
|
||||
synchronize:
|
||||
dest: "{{ destdir.path }}/pull/"
|
||||
mode: push
|
||||
src: "{{ zuul.executor.log_root }}/push"
|
||||
verify_host: true
|
||||
|
||||
- name: Validate pull
|
||||
stat:
|
||||
path: "{{ destdir.path }}/pull/push/common-file"
|
||||
register: _pull
|
||||
|
||||
- name: Assert pull
|
||||
assert:
|
||||
that:
|
||||
- _pull.stat.exists
|
||||
- _pull.stat.isreg
|
|
@ -18,6 +18,8 @@ import textwrap
|
|||
from tests.base import AnsibleZuulTestCase, FIXTURE_DIR
|
||||
|
||||
ERROR_ACCESS_OUTSIDE = "Accessing files from outside the working dir"
|
||||
ERROR_SYNC_TO_OUTSIDE = "Syncing files to outside the working dir"
|
||||
ERROR_SYNC_FROM_OUTSIDE = "Syncing files from outside the working dir"
|
||||
|
||||
|
||||
class TestActionModules(AnsibleZuulTestCase):
|
||||
|
@ -154,6 +156,12 @@ class TestActionModules(AnsibleZuulTestCase):
|
|||
def test_shell_module(self):
|
||||
self._run_job('shell-good', 'SUCCESS')
|
||||
|
||||
def test_synchronize_module(self):
|
||||
self._run_job('synchronize-good', 'SUCCESS')
|
||||
self._run_job('synchronize-bad-pull', 'FAILURE', ERROR_SYNC_TO_OUTSIDE)
|
||||
self._run_job(
|
||||
'synchronize-bad-push', 'FAILURE', ERROR_SYNC_FROM_OUTSIDE)
|
||||
|
||||
def test_template_module(self):
|
||||
self._run_job('template-good', 'SUCCESS')
|
||||
|
||||
|
|
Loading…
Reference in New Issue