From 717193b67f99668b833cba58f3565d6ff517ffca Mon Sep 17 00:00:00 2001 From: Kedar K <4506537+kedarX@users.noreply.github.com> Date: Tue, 28 Nov 2017 14:58:42 +0530 Subject: [PATCH] Fix integration test failures due to wrong files paths to ficture and (#33329) missing ssh port --- .../targets/iosxr_user/tests/cli/auth.yaml | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/test/integration/targets/iosxr_user/tests/cli/auth.yaml b/test/integration/targets/iosxr_user/tests/cli/auth.yaml index 9c360d24133..05cb51999ee 100644 --- a/test/integration/targets/iosxr_user/tests/cli/auth.yaml +++ b/test/integration/targets/iosxr_user/tests/cli/auth.yaml @@ -5,6 +5,7 @@ name: auth_user state: present configured_password: pass123 + provider: "{{ cli }}" - name: test login expect: @@ -29,24 +30,26 @@ iosxr_user: name: auth_user state: present - public_key_contents: "{{ lookup('file', \"{{ output_dir }}/public.pub\") }}" + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}" + provider: "{{ cli }}" - name: test login with private key expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' - name: remove user and key iosxr_user: name: auth_user state: absent + provider: "{{ cli }}" - name: test login with private key (should fail, no user) expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' ignore_errors: yes register: results @@ -54,25 +57,29 @@ iosxr_user: name: auth_user state: present - public_key: "{{ output_dir }}/public.pub" + public_key: "{{ role_path }}/files/public.pub" + provider: "{{ cli }}" - name: test login with private key expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' + ignore_errors: yes - name: change private key for user iosxr_user: name: auth_user state: present - public_key_contents: "{{ lookup('file', \"{{ output_dir }}/public2.pub\") }}" + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}" + provider: "{{ cli }}" + # FIXME: pexpect fails with OSError: [Errno 5] Input/output error - name: test login with invalid private key (should fail) expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" responses: - (?i)passphrase: "pass123" + (?i)password: "pass123" ignore_errors: yes register: results @@ -86,4 +93,5 @@ iosxr_user: name: auth_user state: absent + provider: "{{ cli }}" register: result