summaryrefslogtreecommitdiff
path: root/test/integration/targets/gcp_pubsub_topic
diff options
context:
space:
mode:
authorAlex Stephen <alexstephen@google.com>2018-05-04 11:32:28 -0700
committerRyan Brown <sb@ryansb.com>2018-05-04 14:32:28 -0400
commite177cf5831152cd2b44d2eb610ad47847ba46d7a (patch)
tree6d4153ae6fdf9925e41537644c33617ee117f6ad /test/integration/targets/gcp_pubsub_topic
parente116c6cee8ff1ac81e94bb1d8d2ed950e3bc7707 (diff)
downloadansible-e177cf5831152cd2b44d2eb610ad47847ba46d7a.tar.gz
New module: GCP Pubsub Topics (#38627)
Diffstat (limited to 'test/integration/targets/gcp_pubsub_topic')
-rw-r--r--test/integration/targets/gcp_pubsub_topic/aliases2
-rw-r--r--test/integration/targets/gcp_pubsub_topic/defaults/main.yml3
-rw-r--r--test/integration/targets/gcp_pubsub_topic/meta/main.yml0
-rw-r--r--test/integration/targets/gcp_pubsub_topic/tasks/main.yml102
4 files changed, 107 insertions, 0 deletions
diff --git a/test/integration/targets/gcp_pubsub_topic/aliases b/test/integration/targets/gcp_pubsub_topic/aliases
new file mode 100644
index 0000000000..9812f019ca
--- /dev/null
+++ b/test/integration/targets/gcp_pubsub_topic/aliases
@@ -0,0 +1,2 @@
+cloud/gcp
+unsupported
diff --git a/test/integration/targets/gcp_pubsub_topic/defaults/main.yml b/test/integration/targets/gcp_pubsub_topic/defaults/main.yml
new file mode 100644
index 0000000000..aa87a2a8e0
--- /dev/null
+++ b/test/integration/targets/gcp_pubsub_topic/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+# defaults file
+resource_name: '{{resource_prefix}}'
diff --git a/test/integration/targets/gcp_pubsub_topic/meta/main.yml b/test/integration/targets/gcp_pubsub_topic/meta/main.yml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/integration/targets/gcp_pubsub_topic/meta/main.yml
diff --git a/test/integration/targets/gcp_pubsub_topic/tasks/main.yml b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml
new file mode 100644
index 0000000000..95fd931d77
--- /dev/null
+++ b/test/integration/targets/gcp_pubsub_topic/tasks/main.yml
@@ -0,0 +1,102 @@
+---
+# ----------------------------------------------------------------------------
+#
+# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
+#
+# ----------------------------------------------------------------------------
+#
+# This file is automatically generated by Magic Modules and manual
+# changes will be clobbered when the file is regenerated.
+#
+# Please read more about how to change this file at
+# https://www.github.com/GoogleCloudPlatform/magic-modules
+#
+# ----------------------------------------------------------------------------
+# Pre-test setup
+- name: delete a topic
+ gcp_pubsub_topic:
+ name: 'test-topic1'
+ project: "{{ gcp_project }}"
+ auth_kind: "{{ gcp_cred_kind }}"
+ service_account_file: "{{ gcp_cred_file }}"
+ scopes:
+ - https://www.googleapis.com/auth/pubsub
+ state: absent
+#----------------------------------------------------------
+- name: create a topic
+ gcp_pubsub_topic:
+ name: 'test-topic1'
+ project: "{{ gcp_project }}"
+ auth_kind: "{{ gcp_cred_kind }}"
+ service_account_file: "{{ gcp_cred_file }}"
+ scopes:
+ - https://www.googleapis.com/auth/pubsub
+ state: present
+ register: result
+- name: assert changed is true
+ assert:
+ that:
+ - result.changed == true
+- name: verify that topic was created
+ shell: |
+ gcloud beta pubsub topics list --project="{{ gcp_project}}"| grep 'topic: projects/.*/test-topic1'
+ register: results
+- name: verify that command succeeded
+ assert:
+ that:
+ - results.rc == 0
+# ----------------------------------------------------------------------------
+- name: create a topic that already exists
+ gcp_pubsub_topic:
+ name: 'test-topic1'
+ project: "{{ gcp_project }}"
+ auth_kind: "{{ gcp_cred_kind }}"
+ service_account_file: "{{ gcp_cred_file }}"
+ scopes:
+ - https://www.googleapis.com/auth/pubsub
+ state: present
+ register: result
+- name: assert changed is false
+ assert:
+ that:
+ - result.changed == false
+#----------------------------------------------------------
+- name: delete a topic
+ gcp_pubsub_topic:
+ name: 'test-topic1'
+ project: "{{ gcp_project }}"
+ auth_kind: "{{ gcp_cred_kind }}"
+ service_account_file: "{{ gcp_cred_file }}"
+ scopes:
+ - https://www.googleapis.com/auth/pubsub
+ state: absent
+ register: result
+- name: assert changed is true
+ assert:
+ that:
+ - result.changed == true
+- name: verify that topic was deleted
+ shell: |
+ gcloud beta pubsub topics list --project="{{ gcp_project}}"| grep 'topic: projects/.*/test-topic1'
+ register: results
+ failed_when: results.rc == 0
+- name: verify that command succeeded
+ assert:
+ that:
+ - results.rc == 1
+ - "\"{{ resource_name }} was not found.\" in results.stderr"
+# ----------------------------------------------------------------------------
+- name: delete a topic that does not exist
+ gcp_pubsub_topic:
+ name: 'test-topic1'
+ project: "{{ gcp_project }}"
+ auth_kind: "{{ gcp_cred_kind }}"
+ service_account_file: "{{ gcp_cred_file }}"
+ scopes:
+ - https://www.googleapis.com/auth/pubsub
+ state: absent
+ register: result
+- name: assert changed is false
+ assert:
+ that:
+ - result.changed == false