diff --git a/tests/integration/targets/metal_connection/tasks/main.yml b/tests/integration/targets/metal_connection/tasks/main.yml index 5d95420..2e4935c 100755 --- a/tests/integration/targets/metal_connection/tasks/main.yml +++ b/tests/integration/targets/metal_connection/tasks/main.yml @@ -96,9 +96,9 @@ - assert: that: - - test_connection.name == "{{ test_name }}" - - test_connection.id == "{{ test_connection_fetched.id }}" - - test_connection.id == "{{ test_connection_fetched_with_id.id }}" + - test_connection.name == test_name + - test_connection.id == test_connection_fetched.id + - test_connection.id == test_connection_fetched_with_id.id - name: list test connections equinix.cloud.metal_connection_info: @@ -108,7 +108,7 @@ - assert: that: - "test_connections_list.resources | length >= 1" - - "test_connection.id in {{ test_connections_list.resources | map(attribute='id') | list }} " + - "test_connection.id in test_connections_list.resources | map(attribute='id') | list" - name: delete connection equinix.cloud.metal_connection: diff --git a/tests/integration/targets/metal_gateway/tasks/main.yml b/tests/integration/targets/metal_gateway/tasks/main.yml index c76af82..87e4937 100644 --- a/tests/integration/targets/metal_gateway/tasks/main.yml +++ b/tests/integration/targets/metal_gateway/tasks/main.yml @@ -56,7 +56,7 @@ - assert: that: - - fetched_gateway.id == "{{ gateway.id }}" + - fetched_gateway.id == gateway.id - name: list gateways equinix.cloud.metal_gateway_info: diff --git a/tests/integration/targets/metal_gateway_ip_reservation/tasks/main.yml b/tests/integration/targets/metal_gateway_ip_reservation/tasks/main.yml index 953e52d..d3efccd 100644 --- a/tests/integration/targets/metal_gateway_ip_reservation/tasks/main.yml +++ b/tests/integration/targets/metal_gateway_ip_reservation/tasks/main.yml @@ -59,7 +59,7 @@ - assert: that: - - gateway_again.id == "{{ gateway.id }}" + - gateway_again.id == gateway.id - gateway_again.changed == false - name: fetch gateway by id @@ -69,9 +69,9 @@ - assert: that: - - fetched_gateway.id == "{{ gateway.id }}" - - fetched_gateway.ip_reservation_id == "{{ ip_reservation.id }}" - - fetched_gateway.virtual_network_id == "{{ vlan.id }}" + - fetched_gateway.id == gateway.id + - fetched_gateway.ip_reservation_id == ip_reservation.id + - fetched_gateway.virtual_network_id == vlan.id - name: delete gateway equinix.cloud.metal_gateway: diff --git a/tests/integration/targets/metal_ip_assignment/tasks/main.yml b/tests/integration/targets/metal_ip_assignment/tasks/main.yml index 39e5603..4c35163 100644 --- a/tests/integration/targets/metal_ip_assignment/tasks/main.yml +++ b/tests/integration/targets/metal_ip_assignment/tasks/main.yml @@ -35,10 +35,6 @@ name: "{{ test_prefix }}-project" register: project - - assert: - that: - - project.name == '{{ test_prefix }}-project' - - name: request ip reservation equinix.cloud.metal_reserved_ip_block: type: "public_ipv4" @@ -77,8 +73,8 @@ - assert: that: - - assignment.device_id == "{{ device.id }}" - - assignment.address == "{{ available_ips.available[0] }}" + - assignment.device_id == device.id + - assignment.address == available_ips.available[0] - name: assignment info test equinix.cloud.metal_ip_assignment_info: diff --git a/tests/integration/targets/metal_project/tasks/main.yml b/tests/integration/targets/metal_project/tasks/main.yml index dc78a74..315fad1 100644 --- a/tests/integration/targets/metal_project/tasks/main.yml +++ b/tests/integration/targets/metal_project/tasks/main.yml @@ -13,29 +13,36 @@ unique_id: "{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=8') }}" - set_fact: test_prefix: "{{ test_resource_name_prefix }}-{{ unique_id }}" + - set_fact: + test_project_name1: '{{ test_prefix }}-project1' + - set_fact: + test_project_renamed: '{{ test_prefix }}-project1_renamed' + - set_fact: + test_project_name2: '{{ test_prefix }}-project2' + - name: create first project for test equinix.cloud.metal_project: - name: "{{ test_prefix }}-project1" + name: "{{ test_project_name1 }}" backend_transfer_enabled: true register: first_project - name: create first project for test again, to check idempotence equinix.cloud.metal_project: - name: "{{ test_prefix }}-project1" + name: "{{ test_project_name1 }}" backend_transfer_enabled: true register: first_project_2 - assert: that: - - first_project.name == '{{ test_prefix }}-project1' + - first_project.name == test_project_name1 - first_project.backend_transfer_enabled == true - first_project_2.changed == false - name: update project name equinix.cloud.metal_project: id: "{{ first_project.id }}" - name: "{{ test_prefix }}-project1_renamed" + name: "{{ test_project_renamed }}" backend_transfer_enabled: false - name: fetch updated project @@ -45,17 +52,17 @@ - assert: that: - - first_project_updated.name == '{{ test_prefix }}-project1_renamed' + - first_project_updated.name == test_project_renamed - first_project_updated.backend_transfer_enabled == false - name: create second project for test equinix.cloud.metal_project: - name: "{{ test_prefix }}-project2" + name: "{{ test_project_name2 }}" register: second_project - name: list second project equinix.cloud.metal_project_info: - name: "{{ test_prefix }}-project2" + name: "{{ test_project_name2 }}" register: second_project_listed - assert: diff --git a/tests/integration/targets/metal_project_ssh_key/tasks/main.yml b/tests/integration/targets/metal_project_ssh_key/tasks/main.yml index 0aa475e..4a4a913 100644 --- a/tests/integration/targets/metal_project_ssh_key/tasks/main.yml +++ b/tests/integration/targets/metal_project_ssh_key/tasks/main.yml @@ -22,16 +22,18 @@ test_key: "ssh-dss AAAAB3NzaC1kc3MAAACBAOpXVtmc0Bla98bt0o5/Zj7sb4mHIukgVFZu7F32R3VK1cEKB4rEE8uS0oLS/qMRLue45TWVJwRMYGlPjt3p/VyraelxoyJZLuITIsqa5hBc9w0oTlB5Bmbkn16umW96WCaWEoq/aitpocbRChTiP5biI6FyQTQlIHDaYzBDOi11AAAAFQDUXy7cmuzphDpJSYYTiudiUhVokwAAAIEAyUQ9m8qL/1HPkFe6jbXAvtSSmW27F4c+G2xR5HizaHQzXgBOxPcsOsY17KTU+Ddbg+OF9soWNwSpm9pyVjVmNGqH3S8R1pwvuJF/O2Asy1m6wpWhbPw8JdEBW7WHoptBpfuzJoS2LOzJUEmUu4Eb+xS237KG1d1BVny/49KAoH0AAACBAJKBSsm9Xey0fUN6vYtTQgoYeGxxj/LqAIAOs/TpCxZDntly860y/SzHYai8x48k4t7whENY1CJ41fpMcPlz8xIsrNP3326Wbr0ExwOIvJKAVN1YLYqF8NXWzaVrjo5WbSeI8PiWTYemvLAujVxZssIrApTZBhp55nnwge6K1zTG tomk@air" - set_fact: test_key2: "ssh-dss AAAAB3NzaC1kc3MAAACBAPWcHWkA06LxBQ67WmNsp1+aZMwNNz9v67pftePlQg94Z1cU4s/5j5S/Fknj7gapWw/ouiOYqXhC2p/hC9/1ARY15t0aHYqLjRhWzs3j8miL1YyXYjqLPLDtgNpX9E09We5ogjbYCB8CCtZrujm/MB6NWvX+T4uG8C/g66I4/bGdAAAAFQDa4SS+q9aQK/XwiqnWpFpAEY74TQAAAIEAklEfXCf1qbUvTquHhtNVKTiKm+qGRsqxnLnu7aduzU81JDFzveF/agkE5x30olTvKECb1PAziDmt63z/obO3Da8TUz0QVdqv81pNWU5JUNiTB8d3rDJU3B66DA6GI305W8qyt0AGUNGR3rDIzNpZY958faBg+TaILRg8ZFNh0PAAAACAdUhJS6bl5M5sQr6XNilHa0nOTk/PB54faGWWMq7zQvxUKJKsDklNTc0MCPjRppyuokbQ6297tq8pEEFqUAyllMvAf75X7DsBQivLzbNuzp41NqFdS/Oka+T1ypRD7mT6g0Kg8yCVYD2ti874wyTpV9riUUaoItveEF3AdC9AzmI= tomk@air" + - set_fact: + test_key_label: "{{ test_prefix }}-ssh_key1" + - set_fact: + test_key_renamed: "{{ test_prefix }}-ssh_key1_renamed" + - set_fact: + test_key_label2: "{{ test_prefix }}-ssh_key2" - name: create project for test equinix.cloud.metal_project: name: "{{ test_prefix }}-project" register: project - - assert: - that: - - project.name == '{{ test_prefix }}-project' - - name: create first project ssh_key for test equinix.cloud.metal_project_ssh_key: label: "{{ test_prefix }}-ssh_key1" @@ -39,17 +41,18 @@ project_id: "{{ project.id }}" register: first_ssh_key + - name: create first ssh_key for test again, to check idempotence equinix.cloud.metal_project_ssh_key: - label: "{{ test_prefix }}-ssh_key1" + label: "{{ test_key_label }}" key: "{{ test_key }}" project_id: "{{ project.id }}" register: first_ssh_key_2 - + - assert: that: - - first_ssh_key.label == '{{ test_prefix }}-ssh_key1' - - first_ssh_key.key == "{{ test_key }}" + - first_ssh_key.label == test_key_label + - first_ssh_key.key == test_key - first_ssh_key_2.changed == false - name: update ssh_key label @@ -65,12 +68,12 @@ - assert: that: - - first_ssh_key_updated.label == '{{ test_prefix }}-ssh_key1_renamed' - - first_ssh_key.key == "{{ test_key }}" + - first_ssh_key_updated.label == test_key_renamed + - first_ssh_key.key == test_key - name: create second ssh_key for test equinix.cloud.metal_project_ssh_key: - label: "{{ test_prefix }}-ssh_key2" + label: "{{ test_key_label2 }}" key: "{{ test_key2 }}" project_id: "{{ project.id }}" register: second_ssh_key @@ -84,11 +87,11 @@ msg: "{{ ssh_keys_listed.resources }}" - debug: - msg: 'ssh_keys_listed.resources | selectattr("label", "equalto", "{{ test_prefix }}-ssh_key2")' + msg: 'ssh_keys_listed.resources | selectattr("label", "equalto", test_key_label2)' - assert: that: - - 'ssh_keys_listed.resources | selectattr("label", "equalto", "{{ test_prefix }}-ssh_key2") | length == 1' + - 'ssh_keys_listed.resources | selectattr("label", "equalto", test_key_label2) | length == 1' - name: list test ssh keys set_fact: diff --git a/tests/integration/targets/metal_reserved_ip_block/tasks/main.yml b/tests/integration/targets/metal_reserved_ip_block/tasks/main.yml index 677785a..8684144 100644 --- a/tests/integration/targets/metal_reserved_ip_block/tasks/main.yml +++ b/tests/integration/targets/metal_reserved_ip_block/tasks/main.yml @@ -19,10 +19,6 @@ name: "{{ test_prefix }}-project" register: project - - assert: - that: - - project.name == '{{ test_prefix }}-project' - - name: request ip reservation equinix.cloud.metal_reserved_ip_block: type: "public_ipv4" diff --git a/tests/integration/targets/metal_ssh_key/tasks/main.yml b/tests/integration/targets/metal_ssh_key/tasks/main.yml index 17cc251..05df6f8 100644 --- a/tests/integration/targets/metal_ssh_key/tasks/main.yml +++ b/tests/integration/targets/metal_ssh_key/tasks/main.yml @@ -17,30 +17,36 @@ test_key: "ssh-dss AAAAB3NzaC1kc3MAAACBAOpXVtmc0Bla98bt0o5/Zj7sb4mHIukgVFZu7F32R3VK1cEKB4rEE8uS0oLS/qMRLue45TWVJwRMYGlPjt3p/VyraelxoyJZLuITIsqa5hBc9w0oTlB5Bmbkn16umW96WCaWEoq/aitpocbRChTiP5biI6FyQTQlIHDaYzBDOi11AAAAFQDUXy7cmuzphDpJSYYTiudiUhVokwAAAIEAyUQ9m8qL/1HPkFe6jbXAvtSSmW27F4c+G2xR5HizaHQzXgBOxPcsOsY17KTU+Ddbg+OF9soWNwSpm9pyVjVmNGqH3S8R1pwvuJF/O2Asy1m6wpWhbPw8JdEBW7WHoptBpfuzJoS2LOzJUEmUu4Eb+xS237KG1d1BVny/49KAoH0AAACBAJKBSsm9Xey0fUN6vYtTQgoYeGxxj/LqAIAOs/TpCxZDntly860y/SzHYai8x48k4t7whENY1CJ41fpMcPlz8xIsrNP3326Wbr0ExwOIvJKAVN1YLYqF8NXWzaVrjo5WbSeI8PiWTYemvLAujVxZssIrApTZBhp55nnwge6K1zTG tomk@air" - set_fact: test_key2: "ssh-dss AAAAB3NzaC1kc3MAAACBAPWcHWkA06LxBQ67WmNsp1+aZMwNNz9v67pftePlQg94Z1cU4s/5j5S/Fknj7gapWw/ouiOYqXhC2p/hC9/1ARY15t0aHYqLjRhWzs3j8miL1YyXYjqLPLDtgNpX9E09We5ogjbYCB8CCtZrujm/MB6NWvX+T4uG8C/g66I4/bGdAAAAFQDa4SS+q9aQK/XwiqnWpFpAEY74TQAAAIEAklEfXCf1qbUvTquHhtNVKTiKm+qGRsqxnLnu7aduzU81JDFzveF/agkE5x30olTvKECb1PAziDmt63z/obO3Da8TUz0QVdqv81pNWU5JUNiTB8d3rDJU3B66DA6GI305W8qyt0AGUNGR3rDIzNpZY958faBg+TaILRg8ZFNh0PAAAACAdUhJS6bl5M5sQr6XNilHa0nOTk/PB54faGWWMq7zQvxUKJKsDklNTc0MCPjRppyuokbQ6297tq8pEEFqUAyllMvAf75X7DsBQivLzbNuzp41NqFdS/Oka+T1ypRD7mT6g0Kg8yCVYD2ti874wyTpV9riUUaoItveEF3AdC9AzmI= tomk@air" + - set_fact: + test_key_label: "{{ test_prefix }}-ssh_key1" + - set_fact: + test_key_label2: "{{ test_prefix }}-ssh_key2" + - set_fact: + test_key_renamed: "{{ test_prefix }}-ssh_key1_renamed" - name: create first ssh_key for test equinix.cloud.metal_ssh_key: - label: "{{ test_prefix }}-ssh_key1" + label: "{{ test_key_label }}" key: "{{ test_key }}" register: first_ssh_key - name: create first ssh_key for test again, to check idempotence equinix.cloud.metal_ssh_key: - label: "{{ test_prefix }}-ssh_key1" + label: "{{ test_key_label }}" key: "{{ test_key }}" register: first_ssh_key_2 - assert: that: - - first_ssh_key.label == '{{ test_prefix }}-ssh_key1' - - first_ssh_key.key == "{{ test_key }}" + - first_ssh_key.label == test_key_label + - first_ssh_key.key == test_key - first_ssh_key_2.changed == false - name: update ssh_key name equinix.cloud.metal_ssh_key: id: "{{ first_ssh_key.id }}" key: "{{ test_key }}" - label: "{{ test_prefix }}-ssh_key1_renamed" + label: "{{ test_key_renamed }}" - name: fetch updated ssh_key equinix.cloud.metal_ssh_key: @@ -49,12 +55,12 @@ - assert: that: - - first_ssh_key_updated.label == '{{ test_prefix }}-ssh_key1_renamed' - - first_ssh_key.key == "{{ test_key }}" + - first_ssh_key_updated.label == test_key_renamed + - first_ssh_key.key == test_key - name: create second ssh_key for test equinix.cloud.metal_ssh_key: - label: "{{ test_prefix }}-ssh_key2" + label: "{{ test_key_label2 }}" key: "{{ test_key2 }}" register: second_ssh_key @@ -66,11 +72,11 @@ msg: "{{ ssh_keys_listed.resources }}" - debug: - msg: 'ssh_keys_listed.resources | selectattr("label", "equalto", "{{ test_prefix }}-ssh_key2")' + msg: 'ssh_keys_listed.resources | selectattr("label", "equalto", test_key_label2)' - assert: that: - - 'ssh_keys_listed.resources | selectattr("label", "equalto", "{{ test_prefix }}-ssh_key2") | length == 1' + - 'ssh_keys_listed.resources | selectattr("label", "equalto", test_key_label2) | length == 1' - name: list test ssh keys set_fact: diff --git a/tests/integration/targets/metal_vlan/tasks/main.yml b/tests/integration/targets/metal_vlan/tasks/main.yml index e894407..ff67756 100644 --- a/tests/integration/targets/metal_vlan/tasks/main.yml +++ b/tests/integration/targets/metal_vlan/tasks/main.yml @@ -28,10 +28,6 @@ name: "{{ test_prefix }}-project" register: project - - assert: - that: - - project.name == '{{ test_prefix }}-project' - - name: create first vlan for test equinix.cloud.metal_vlan: project_id: "{{ project.id }}" @@ -42,7 +38,7 @@ - assert: that: - - first_vlan.vxlan == {{ test_vxlan }} + - first_vlan.vxlan == test_vxlan - name: get vlan info equinix.cloud.metal_vlan_info: @@ -52,7 +48,7 @@ - assert: that: - "vlan_info_listed.resources | length == 1" - - vlan_info_listed.resources[0].id == "{{ first_vlan.id }}" + - vlan_info_listed.resources[0].id == first_vlan.id - name: fetch existing vlan equinix.cloud.metal_vlan: diff --git a/tests/integration/targets/metal_vrf/tasks/main.yml b/tests/integration/targets/metal_vrf/tasks/main.yml index 48bbe11..d18fbf2 100644 --- a/tests/integration/targets/metal_vrf/tasks/main.yml +++ b/tests/integration/targets/metal_vrf/tasks/main.yml @@ -60,7 +60,7 @@ assert: that: - "vrf_list.resources|length == 1" - - "vrf_list.resources[0].id == '{{ test_vrf.id }}'" + - "vrf_list.resources[0].id == test_vrf.id" - name: delete test VRF equinix.cloud.metal_vrf: