From e0cc7b34151def2ce0b08dbe3cb995107a2d6a0f Mon Sep 17 00:00:00 2001 From: John R Barker Date: Fri, 28 Oct 2016 19:50:29 +0100 Subject: Migrate Network Tests into ansible/ansible (#18233) * Docs Networking tests * Copy networking tests from test-network-modules * Networking transport settings - group_vars * Network playbooks * Debug should be off by default * Update nxos.yaml * Remove items from top level * Use dependencies, not pre-tasks * Remove trailing blank lines * Remove backup files * newlines --- .../dellos10_command/tests/cli/bad_operator.yaml | 20 +++++++++++++++ .../dellos10_command/tests/cli/contains.yaml | 20 +++++++++++++++ .../dellos10_command/tests/cli/invalid.yaml | 28 +++++++++++++++++++++ .../targets/dellos10_command/tests/cli/output.yaml | 29 ++++++++++++++++++++++ .../dellos10_command/tests/cli/timeout.yaml | 19 ++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 test/integration/targets/dellos10_command/tests/cli/bad_operator.yaml create mode 100644 test/integration/targets/dellos10_command/tests/cli/contains.yaml create mode 100644 test/integration/targets/dellos10_command/tests/cli/invalid.yaml create mode 100644 test/integration/targets/dellos10_command/tests/cli/output.yaml create mode 100644 test/integration/targets/dellos10_command/tests/cli/timeout.yaml (limited to 'test/integration/targets/dellos10_command/tests') diff --git a/test/integration/targets/dellos10_command/tests/cli/bad_operator.yaml b/test/integration/targets/dellos10_command/tests/cli/bad_operator.yaml new file mode 100644 index 0000000000..ae77680b41 --- /dev/null +++ b/test/integration/targets/dellos10_command/tests/cli/bad_operator.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/bad_operator.yaml" + +- name: test bad operator + dellos10_command: + commands: + - show version + - show interface ethernet 1/1/1 + wait_for: + - "result[0] contains 'Description : blah'" + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/bad_operator.yaml" diff --git a/test/integration/targets/dellos10_command/tests/cli/contains.yaml b/test/integration/targets/dellos10_command/tests/cli/contains.yaml new file mode 100644 index 0000000000..c62488b904 --- /dev/null +++ b/test/integration/targets/dellos10_command/tests/cli/contains.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/contains.yaml" + +- name: test contains operator + dellos10_command: + commands: + - show version + - show interface ethernet 1/1/1 + wait_for: + - "result[0] contains OS10-Premium" + - "result[1] contains Ethernet " + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/contains.yaml" diff --git a/test/integration/targets/dellos10_command/tests/cli/invalid.yaml b/test/integration/targets/dellos10_command/tests/cli/invalid.yaml new file mode 100644 index 0000000000..14b24b4cbc --- /dev/null +++ b/test/integration/targets/dellos10_command/tests/cli/invalid.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/invalid.yaml" + +- name: run invalid command + dellos10_command: + commands: ['show foo'] + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "'Error: Unrecognized command' in result.stdout" + +- name: run commands that include invalid command + dellos10_command: + commands: + - show version + - show foo + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "'Error: Unrecognized command' in result.stdout" + +- debug: msg="END cli/invalid.yaml" diff --git a/test/integration/targets/dellos10_command/tests/cli/output.yaml b/test/integration/targets/dellos10_command/tests/cli/output.yaml new file mode 100644 index 0000000000..4df528a711 --- /dev/null +++ b/test/integration/targets/dellos10_command/tests/cli/output.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START cli/output.yaml" + +- name: get output for single command + dellos10_command: + commands: ['show version'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: get output for multiple commands + dellos10_command: + commands: + - show version + - show interface Eth 1/1/1 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + - "result.stdout | length == 2" + +- debug: msg="END cli/output.yaml" diff --git a/test/integration/targets/dellos10_command/tests/cli/timeout.yaml b/test/integration/targets/dellos10_command/tests/cli/timeout.yaml new file mode 100644 index 0000000000..50d870a0e5 --- /dev/null +++ b/test/integration/targets/dellos10_command/tests/cli/timeout.yaml @@ -0,0 +1,19 @@ +--- +- debug: msg="START cli/timeout.yaml" + +- name: test bad condition + dellos10_command: + commands: + - show version + wait_for: + - "result[0] contains bad_value_string" + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/timeout.yaml" -- cgit v1.2.1