From 9304d6cb01a924c77ddfdf4cb199edb578f7bd48 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Wed, 2 Aug 2017 10:28:12 +0530 Subject: [PATCH] fix nxos_user integration test (#27619) Signed-off-by: Trishna Guha --- .../targets/nxos_user/tasks/nxapi.yaml | 2 ++ .../targets/nxos_user/tests/cli/basic.yaml | 28 ++++++++++++++----- .../targets/nxos_user/tests/nxapi/basic.yaml | 28 ++++++++++++++----- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/test/integration/targets/nxos_user/tasks/nxapi.yaml b/test/integration/targets/nxos_user/tasks/nxapi.yaml index ea525379f7..5fb9cedaa6 100644 --- a/test/integration/targets/nxos_user/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_user/tasks/nxapi.yaml @@ -14,6 +14,7 @@ - feature nxapi - nxapi http port 80 provider: "{{ cli }}" + timeout: 100 - name: run test case include: "{{ test_case_to_run }}" @@ -26,3 +27,4 @@ lines: - no feature nxapi provider: "{{ cli }}" + timeout: 100 diff --git a/test/integration/targets/nxos_user/tests/cli/basic.yaml b/test/integration/targets/nxos_user/tests/cli/basic.yaml index 2adce30615..44a46a28d7 100644 --- a/test/integration/targets/nxos_user/tests/cli/basic.yaml +++ b/test/integration/targets/nxos_user/tests/cli/basic.yaml @@ -1,7 +1,17 @@ --- +- name: Remove old entries of user + nxos_user: + aggregate: + - name: ansibletest1 + - name: ansibletest2 + - name: ansibletest3 + state: absent + provider: "{{ cli }}" + +# Start tests - name: Create user nxos_user: - name: netend + name: ansibletest1 roles: network-operator state: present provider: "{{ cli }}" @@ -10,13 +20,14 @@ - assert: that: - 'result.changed == true' - - 'result.commands == ["username netend role network-operator"]' + - '"username" in result.commands[0]' + - '"role network-operator" in result.commands[1]' - name: Collection of users nxos_user: aggregate: - - name: test1 - - name: test2 + - name: ansibletest2 + - name: ansibletest3 state: present roles: network-admin provider: "{{ cli }}" @@ -25,15 +36,18 @@ - assert: that: - 'result.changed == true' - - 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]' - name: tearDown nxos_user: - purge: yes + aggregate: + - name: ansibletest1 + - name: ansibletest2 + - name: ansibletest3 + state: absent provider: "{{ cli }}" register: result - assert: that: - 'result.changed == true' - - 'result.commands == ["no username netend", "no username test1", "no username test2"]' + - '"no username" in result.commands[0]' diff --git a/test/integration/targets/nxos_user/tests/nxapi/basic.yaml b/test/integration/targets/nxos_user/tests/nxapi/basic.yaml index f3bc1ed1a4..553193955a 100644 --- a/test/integration/targets/nxos_user/tests/nxapi/basic.yaml +++ b/test/integration/targets/nxos_user/tests/nxapi/basic.yaml @@ -1,7 +1,17 @@ --- +- name: Remove old entries of user + nxos_user: + aggregate: + - name: ansibletest1 + - name: ansibletest2 + - name: ansibletest3 + state: absent + provider: "{{ nxapi }}" + +# Start tests - name: Create user nxos_user: - name: netend + name: ansibletest1 roles: network-operator state: present provider: "{{ nxapi }}" @@ -10,13 +20,14 @@ - assert: that: - 'result.changed == true' - - 'result.commands == ["username netend role network-operator"]' + - '"username" in result.commands[0]' + - '"role network-operator" in result.commands[1]' - name: Collection of users nxos_user: aggregate: - - name: test1 - - name: test2 + - name: ansibletest2 + - name: ansibletest3 state: present roles: network-admin provider: "{{ nxapi }}" @@ -25,15 +36,18 @@ - assert: that: - 'result.changed == true' - - 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]' - name: tearDown nxos_user: - purge: yes + aggregate: + - name: ansibletest1 + - name: ansibletest2 + - name: ansibletest3 + state: absent provider: "{{ nxapi }}" register: result - assert: that: - 'result.changed == true' - - 'result.commands == ["no username netend", "no username test1", "no username test2"]' + - '"no username" in result.commands[0]'