summaryrefslogtreecommitdiff
path: root/test/integration/targets/asa_command/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/asa_command/tests')
-rw-r--r--test/integration/targets/asa_command/tests/cli/bad_operator.yaml20
-rw-r--r--test/integration/targets/asa_command/tests/cli/contains.yaml20
-rw-r--r--test/integration/targets/asa_command/tests/cli/invalid.yaml30
-rw-r--r--test/integration/targets/asa_command/tests/cli/output.yaml29
-rw-r--r--test/integration/targets/asa_command/tests/cli/timeout.yaml19
5 files changed, 118 insertions, 0 deletions
diff --git a/test/integration/targets/asa_command/tests/cli/bad_operator.yaml b/test/integration/targets/asa_command/tests/cli/bad_operator.yaml
new file mode 100644
index 0000000000..bcbe8bb592
--- /dev/null
+++ b/test/integration/targets/asa_command/tests/cli/bad_operator.yaml
@@ -0,0 +1,20 @@
+---
+- debug: msg="START cli/bad_operator.yaml"
+
+- name: test bad operator
+ asa_command:
+ commands:
+ - show version
+ - show interfaces GigabitEthernet 0/0
+ wait_for:
+ - result[0] contains 'Description: Foo'
+ 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/asa_command/tests/cli/contains.yaml b/test/integration/targets/asa_command/tests/cli/contains.yaml
new file mode 100644
index 0000000000..c08d89c273
--- /dev/null
+++ b/test/integration/targets/asa_command/tests/cli/contains.yaml
@@ -0,0 +1,20 @@
+---
+- debug: msg="START cli/contains.yaml"
+
+- name: test contains operator
+ asa_command:
+ commands:
+ - show version
+ - show interface
+ wait_for:
+ - "result[0] contains 'Cisco Adaptive Security Appliance Software Version'"
+ - "result[1] contains 'Hardware'"
+ 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/asa_command/tests/cli/invalid.yaml b/test/integration/targets/asa_command/tests/cli/invalid.yaml
new file mode 100644
index 0000000000..67730968d4
--- /dev/null
+++ b/test/integration/targets/asa_command/tests/cli/invalid.yaml
@@ -0,0 +1,30 @@
+---
+- debug: msg="START cli/invalid.yaml"
+
+- name: run invalid command
+ asa_command:
+ commands: ['show foo']
+ provider: "{{ cli }}"
+ register: result
+ ignore_errors: yes
+
+- assert:
+ that:
+ - "result.failed"
+
+- name: run commands that include invalid command
+ asa_command:
+ commands:
+ - show version
+ - show foo
+ provider: "{{ cli }}"
+ register: result
+ ignore_errors: yes
+
+- assert:
+ that:
+ - "result.failed"
+# FIXME bug https://github.com/ansible/ansible-modules-extras/issues/3048
+ ignore_errors: true
+
+- debug: msg="END cli/invalid.yaml"
diff --git a/test/integration/targets/asa_command/tests/cli/output.yaml b/test/integration/targets/asa_command/tests/cli/output.yaml
new file mode 100644
index 0000000000..ccfb75375f
--- /dev/null
+++ b/test/integration/targets/asa_command/tests/cli/output.yaml
@@ -0,0 +1,29 @@
+---
+- debug: msg="START cli/output.yaml"
+
+- name: get output for single command
+ asa_command:
+ commands: ['show version']
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.stdout is defined"
+
+- name: get output for multiple commands
+ asa_command:
+ commands:
+ - show version
+ - show interface
+ 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/asa_command/tests/cli/timeout.yaml b/test/integration/targets/asa_command/tests/cli/timeout.yaml
new file mode 100644
index 0000000000..2387058a86
--- /dev/null
+++ b/test/integration/targets/asa_command/tests/cli/timeout.yaml
@@ -0,0 +1,19 @@
+---
+- debug: msg="START cli/timeout.yaml"
+
+- name: test bad condition
+ asa_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"