removing interconnect tests

This commit is contained in:
Alex Stephen 2018-12-06 12:51:27 -08:00
parent 6f218887e2
commit 5673c2b7a9

View file

@ -1,116 +0,0 @@
---
# ----------------------------------------------------------------------------
#
# *** 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 interconnect attachment
gcp_compute_interconnect_attachment:
name: "{{ resource_name }}"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/...
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: disk
#----------------------------------------------------------
- name: create a interconnect attachment
gcp_compute_interconnect_attachment:
name: "{{ resource_name }}"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/...
service_account_file: "{{ gcp_cred_file }}"
state: present
register: disk
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
- "result.kind == 'compute#interconnectAttachment'"
- name: verify that interconnect_attachment was created
shell: |
gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}"
register: results
- name: verify that command succeeded
assert:
that:
- results.rc == 0
# ----------------------------------------------------------------------------
- name: create a interconnect attachment that already exists
gcp_compute_interconnect_attachment:
name: "{{ resource_name }}"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/...
service_account_file: "{{ gcp_cred_file }}"
state: present
register: disk
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
- "result.kind == 'compute#interconnectAttachment'"
#----------------------------------------------------------
- name: delete a interconnect attachment
gcp_compute_interconnect_attachment:
name: "{{ resource_name }}"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/...
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: disk
register: result
- name: assert changed is true
assert:
that:
- result.changed == true
- result.has_key('kind') == False
- name: verify that interconnect_attachment was deleted
shell: |
gcloud compute interconnects attachments describe "{{ resource_name }}" --project="{{ gcp_project}}" --region="{{ gcp_region}}"
register: results
failed_when: results.rc == 0
- name: verify that command succeeded
assert:
that:
- results.rc == 1
- "\"'projects/{{ gcp_project }}/global/images/{{ resource_name }}' was not found\" in results.stderr"
# ----------------------------------------------------------------------------
- name: delete a interconnect attachment that does not exist
gcp_compute_interconnect_attachment:
name: "{{ resource_name }}"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
interconnect: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/global/interconnects/...
router: https://googleapis.com/compute/v1/projects/{{ gcp_project }}/regions/us-central1/routers/...
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: disk
register: result
- name: assert changed is false
assert:
that:
- result.changed == false
- result.has_key('kind') == False