Test Fixes (#299)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-07-09 11:32:46 -07:00 committed by Alex Stephen
commit 5b92781ab0
45 changed files with 19 additions and 96 deletions

View file

@ -1,3 +1,2 @@
---
resource_name: "{{ resource_prefix }}"
sa_name: sa-{{ 100000 | random }}@graphite-playground.google.com.iam.gserviceaccount.com

View file

@ -15,7 +15,7 @@
# Pre-test setup
- name: delete a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
@ -24,7 +24,7 @@
#----------------------------------------------------------
- name: create a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
@ -46,11 +46,11 @@
- name: verify that command succeeded
assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*{{ sa_name }}.*") | list | length == 1
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: create a service account that already exists
gcp_iam_service_account:
name: "{{ sa_name }}"
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
@ -64,7 +64,7 @@
#----------------------------------------------------------
- name: delete a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
@ -86,11 +86,11 @@
- name: verify that command succeeded
assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*{{ sa_name }}.*") | list | length == 0
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: delete a service account that does not exist
gcp_iam_service_account:
name: "{{ sa_name }}"
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"