Remove jinja vars from conditional statements in integration test asserts

This commit is contained in:
Chris Hawk 2024-07-24 16:15:24 -07:00
parent a9c0624bbd
commit d9d57cbeeb
7 changed files with 14 additions and 14 deletions
tests/integration/targets
gcp_container_cluster/tasks
gcp_container_node_pool/tasks
gcp_dns_resource_record_set/tasks
gcp_pubsub_subscription/tasks
gcp_pubsub_topic/tasks
gcp_sql_database/tasks
gcp_sql_user/tasks

View file

@ -55,7 +55,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*my-cluster.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a cluster that already exists
google.cloud.gcp_container_cluster:
@ -104,7 +104,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*my-cluster.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a cluster that does not exist
google.cloud.gcp_container_cluster:

View file

@ -62,7 +62,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*my-pool.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a node pool that already exists
google.cloud.gcp_container_node_pool:
@ -108,7 +108,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*my-pool.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a node pool that does not exist
google.cloud.gcp_container_node_pool:

View file

@ -67,7 +67,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*www\\.testzone-4\\.com.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a resource record set that already exists
google.cloud.gcp_dns_resource_record_set:
@ -118,7 +118,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*www\\.testzone-4\\.com.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a resource record set that does not exist
google.cloud.gcp_dns_resource_record_set:

View file

@ -56,7 +56,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a subscription that already exists
google.cloud.gcp_pubsub_subscription:
@ -98,7 +98,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a subscription that does not exist
google.cloud.gcp_pubsub_subscription:

View file

@ -44,7 +44,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'test-topic1' in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*test-topic1.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a topic that already exists
google.cloud.gcp_pubsub_topic:
@ -82,7 +82,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'test-topic1' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*test-topic1.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a topic that does not exist
google.cloud.gcp_pubsub_topic:

View file

@ -64,7 +64,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a database that already exists
google.cloud.gcp_sql_database:
@ -107,7 +107,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a database that does not exist
google.cloud.gcp_sql_database:

View file

@ -66,7 +66,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*test-user.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: Create a user that already exists
google.cloud.gcp_sql_user:
@ -111,7 +111,7 @@
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
- results['resources'] | map(attribute='name') | select("match", ".*test-user.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: Delete a user that does not exist
google.cloud.gcp_sql_user: