summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/gitlab_hooks
diff options
context:
space:
mode:
authorAndrea Tartaglia <andrea@braingap.uk>2019-01-31 11:20:33 +0100
committerJohn R Barker <john@johnrbarker.com>2019-01-31 11:20:33 +0100
commit042aeba46cec6253c11a43940de62795de3cb3e7 (patch)
treea76600023de430e1e4edf76e3901fae1c661fa6d /test/integration/targets/gitlab_hooks
parentwin_stat - add follow option and fix broken tests (#51522) (diff)
downloadansible-042aeba46cec6253c11a43940de62795de3cb3e7.tar.xz
ansible-042aeba46cec6253c11a43940de62795de3cb3e7.zip
Base integration test for gitlab modules (#51490)
* Added basic integration test targets for gitlab modules * Removed cloud/gitlab config from aliases, it doesn't exist yet * Fixed CI issues
Diffstat (limited to 'test/integration/targets/gitlab_hooks')
-rw-r--r--test/integration/targets/gitlab_hooks/aliases3
-rw-r--r--test/integration/targets/gitlab_hooks/defaults/main.yml2
-rw-r--r--test/integration/targets/gitlab_hooks/tasks/main.yml67
3 files changed, 72 insertions, 0 deletions
diff --git a/test/integration/targets/gitlab_hooks/aliases b/test/integration/targets/gitlab_hooks/aliases
new file mode 100644
index 0000000000..ef7ed2e3b5
--- /dev/null
+++ b/test/integration/targets/gitlab_hooks/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group1
+gitlab/ci
+disabled
diff --git a/test/integration/targets/gitlab_hooks/defaults/main.yml b/test/integration/targets/gitlab_hooks/defaults/main.yml
new file mode 100644
index 0000000000..eda34a26e6
--- /dev/null
+++ b/test/integration/targets/gitlab_hooks/defaults/main.yml
@@ -0,0 +1,2 @@
+gitlab_project_name: ansible_test_project
+gitlab_hook_url: http://gitlab.example.com/hook
diff --git a/test/integration/targets/gitlab_hooks/tasks/main.yml b/test/integration/targets/gitlab_hooks/tasks/main.yml
new file mode 100644
index 0000000000..3c429a826c
--- /dev/null
+++ b/test/integration/targets/gitlab_hooks/tasks/main.yml
@@ -0,0 +1,67 @@
+- name: Install required libs
+ pip:
+ name: python-gitlab
+ state: present
+
+- name: Create {{ gitlab_project_name }}
+ gitlab_project:
+ server_url: "{{ gitlab_host }}"
+ validate_certs: False
+ login_token: "{{ gitlab_login_token }}"
+ name: "{{ gitlab_project_name }}"
+ state: present
+
+- name: Cleanup Gitlab hook
+ gitlab_hooks:
+ server_url: "{{ gitlab_host }}"
+ validate_certs: false
+ login_token: "{{ gitlab_login_token }}"
+ hook_url: "{{ gitlab_hook_url }}"
+ project: "{{ gitlab_project_name }}"
+ state: absent
+
+- name: Create Gitlab Hook
+ gitlab_hooks:
+ server_url: "{{ gitlab_host }}"
+ validate_certs: false
+ login_token: "{{ gitlab_login_token }}"
+ hook_url: "{{ gitlab_hook_url }}"
+ project: "{{ gitlab_project_name }}"
+ state: present
+ register: gitlab_hook_state
+
+- name: Test group created
+ assert:
+ that:
+ - gitlab_hook_state is changed
+
+
+- name: Create Gitlab Hook ( Idempotency test )
+ gitlab_hooks:
+ server_url: "{{ gitlab_host }}"
+ validate_certs: false
+ login_token: "{{ gitlab_login_token }}"
+ hook_url: "{{ gitlab_hook_url }}"
+ project: "{{ gitlab_project_name }}"
+ state: present
+ register: gitlab_hook_state_again
+
+- name: Test module is idempotent
+ assert:
+ that:
+ - gitlab_hook_state_again is not changed
+
+- name: Remove Gitlab hook
+ gitlab_hooks:
+ server_url: "{{ gitlab_host }}"
+ validate_certs: false
+ login_token: "{{ gitlab_login_token }}"
+ hook_url: "{{ gitlab_hook_url }}"
+ project: "{{ gitlab_project_name }}"
+ state: absent
+ register: gitlab_hook_state_absent
+
+- name: Assert hook has been removed
+ assert:
+ that:
+ - gitlab_hook_state_absent is changed