diff options
author | The Magician <magic-modules@google.com> | 2019-07-19 13:42:37 -0700 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-07-19 16:42:37 -0400 |
commit | 5b0214bccecaa6af1812ae34a1a12032fb03f0a9 (patch) | |
tree | ab790a1a33ce5900ee557bcf280c3b0ca06bc1fc /test | |
parent | 40ff1949fb8662b1a7847f46df47c049d4b0bc3c (diff) | |
download | ansible-5b0214bccecaa6af1812ae34a1a12032fb03f0a9.tar.gz |
New Module: gcp_appengine_firewall_rule (#58852)
Diffstat (limited to 'test')
4 files changed, 112 insertions, 0 deletions
diff --git a/test/integration/targets/gcp_appengine_firewall_rule/aliases b/test/integration/targets/gcp_appengine_firewall_rule/aliases new file mode 100644 index 0000000000..9812f019ca --- /dev/null +++ b/test/integration/targets/gcp_appengine_firewall_rule/aliases @@ -0,0 +1,2 @@ +cloud/gcp +unsupported diff --git a/test/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml b/test/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml new file mode 100644 index 0000000000..ba66644fc1 --- /dev/null +++ b/test/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml @@ -0,0 +1,2 @@ +--- +resource_name: "{{ resource_prefix }}" diff --git a/test/integration/targets/gcp_appengine_firewall_rule/meta/main.yml b/test/integration/targets/gcp_appengine_firewall_rule/meta/main.yml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/integration/targets/gcp_appengine_firewall_rule/meta/main.yml diff --git a/test/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml b/test/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml new file mode 100644 index 0000000000..94dac0184c --- /dev/null +++ b/test/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml @@ -0,0 +1,108 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 firewall rule + gcp_appengine_firewall_rule: + priority: 1000 + source_range: 10.0.0.0 + action: ALLOW + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a firewall rule + gcp_appengine_firewall_rule: + priority: 1000 + source_range: 10.0.0.0 + action: ALLOW + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that firewall_rule was created + gcp_appengine_firewall_rule_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length >= 1 +# ---------------------------------------------------------------------------- +- name: create a firewall rule that already exists + gcp_appengine_firewall_rule: + priority: 1000 + source_range: 10.0.0.0 + action: ALLOW + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a firewall rule + gcp_appengine_firewall_rule: + priority: 1000 + source_range: 10.0.0.0 + action: ALLOW + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that firewall_rule was deleted + gcp_appengine_firewall_rule_facts: + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a firewall rule that does not exist + gcp_appengine_firewall_rule: + priority: 1000 + source_range: 10.0.0.0 + action: ALLOW + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false |