From 52b45f217fa9172243e08db7f36df7b701d8f414 Mon Sep 17 00:00:00 2001 From: george-ghawali Date: Thu, 3 Oct 2024 15:57:26 +0300 Subject: [PATCH 1/2] Adding some delay after creating static route since it needs some time to be active Add minor fix in service groups test that assert empty list --- .../ntnx_service_groups/tasks/create.yml | 2 +- .../ntnx_static_routes/tasks/create.yml | 56 ++++++++++++++++++- .../ntnx_static_routes_info/tasks/info.yml | 4 ++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/tests/integration/targets/ntnx_service_groups/tasks/create.yml b/tests/integration/targets/ntnx_service_groups/tasks/create.yml index 47b8759c..6afd4ece 100644 --- a/tests/integration/targets/ntnx_service_groups/tasks/create.yml +++ b/tests/integration/targets/ntnx_service_groups/tasks/create.yml @@ -152,7 +152,7 @@ - result.response.service_group.service_list[1].udp_port_range_list[2].start_port == 99 - result.response.service_group.service_list[1].udp_port_range_list[2].end_port == 99 - result.response.service_group.service_list[2].protocol == "ICMP" - - result.response.service_group.service_list[2].icmp_type_code_list == [] + - result.response.service_group.service_list[2].icmp_type_code_list == [{}] fail_msg: "Fail: Unable to create tcp service group " success_msg: "Pass: tcp service group created successfully" diff --git a/tests/integration/targets/ntnx_static_routes/tasks/create.yml b/tests/integration/targets/ntnx_static_routes/tasks/create.yml index a677ca55..c8a77d0c 100644 --- a/tests/integration/targets/ntnx_static_routes/tasks/create.yml +++ b/tests/integration/targets/ntnx_static_routes/tasks/create.yml @@ -30,6 +30,36 @@ - result.response is defined - result.response.status.state == 'COMPLETE' - result.changed == true + - ("{{d1}}" == "10.2.2.0/24" and "{{d2}}" == "10.2.3.0/24") or ("{{d2}}" == "10.2.2.0/24" and "{{d1}}" == "10.2.3.0/24") + - result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" + - result.response.status.resources.static_routes_list[1]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" + - result.response.status.resources.default_route["destination"] == "0.0.0.0/0" + - result.response.status.resources.default_route["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" + + fail_msg: "Fail: Unable to update static routes of vpc" + success_msg: "Succes: static routes updated successfully" + +- name: Wait 1 minute for static routes to be created + pause: + seconds: 60 + +- name: get all static routes + ntnx_static_routes_info: + vpc_uuid: "{{ vpc.uuid }}" + register: result + +- set_fact: + d1: "{{ result.response.status.resources.static_routes_list[0].destination }}" + d2: "{{ result.response.status.resources.static_routes_list[1].destination }}" + +- debug: + msg: "{{ result }}" + +- name: check info module response + assert: + that: + - result.response is defined + - result.changed == false - result.response.status.resources.static_routes_list[0]["is_active"] == true - ("{{d1}}" == "10.2.2.0/24" and "{{d2}}" == "10.2.3.0/24") or ("{{d2}}" == "10.2.2.0/24" and "{{d1}}" == "10.2.3.0/24") - result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" @@ -39,8 +69,8 @@ - result.response.status.resources.default_route["destination"] == "0.0.0.0/0" - result.response.status.resources.default_route["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" - fail_msg: 'Fail: Unable to update static routes of vpc' - success_msg: 'Succes: static routes updated successfully' + fail_msg: "Fail: Unable to get static routes for vpc" + success_msg: "Succes" ########################################################################################################### @@ -89,12 +119,32 @@ - result.response is defined - result.response.status.state == 'COMPLETE' - result.changed == true - - result.response.status.resources.static_routes_list[0]["is_active"] == true - result.response.status.resources.static_routes_list[0]["destination"] == "10.2.4.0/24" - result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" fail_msg: "Static routes overriding failed" success_msg: "Static routes overridden successfully" +- name: Wait 1 minute for static routes to be created + pause: + seconds: 60 + +- name: get all static routes + ntnx_static_routes_info: + vpc_uuid: "{{ vpc.uuid }}" + register: result + +- set_fact: + d1: "{{ result.response.status.resources.static_routes_list[0].destination }}" + +- name: check info module response + assert: + that: + - result.response is defined + - result.changed == false + - result.response.status.resources.static_routes_list[0]["is_active"] == true + - result.response.status.resources.static_routes_list[0]["destination"] == "10.2.4.0/24" + - result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}" + ########################################################################################################### - name: Netgative scenario of creating multiple default routes diff --git a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml index 4b79f1a0..589b45e2 100644 --- a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml +++ b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml @@ -30,6 +30,10 @@ ########################################################################################################### +- name: Wait 60 seconds for static routes to be created + pause: + seconds: 60 + - name: get all static routes ntnx_static_routes_info: vpc_uuid: "{{ vpc.uuid }}" From cd7962f207d687d8a31f5f697337fa4d6084a586 Mon Sep 17 00:00:00 2001 From: george-ghawali Date: Tue, 8 Oct 2024 15:13:14 +0300 Subject: [PATCH 2/2] Resolving comment --- tests/integration/targets/ntnx_static_routes/tasks/create.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/ntnx_static_routes/tasks/create.yml b/tests/integration/targets/ntnx_static_routes/tasks/create.yml index c8a77d0c..b57f7b07 100644 --- a/tests/integration/targets/ntnx_static_routes/tasks/create.yml +++ b/tests/integration/targets/ntnx_static_routes/tasks/create.yml @@ -39,7 +39,7 @@ fail_msg: "Fail: Unable to update static routes of vpc" success_msg: "Succes: static routes updated successfully" -- name: Wait 1 minute for static routes to be created +- name: Wait 1 minute for static routes to be become active pause: seconds: 60 @@ -124,7 +124,7 @@ fail_msg: "Static routes overriding failed" success_msg: "Static routes overridden successfully" -- name: Wait 1 minute for static routes to be created +- name: Wait 1 minute for static routes to be become active pause: seconds: 60