summaryrefslogtreecommitdiff
path: root/tests/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fixtures')
-rw-r--r--tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback.yaml4
-rw-r--r--tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback_plugins/test_callback.py35
-rw-r--r--tests/fixtures/config/ansible-callbacks/git/common-config/zuul.yaml21
-rw-r--r--tests/fixtures/config/ansible-callbacks/main.yaml6
-rw-r--r--tests/fixtures/zuul-executor-ansible-callback.conf48
5 files changed, 114 insertions, 0 deletions
diff --git a/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback.yaml b/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback.yaml
new file mode 100644
index 000000000..50bbbbfc5
--- /dev/null
+++ b/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback.yaml
@@ -0,0 +1,4 @@
+- hosts: localhost
+ gather_facts: smart
+ tasks:
+ - command: echo test
diff --git a/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback_plugins/test_callback.py b/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback_plugins/test_callback.py
new file mode 100644
index 000000000..39ff7cd49
--- /dev/null
+++ b/tests/fixtures/config/ansible-callbacks/git/common-config/playbooks/callback_plugins/test_callback.py
@@ -0,0 +1,35 @@
+from ansible.plugins.callback import CallbackBase
+
+import os
+
+DOCUMENTATION = '''
+ options:
+ file_name:
+ description: ""
+ ini:
+ - section: callback_test_callback
+ key: file_name
+ required: True
+ type: string
+'''
+
+
+class CallbackModule(CallbackBase):
+ CALLBACK_VERSION = 1.0
+ CALLBACK_NEEDS_WHITELIST = True
+
+ def __init__(self):
+ super(CallbackModule, self).__init__()
+
+ def set_options(self, task_keys=None, var_options=None, direct=None):
+ super(CallbackModule, self).set_options(task_keys=task_keys,
+ var_options=var_options,
+ direct=direct)
+
+ self.file_name = self.get_option('file_name')
+
+ def v2_on_any(self, *args, **kwargs):
+ path = os.path.join(os.path.dirname(__file__), self.file_name)
+ self._display.display("Touching file: {}".format(path))
+ with open(path, 'w'):
+ pass
diff --git a/tests/fixtures/config/ansible-callbacks/git/common-config/zuul.yaml b/tests/fixtures/config/ansible-callbacks/git/common-config/zuul.yaml
new file mode 100644
index 000000000..4acf6efb8
--- /dev/null
+++ b/tests/fixtures/config/ansible-callbacks/git/common-config/zuul.yaml
@@ -0,0 +1,21 @@
+- pipeline:
+ name: promote
+ manager: supercedent
+ post-review: true
+ trigger:
+ gerrit:
+ - event: change-merged
+
+- job:
+ name: callback-test
+ parent: null
+ run: playbooks/callback.yaml
+ nodeset:
+ nodes:
+ - name: ubuntu-xenial
+ label: ubuntu-xenial
+
+- project:
+ promote:
+ jobs:
+ - callback-test
diff --git a/tests/fixtures/config/ansible-callbacks/main.yaml b/tests/fixtures/config/ansible-callbacks/main.yaml
new file mode 100644
index 000000000..9d01f542f
--- /dev/null
+++ b/tests/fixtures/config/ansible-callbacks/main.yaml
@@ -0,0 +1,6 @@
+- tenant:
+ name: tenant-one
+ source:
+ gerrit:
+ config-projects:
+ - common-config
diff --git a/tests/fixtures/zuul-executor-ansible-callback.conf b/tests/fixtures/zuul-executor-ansible-callback.conf
new file mode 100644
index 000000000..cf4592f83
--- /dev/null
+++ b/tests/fixtures/zuul-executor-ansible-callback.conf
@@ -0,0 +1,48 @@
+# Checks to make sure no key is configured in the
+# [defaults] section of ansible.cfg, setting the
+# same key twice would cause an error.
+
+# Equal sign in section name will not be treated as configuration field in ansible
+[ansible_callback "nocows = True"]
+[ansible_callback "nocows = False"]
+# \n will not be treated as a newline character
+[ansible_callback "\nnocows = True"]
+[ansible_callback "\nnocows = False"]
+# A single '%' sign would cause error if interpolation syntax is enabled
+[ansible_callback "ansible_interpolation"]
+test_field = test-%%-value
+
+[ansible_callback "test_callback"]
+file_name = callback-success
+
+[gearman]
+server=127.0.0.1
+
+[statsd]
+# note, use 127.0.0.1 rather than localhost to avoid getting ipv6
+# see: https://github.com/jsocol/pystatsd/issues/61
+server=127.0.0.1
+
+[scheduler]
+tenant_config=main.yaml
+
+[merger]
+git_dir=/tmp/zuul-test/merger-git
+git_user_email=zuul@example.com
+git_user_name=zuul
+
+[executor]
+git_dir=/tmp/zuul-test/executor-git
+
+[connection gerrit]
+driver=gerrit
+server=review.example.com
+user=jenkins
+sshkey=fake_id_rsa_path
+
+[connection smtp]
+driver=smtp
+server=localhost
+port=25
+default_from=zuul@example.com
+default_to=you@example.com