mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-08-03 04:34:31 -07:00
tests: fixing gcp_iam_service_account
there was a hardcoded GCP project for testing purposes.
This commit is contained in:
parent
24d09d17c3
commit
f1f41177e4
2 changed files with 8 additions and 9 deletions
|
@ -1,2 +1 @@
|
||||||
cloud/gcp
|
cloud/gcp
|
||||||
unsupported
|
|
|
@ -15,7 +15,7 @@
|
||||||
# Pre-test setup
|
# Pre-test setup
|
||||||
- name: delete a service account
|
- name: delete a service account
|
||||||
google.cloud.gcp_iam_service_account:
|
google.cloud.gcp_iam_service_account:
|
||||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com
|
||||||
display_name: My Ansible test key
|
display_name: My Ansible test key
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: create a service account
|
- name: create a service account
|
||||||
google.cloud.gcp_iam_service_account:
|
google.cloud.gcp_iam_service_account:
|
||||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com
|
||||||
display_name: My Ansible test key
|
display_name: My Ansible test key
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
@ -46,11 +46,11 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1
|
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: create a service account that already exists
|
- name: create a service account that already exists
|
||||||
google.cloud.gcp_iam_service_account:
|
google.cloud.gcp_iam_service_account:
|
||||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com
|
||||||
display_name: My Ansible test key
|
display_name: My Ansible test key
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: delete a service account
|
- name: delete a service account
|
||||||
google.cloud.gcp_iam_service_account:
|
google.cloud.gcp_iam_service_account:
|
||||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com
|
||||||
display_name: My Ansible test key
|
display_name: My Ansible test key
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
@ -86,11 +86,11 @@
|
||||||
- name: verify that command succeeded
|
- name: verify that command succeeded
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0
|
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
- name: delete a service account that does not exist
|
- name: delete a service account that does not exist
|
||||||
google.cloud.gcp_iam_service_account:
|
google.cloud.gcp_iam_service_account:
|
||||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com
|
||||||
display_name: My Ansible test key
|
display_name: My Ansible test key
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue