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>
pull/58002/head
Paul Belanger 6 years ago committed by GitHub
parent ec7b18952b
commit 8dc51dfe1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,9 +4,9 @@
- name: Setup - name: Setup
junos_netconf: junos_netconf:
state: present state: present
register: result
################################### ###################################
- name: Change port - name: Change port
junos_netconf: junos_netconf:
state: present state: present
@ -27,17 +27,24 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: wait for netconf server to come up - name: wait for netconf port tcp/8022 to be open
pause: wait_for:
seconds: 10 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 - 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" 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 - name: wait for netconf port tcp/830 to be closed
pause: wait_for:
seconds: 120 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 # 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 - name: Ensure we can NOT communicate over default port
@ -50,11 +57,15 @@
- name: Set back netconf to default port - name: Set back netconf to default port
junos_netconf: junos_netconf:
state: present state: present
register: result
- name: wait for persistent socket to timeout - name: wait for netconf port tcp/830 to be open
pause: wait_for:
seconds: 120 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 - 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" include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"

@ -1,11 +1,9 @@
--- ---
- debug: msg="START netconf/netconf.yaml on connection={{ ansible_connection }}" - debug: msg="START netconf/netconf.yaml on connection={{ ansible_connection }}"
- name: Ensure netconf is enabled - name: Ensure netconf is enabled
junos_netconf: junos_netconf:
state: present state: present
register: result
- name: idempotent tests - name: idempotent tests
junos_netconf: junos_netconf:
@ -18,9 +16,14 @@
################################### ###################################
- name: wait for netconf server to come up - name: wait for netconf port tcp/830 to be open
pause: wait_for:
seconds: 10 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 - 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" include: "{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=netconf ansible_port=830 is_ignore_errors=false"
@ -61,9 +64,15 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: wait for persistent socket to timeout - name: wait for netconf port tcp/830 to be closed
pause: wait_for:
seconds: 120 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 - 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" 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 - name: re-enable netconf
junos_netconf: junos_netconf:
state: present state: present
register: result
- debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}" - debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}"

Loading…
Cancel
Save