mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-27 23:21:31 -07:00
Bug fixes for GCP modules (as of 2019-01-09T15:35:45-08:00) (#50786)
This commit is contained in:
parent
73abff2b5a
commit
899cc535cf
18 changed files with 142 additions and 119 deletions
|
@ -15,7 +15,7 @@
|
|||
# Pre-test setup
|
||||
- name: delete a instance
|
||||
gcp_sql_instance:
|
||||
name: "{{ resource_name }}"
|
||||
name: "{{resource_name}}-2"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
|
@ -30,7 +30,7 @@
|
|||
#----------------------------------------------------------
|
||||
- name: create a instance
|
||||
gcp_sql_instance:
|
||||
name: "{{ resource_name }}"
|
||||
name: "{{resource_name}}-2"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
|
@ -49,17 +49,21 @@
|
|||
- result.changed == true
|
||||
- "result.kind == 'sql#instance'"
|
||||
- name: verify that instance was created
|
||||
shell: |
|
||||
gcloud sql instances describe --project="{{ gcp_project}}" "{{ resource_name }}"
|
||||
gcp_sql_instance_facts:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/sqlservice.admin
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results.rc == 0
|
||||
- results['items'] | length >= 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a instance that already exists
|
||||
gcp_sql_instance:
|
||||
name: "{{ resource_name }}"
|
||||
name: "{{resource_name}}-2"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
|
@ -80,7 +84,7 @@
|
|||
#----------------------------------------------------------
|
||||
- name: delete a instance
|
||||
gcp_sql_instance:
|
||||
name: "{{ resource_name }}"
|
||||
name: "{{resource_name}}-2"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
|
@ -99,19 +103,21 @@
|
|||
- result.changed == true
|
||||
- result.has_key('kind') == False
|
||||
- name: verify that instance was deleted
|
||||
shell: |
|
||||
gcloud sql instances describe --project="{{ gcp_project}}" "{{ resource_name }}"
|
||||
gcp_sql_instance_facts:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/sqlservice.admin
|
||||
register: results
|
||||
failed_when: results.rc == 0
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results.rc == 1
|
||||
- "\"Cloud SQL instance does not exist\" in results.stderr"
|
||||
- results['items'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a instance that does not exist
|
||||
gcp_sql_instance:
|
||||
name: "{{ resource_name }}"
|
||||
name: "{{resource_name}}-2"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue