diff options
author | Alex Stephen <alexstephen@google.com> | 2019-01-16 11:15:03 -0800 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-01-16 14:15:03 -0500 |
commit | 5ca5936e056b7542d2bdd246df983e3431f64e08 (patch) | |
tree | 144ccb9752da9ecbb4ecc640aeb791f152fbaeb9 /test | |
parent | eca7c3c8c763db0da4bb56c17d17f0a5be0f56d8 (diff) | |
download | ansible-5ca5936e056b7542d2bdd246df983e3431f64e08.tar.gz |
Bug fixes for GCP modules (as of 2019-01-09T15:35:45-08:00) (#50785)
Diffstat (limited to 'test')
10 files changed, 70 insertions, 44 deletions
diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index f8d18634fb..7a50dc4304 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -197,6 +197,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: name: "sslcert-targethttpsproxy" @@ -230,6 +231,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: sslcert + ignore_errors: true - name: delete a url map gcp_compute_url_map: name: "urlmap-targethttpsproxy" @@ -239,6 +241,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: urlmap + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targethttpsproxy" @@ -252,6 +255,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-targethttpsproxy" @@ -264,6 +268,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targethttpsproxy" @@ -273,3 +278,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 2b9f24154f..f2b14904a2 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -192,6 +192,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a ssl certificate gcp_compute_ssl_certificate: name: "sslcert-targetsslproxy" @@ -225,6 +226,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: sslcert + ignore_errors: true - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targetsslproxy" @@ -238,6 +240,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a health check gcp_compute_health_check: name: "healthcheck-targetsslproxy" @@ -254,6 +257,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targetsslproxy" @@ -263,3 +267,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 1a552a262d..e057e090a7 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -154,6 +154,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: name: "backendservice-targettcpproxy" @@ -167,6 +168,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a health check gcp_compute_health_check: name: "healthcheck-targettcpproxy" @@ -183,6 +185,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-targettcpproxy" @@ -192,3 +195,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index c97e3fe1f5..ed7d69449f 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -135,6 +135,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a network gcp_compute_network: name: "network-vpngateway" @@ -143,6 +144,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true - name: delete a address gcp_compute_address: name: "address-vpngateway" @@ -152,3 +154,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index 3931d7cbec..6e4a16f5fc 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -145,6 +145,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a backend service gcp_compute_backend_service: name: "backendservice-urlmap" @@ -158,6 +159,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: backendservice + ignore_errors: true - name: delete a http health check gcp_compute_http_health_check: name: "httphealthcheck-urlmap" @@ -170,6 +172,7 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: healthcheck + ignore_errors: true - name: delete a instance group gcp_compute_instance_group: name: "instancegroup-urlmap" @@ -179,3 +182,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index ca5db7e2fa..7cdd3de88a 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a network gcp_compute_network: - name: "network-vpn_tunnel" + name: "network-vpn-tunnel" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -23,7 +23,7 @@ register: network - name: create a router gcp_compute_router: - name: "router-vpn_tunnel" + name: "router-vpn-tunnel" network: "{{ network }}" bgp: asn: 64514 @@ -41,7 +41,7 @@ register: router - name: create a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn_tunnel" + name: "gateway-vpn-tunnel" region: us-west1 network: "{{ network }}" project: "{{ gcp_project }}" @@ -164,9 +164,10 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a target vpn gateway gcp_compute_target_vpn_gateway: - name: "gateway-vpn_tunnel" + name: "gateway-vpn-tunnel" region: us-west1 network: "{{ network }}" project: "{{ gcp_project }}" @@ -174,9 +175,10 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: gateway + ignore_errors: true - name: delete a router gcp_compute_router: - name: "router-vpn_tunnel" + name: "router-vpn-tunnel" network: "{{ network }}" bgp: asn: 64514 @@ -192,11 +194,13 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: router + ignore_errors: true - name: delete a network gcp_compute_network: - name: "network-vpn_tunnel" + name: "network-vpn-tunnel" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: absent register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 86e111d66f..21ab822561 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -31,7 +31,7 @@ #---------------------------------------------------------- - name: create a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -50,17 +50,22 @@ that: - result.changed == true - name: verify that cluster was created - shell: | - gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" + gcp_container_cluster_facts: + zone: us-central1-a + 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.rc == 0 + - "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a cluster that already exists gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -81,7 +86,7 @@ #---------------------------------------------------------- - name: delete a cluster gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin @@ -100,19 +105,22 @@ that: - result.changed == true - name: verify that cluster was deleted - shell: | - gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" + gcp_container_cluster_facts: + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results - failed_when: results.rc == 0 - name: verify that command succeeded assert: that: - - results.rc == 1 - - "\"No cluster named '{{ resource_name }}' in {{ gcp_project }}.\" in results.stderr" + - "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a cluster that does not exist gcp_container_cluster: - name: "{{ resource_name }}" + name: my-cluster initial_node_count: 2 master_auth: username: cluster_admin diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index c3dfcbceff..9047ac40f6 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -25,7 +25,7 @@ register: cluster - name: delete a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -36,7 +36,7 @@ #---------------------------------------------------------- - name: create a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -51,8 +51,6 @@ - result.changed == true - name: verify that node_pool was created gcp_container_node_pool_facts: - filters: - - name = {{ resource_name }} cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -64,11 +62,11 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a node pool that already exists gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -84,7 +82,7 @@ #---------------------------------------------------------- - name: delete a node pool gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -99,8 +97,6 @@ - result.changed == true - name: verify that node_pool was deleted gcp_container_node_pool_facts: - filters: - - name = {{ resource_name }} cluster: "{{ cluster }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -112,11 +108,11 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a node pool that does not exist gcp_container_node_pool: - name: "{{ resource_name }}" + name: my-pool initial_node_count: 4 cluster: "{{ cluster }}" zone: us-central1-a @@ -131,6 +127,7 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a cluster gcp_container_cluster: name: "cluster-nodepool" @@ -141,3 +138,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: cluster + ignore_errors: true diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index d9866d4f15..a0a63d0bf6 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -68,7 +68,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 2 + - "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a resource record set that already exists gcp_dns_resource_record_set: @@ -121,7 +121,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 2 + - "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a resource record set that does not exist gcp_dns_resource_record_set: @@ -144,6 +144,7 @@ - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a managed zone gcp_dns_managed_zone: name: "managedzone-rrs" @@ -154,3 +155,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: managed_zone + ignore_errors: true diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 6afc20203e..2b6607b12b 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -25,8 +25,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -37,8 +35,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -60,14 +56,12 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: create a subscription that already exists gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -83,8 +77,6 @@ gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -106,14 +98,12 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- - name: delete a subscription that does not exist gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" - push_config: - push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1 ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -126,6 +116,7 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +# If errors happen, don't crash the playbook! - name: delete a topic gcp_pubsub_topic: name: "topic-subscription" @@ -134,3 +125,4 @@ service_account_file: "{{ gcp_cred_file }}" state: absent register: topic + ignore_errors: true |