summaryrefslogtreecommitdiff
path: root/test/integration/targets/eos_user
diff options
context:
space:
mode:
authorNathaniel Case <this.is@nathanielca.se>2017-12-19 15:49:49 -0500
committerGitHub <noreply@github.com>2017-12-19 15:49:49 -0500
commit513c75079edbe3d51702f87697efface2ce91236 (patch)
treeb096264e86ea4ec10ee037a1e747070b72eec967 /test/integration/targets/eos_user
parentf64b276f6ab2cc5bc85f7ad929aaca59a9e6e53e (diff)
downloadansible-513c75079edbe3d51702f87697efface2ce91236.tar.gz
Port eos tests to network_cli (#33586)
* Add eos and fix tests to run multiple connections * Update tests to report connection * Add missing START messages * Fix unspecified connection * Python 3 updates Exceptions don't have `.message` in Python 3 * Override `become` when using `connection=local` * Slight restructuring to make eapi easier later on * Move eapi toggle to prepare_eos * Pull out connection on eapi tasks
Diffstat (limited to 'test/integration/targets/eos_user')
-rw-r--r--test/integration/targets/eos_user/tasks/cli.yaml11
-rw-r--r--test/integration/targets/eos_user/tasks/eapi.yaml18
-rw-r--r--test/integration/targets/eos_user/tests/cli/auth.yaml2
-rw-r--r--test/integration/targets/eos_user/tests/cli/basic.yaml9
4 files changed, 23 insertions, 17 deletions
diff --git a/test/integration/targets/eos_user/tasks/cli.yaml b/test/integration/targets/eos_user/tasks/cli.yaml
index d675462dd0..a6f7ae0351 100644
--- a/test/integration/targets/eos_user/tasks/cli.yaml
+++ b/test/integration/targets/eos_user/tasks/cli.yaml
@@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
+ delegate_to: localhost
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
-- name: run test case
- include: "{{ test_case_to_run }}"
+- name: run test cases (connection=network_cli)
+ include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
+
+- name: run test case (connection=local)
+ include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
+ with_first_found: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/test/integration/targets/eos_user/tasks/eapi.yaml b/test/integration/targets/eos_user/tasks/eapi.yaml
index 00a159a98e..bda1df677a 100644
--- a/test/integration/targets/eos_user/tasks/eapi.yaml
+++ b/test/integration/targets/eos_user/tasks/eapi.yaml
@@ -3,26 +3,14 @@
find:
paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml"
+ delegate_to: localhost
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
-- name: enable eapi
- eos_eapi:
- http: yes
- https: yes
- local_http: no
- enable_socket: yes
- provider: "{{ cli }}"
-
-- name: run test case
- include: "{{ test_case_to_run }}"
+- name: run test case (connection=local)
+ include: "{{ test_case_to_run }} ansible_connection=local"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
-
-- name: disable eapi
- eos_eapi:
- state: stopped
- provider: "{{ cli }}"
diff --git a/test/integration/targets/eos_user/tests/cli/auth.yaml b/test/integration/targets/eos_user/tests/cli/auth.yaml
index 4da4a5dd56..04e6c90e1a 100644
--- a/test/integration/targets/eos_user/tests/cli/auth.yaml
+++ b/test/integration/targets/eos_user/tests/cli/auth.yaml
@@ -9,6 +9,7 @@
authorize: yes
provider: "{{ cli }}"
configured_password: pass123
+ become: yes
- name: test login
expect:
@@ -36,4 +37,5 @@
state: absent
provider: "{{ cli }}"
authorize: yes
+ become: yes
register: result
diff --git a/test/integration/targets/eos_user/tests/cli/basic.yaml b/test/integration/targets/eos_user/tests/cli/basic.yaml
index 381f25b4c7..0efee72ff5 100644
--- a/test/integration/targets/eos_user/tests/cli/basic.yaml
+++ b/test/integration/targets/eos_user/tests/cli/basic.yaml
@@ -1,4 +1,6 @@
---
+- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
+
- name: Set Up
eos_config:
lines:
@@ -7,6 +9,7 @@
- no username ansibletest3
- no username ansibletest4
provider: "{{ cli }}"
+ become: yes
- name: Create user with role
eos_user:
@@ -17,6 +20,7 @@
configured_password: test1
authorize: yes
provider: "{{ cli }}"
+ become: yes
register: result
- assert:
@@ -36,6 +40,7 @@
authorize: yes
update_password: on_create
provider: "{{ cli }}"
+ become: yes
register: result
- assert:
@@ -54,6 +59,7 @@
state: present
role: network-operator
provider: "{{ cli }}"
+ become: yes
register: result
- assert:
@@ -73,6 +79,7 @@
state: present
authorize: yes
provider: "{{ cli }}"
+ become: yes
ignore_errors: yes
register: result
@@ -90,3 +97,5 @@
- no username ansibletest3
- no username ansibletest4
provider: "{{ cli }}"
+ authorize: yes
+ become: yes