mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-09 06:40:09 -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
|
@ -49,13 +49,18 @@
|
|||
that:
|
||||
- result.changed == true
|
||||
- name: verify that database was created
|
||||
shell: |
|
||||
gcloud spanner databases describe --project="{{ gcp_project }}" --instance="{{ instance.name }}" "webstore"
|
||||
gcp_spanner_database_facts:
|
||||
instance: "{{ instance }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/spanner.admin
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results.rc == 0
|
||||
- "'webstore' in \"{{ results['items'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a database that already exists
|
||||
gcp_spanner_database:
|
||||
|
@ -85,15 +90,18 @@
|
|||
that:
|
||||
- result.changed == true
|
||||
- name: verify that database was deleted
|
||||
shell: |
|
||||
gcloud spanner databases describe --project="{{ gcp_project }}" --instance="{{ instance.name }}" "webstore"
|
||||
gcp_spanner_database_facts:
|
||||
instance: "{{ instance }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/spanner.admin
|
||||
register: results
|
||||
failed_when: results.rc == 0
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results.rc == 1
|
||||
- "\"Database not found: projects/{{ gcp_project }}/instances/instance-database/databases/webstore\" in results.stderr"
|
||||
- "'webstore' not in \"{{ results['items'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a database that does not exist
|
||||
gcp_spanner_database:
|
||||
|
@ -110,6 +118,7 @@
|
|||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a instance
|
||||
gcp_spanner_instance:
|
||||
name: "instance-database"
|
||||
|
@ -123,3 +132,4 @@
|
|||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instance
|
||||
ignore_errors: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue