fix: upgrade ansible version, address test and lint errors

This commit is contained in:
Chris Hawk 2023-11-17 16:39:42 -08:00
commit 08ada5354d
216 changed files with 4394 additions and 4262 deletions

View file

@ -13,57 +13,57 @@
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: delete a cloud function
- name: Delete a cloud function
google.cloud.gcp_cloudfunctions_cloud_function:
name: "{{ resource_name }}"
location: us-central1
entry_point: helloGET
source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip
trigger_http: 'true'
trigger_http: "true"
project: "{{ gcp_project }}"
runtime: "python310"
runtime: python310
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
#----------------------------------------------------------
- name: create a cloud function
- name: Create a cloud function
google.cloud.gcp_cloudfunctions_cloud_function:
name: "{{ resource_name }}"
location: us-central1
entry_point: helloGET
source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip
trigger_http: 'true'
trigger_http: "true"
project: "{{ gcp_project }}"
runtime: "python310"
runtime: python310
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: result
- name: assert changed is true
assert:
- name: Assert changed is true
ansible.builtin.assert:
that:
- result.changed == true
- name: verify that cloud_function was created
- name: Verify that cloud_function was created
google.cloud.gcp_cloudfunctions_cloud_function_info:
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: create a cloud function that already exists
- name: Create a cloud function that already exists
google.cloud.gcp_cloudfunctions_cloud_function:
name: "{{ resource_name }}"
location: us-central1
entry_point: helloGET
source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip
trigger_http: 'true'
trigger_http: "true"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
# runtime is not sent as it is optional for
@ -72,54 +72,54 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: result
- name: assert changed is false
assert:
- name: Assert changed is false
ansible.builtin.assert:
that:
- result.changed == false
#----------------------------------------------------------
- name: delete a cloud function
- name: Delete a cloud function
google.cloud.gcp_cloudfunctions_cloud_function:
name: "{{ resource_name }}"
location: us-central1
entry_point: helloGET
source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip
trigger_http: 'true'
trigger_http: "true"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
register: result
- name: assert changed is true
assert:
- name: Assert changed is true
ansible.builtin.assert:
that:
- result.changed == true
- name: verify that cloud_function was deleted
- name: Verify that cloud_function was deleted
google.cloud.gcp_cloudfunctions_cloud_function_info:
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: delete a cloud function that does not exist
- name: Delete a cloud function that does not exist
google.cloud.gcp_cloudfunctions_cloud_function:
name: "{{ resource_name }}"
location: us-central1
entry_point: helloGET
source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip
trigger_http: 'true'
trigger_http: "true"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
register: result
- name: assert changed is false
assert:
- name: Assert changed is false
ansible.builtin.assert:
that:
- result.changed == false

View file

@ -1,2 +1,3 @@
---
- include_tasks: autogen.yml
- name: Generated tests
ansible.builtin.include_tasks: autogen.yml