summaryrefslogtreecommitdiff
path: root/test/integration/targets/junos_netconf
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2019-06-18 08:31:05 -0400
committerGitHub <noreply@github.com>2019-06-18 08:31:05 -0400
commit8dc51dfe1c4b8a339e4fba169e508af18af01060 (patch)
tree33f185a9b1a098041deadd9726497b220fa9428c /test/integration/targets/junos_netconf
parentec7b18952b5a8371f345f83557f366c3f1c53840 (diff)
downloadansible-8dc51dfe1c4b8a339e4fba169e508af18af01060.tar.gz
Remove pause logic form junos_netconf tests (#57966)
We can switch to wait_for / meta, as using pause can lead to race conditions on slower / faster hardware. Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Diffstat (limited to 'test/integration/targets/junos_netconf')
-rw-r--r--test/integration/targets/junos_netconf/tests/cli/changeport.yaml35
-rw-r--r--test/integration/targets/junos_netconf/tests/cli/netconf.yaml26
2 files changed, 40 insertions, 21 deletions
diff --git a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
index a6c42ed190..528380f8d7 100644
--- a/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
+++ b/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
@@ -4,9 +4,9 @@
- name: Setup
junos_netconf:
state: present
- register: result
###################################
+
- name: Change port
junos_netconf:
state: present
@@ -27,17 +27,24 @@
that:
- "result.changed == false"
-- name: wait for netconf server to come up
- pause:
- seconds: 10
+- name: wait for netconf port tcp/8022 to be open
+ wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 8022
+ with_inventory_hostnames: junos
+
+- name: Reset ansible connections
+ meta: reset_connection
- name: Ensure we can communicate over 8022
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=8022 is_ignore_errors=false"
-- name: wait for persistent socket to timeout
- pause:
- seconds: 120
-
+- name: wait for netconf port tcp/830 to be closed
+ wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 830
+ state: stopped
+ with_inventory_hostnames: junos
# This protects against the port override above not being honoured and a bug setting the port
- name: Ensure we can NOT communicate over default port
@@ -50,11 +57,15 @@
- name: Set back netconf to default port
junos_netconf:
state: present
- register: result
-- name: wait for persistent socket to timeout
- pause:
- seconds: 120
+- name: wait for netconf port tcp/830 to be open
+ wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 830
+ with_inventory_hostnames: junos
+
+- name: Reset ansible connections
+ meta: reset_connection
- name: Ensure we can communicate over netconf
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
diff --git a/test/integration/targets/junos_netconf/tests/cli/netconf.yaml b/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
index 9cc69ba356..2fdf677dea 100644
--- a/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
+++ b/test/integration/targets/junos_netconf/tests/cli/netconf.yaml
@@ -1,11 +1,9 @@
---
- debug: msg="START netconf/netconf.yaml on connection={{ ansible_connection }}"
-
- name: Ensure netconf is enabled
junos_netconf:
state: present
- register: result
- name: idempotent tests
junos_netconf:
@@ -18,9 +16,14 @@
###################################
-- name: wait for netconf server to come up
- pause:
- seconds: 10
+- name: wait for netconf port tcp/830 to be open
+ wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 830
+ with_inventory_hostnames: junos
+
+- name: Reset ansible connections
+ meta: reset_connection
- name: Ensure we can communicate over netconf
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
@@ -61,9 +64,15 @@
that:
- "result.changed == false"
-- name: wait for persistent socket to timeout
- pause:
- seconds: 120
+- name: wait for netconf port tcp/830 to be closed
+ wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 830
+ state: stopped
+ with_inventory_hostnames: junos
+
+- name: Reset ansible connections
+ meta: reset_connection
- name: Ensure we can NOT talk via netconf
include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=true"
@@ -96,6 +105,5 @@
- name: re-enable netconf
junos_netconf:
state: present
- register: result
- debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}"