mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-04 02:04:33 +02:00
Make EE ready. (#83)
This commit is contained in:
parent
e22433b179
commit
30afb61f86
8 changed files with 229 additions and 0 deletions
13
tests/ee/all.yml
Normal file
13
tests/ee/all.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
- hosts: localhost
|
||||
tasks:
|
||||
- name: Find all roles
|
||||
find:
|
||||
paths:
|
||||
- "{{ playbook_dir ~ '/roles/' }}"
|
||||
file_type: directory
|
||||
depth: 1
|
||||
register: result
|
||||
- name: Include all roles
|
||||
include_role:
|
||||
name: "{{ item }}"
|
||||
loop: "{{ result.files | map(attribute='path') | map('regex_replace', '.*/', '') | sort }}"
|
2
tests/ee/roles/filter_quoting/aliases
Normal file
2
tests/ee/roles/filter_quoting/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
shippable/posix/group1
|
||||
skip/python2.6
|
59
tests/ee/roles/filter_quoting/tasks/main.yml
Normal file
59
tests/ee/roles/filter_quoting/tasks/main.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
- name: "Test split filter"
|
||||
assert:
|
||||
that:
|
||||
- "'' | community.routeros.split == []"
|
||||
- "'foo bar' | community.routeros.split == ['foo', 'bar']"
|
||||
- >
|
||||
'foo bar="a b c"' | community.routeros.split == ['foo', 'bar=a b c']
|
||||
|
||||
- name: "Test split filter error handling"
|
||||
set_fact:
|
||||
test: >-
|
||||
{{ 'a="' | community.routeros.split }}
|
||||
ignore_errors: true
|
||||
register: result
|
||||
|
||||
- name: "Verify split filter error handling"
|
||||
assert:
|
||||
that:
|
||||
- >-
|
||||
result.msg == "Unexpected end of string during escaped parameter"
|
||||
|
||||
- name: "Test quote_argument filter"
|
||||
assert:
|
||||
that:
|
||||
- >
|
||||
'a=' | community.routeros.quote_argument == 'a=""'
|
||||
- >
|
||||
'a=b' | community.routeros.quote_argument == 'a=b'
|
||||
- >
|
||||
'a=b c' | community.routeros.quote_argument == 'a="b c"'
|
||||
- >
|
||||
'a=""' | community.routeros.quote_argument == 'a="\\"\\""'
|
||||
|
||||
- name: "Test quote_argument_value filter"
|
||||
assert:
|
||||
that:
|
||||
- >
|
||||
'' | community.routeros.quote_argument_value == '""'
|
||||
- >
|
||||
'foo' | community.routeros.quote_argument_value == 'foo'
|
||||
- >
|
||||
'"foo bar"' | community.routeros.quote_argument_value == '"\\"foo bar\\""'
|
||||
|
||||
- name: "Test join filter"
|
||||
assert:
|
||||
that:
|
||||
- >
|
||||
['a=', 'b=c d'] | community.routeros.join == 'a="" b="c d"'
|
||||
|
||||
- name: "Test list_to_dict filter"
|
||||
assert:
|
||||
that:
|
||||
- >
|
||||
['a=', 'b=c'] | community.routeros.list_to_dict == {'a': '', 'b': 'c'}
|
||||
- >
|
||||
['a=', 'b=c'] | community.routeros.list_to_dict(skip_empty_values=True) == {'b': 'c'}
|
||||
- >
|
||||
['a', 'b=c'] | community.routeros.list_to_dict(require_assignment=False) == {'a': none, 'b': 'c'}
|
35
tests/ee/roles/smoke/tasks/main.yml
Normal file
35
tests/ee/roles/smoke/tasks/main.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
- name: Run api module
|
||||
community.routeros.api:
|
||||
username: foo
|
||||
password: bar
|
||||
hostname: localhost
|
||||
path: ip address
|
||||
ignore_errors: true
|
||||
register: result
|
||||
|
||||
- name: Validate result
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'error: [Errno 111] Connection refused' in result.msg"
|
||||
|
||||
- name: Run command module
|
||||
community.routeros.command:
|
||||
commands:
|
||||
- /ip address print
|
||||
vars:
|
||||
ansible_host: localhost
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
ansible_network_os: community.routeros.routeros
|
||||
ansible_user: foo
|
||||
ansible_ssh_pass: bar
|
||||
ansible_ssh_port: 12349
|
||||
ignore_errors: true
|
||||
register: result
|
||||
|
||||
- name: Validate result
|
||||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'Unable to connect to port 12349 ' in result.msg"
|
Loading…
Add table
Add a link
Reference in a new issue