summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <mclay@redhat.com>2020-01-30 12:49:54 -0800
committerGitHub <noreply@github.com>2020-01-30 12:49:54 -0800
commit4452f506a84a78c90d8207a5e50b8fb3e6f7ba96 (patch)
treedc85065a797bea2129a37650817ee4f4561d77d4
parent5112feeace0079266ce9bfa7ed226b4b6561496f (diff)
downloadansible-4452f506a84a78c90d8207a5e50b8fb3e6f7ba96.tar.gz
Split up filter integration tests. (#66962)
* Split out json_query filter tests. * Split out urlsplit filter tests. * Split out ipaddr filter tests. * Split out urls filter tests. * Split out mathstuff filter tests. * Clean up core filter tests.
-rw-r--r--test/integration/targets/filter_core/aliases (renamed from test/integration/targets/filters/aliases)0
-rw-r--r--test/integration/targets/filter_core/files/9851.txt (renamed from test/integration/targets/filters/files/9851.txt)0
-rw-r--r--test/integration/targets/filter_core/files/fileglob/one.txt (renamed from test/integration/targets/filters/files/fileglob/one.txt)0
-rw-r--r--test/integration/targets/filter_core/files/fileglob/two.txt (renamed from test/integration/targets/filters/files/fileglob/two.txt)0
-rw-r--r--test/integration/targets/filter_core/files/foo.txt (renamed from test/integration/targets/filters/files/foo.txt)0
-rw-r--r--test/integration/targets/filter_core/host_vars/localhost (renamed from test/integration/targets/filters/host_vars/localhost)0
-rwxr-xr-xtest/integration/targets/filter_core/runme.sh5
-rw-r--r--test/integration/targets/filter_core/runme.yml3
-rw-r--r--test/integration/targets/filter_core/tasks/main.yml (renamed from test/integration/targets/filters/tasks/main.yml)126
-rw-r--r--test/integration/targets/filter_core/templates/foo.j2 (renamed from test/integration/targets/filters/templates/foo.j2)0
-rw-r--r--test/integration/targets/filter_core/templates/py26json.j2 (renamed from test/integration/targets/filters/templates/py26json.j2)0
-rw-r--r--test/integration/targets/filter_core/vars/main.yml (renamed from test/integration/targets/filters/vars/main.yml)12
-rw-r--r--test/integration/targets/filter_ipaddr/aliases3
-rwxr-xr-xtest/integration/targets/filter_ipaddr/runme.sh (renamed from test/integration/targets/filters/runme.sh)4
-rw-r--r--test/integration/targets/filter_ipaddr/runme.yml3
-rw-r--r--test/integration/targets/filter_ipaddr/tasks/main.yml23
-rw-r--r--test/integration/targets/filter_json_query/aliases3
-rwxr-xr-xtest/integration/targets/filter_json_query/runme.sh12
-rw-r--r--test/integration/targets/filter_json_query/runme.yml3
-rw-r--r--test/integration/targets/filter_json_query/tasks/main.yml4
-rw-r--r--test/integration/targets/filter_json_query/vars/main.yml11
-rw-r--r--test/integration/targets/filter_mathstuff/aliases3
-rw-r--r--test/integration/targets/filter_mathstuff/tasks/main.yml51
-rw-r--r--test/integration/targets/filter_urls/aliases3
-rw-r--r--test/integration/targets/filter_urls/tasks/main.yml12
-rw-r--r--test/integration/targets/filter_urlsplit/aliases3
-rw-r--r--test/integration/targets/filter_urlsplit/tasks/main.yml30
-rw-r--r--test/integration/targets/filters/filters.yml4
-rw-r--r--test/integration/targets/filters/meta/main.yml2
29 files changed, 174 insertions, 146 deletions
diff --git a/test/integration/targets/filters/aliases b/test/integration/targets/filter_core/aliases
index 1603f4351b..1603f4351b 100644
--- a/test/integration/targets/filters/aliases
+++ b/test/integration/targets/filter_core/aliases
diff --git a/test/integration/targets/filters/files/9851.txt b/test/integration/targets/filter_core/files/9851.txt
index 70b12793e1..70b12793e1 100644
--- a/test/integration/targets/filters/files/9851.txt
+++ b/test/integration/targets/filter_core/files/9851.txt
diff --git a/test/integration/targets/filters/files/fileglob/one.txt b/test/integration/targets/filter_core/files/fileglob/one.txt
index e69de29bb2..e69de29bb2 100644
--- a/test/integration/targets/filters/files/fileglob/one.txt
+++ b/test/integration/targets/filter_core/files/fileglob/one.txt
diff --git a/test/integration/targets/filters/files/fileglob/two.txt b/test/integration/targets/filter_core/files/fileglob/two.txt
index e69de29bb2..e69de29bb2 100644
--- a/test/integration/targets/filters/files/fileglob/two.txt
+++ b/test/integration/targets/filter_core/files/fileglob/two.txt
diff --git a/test/integration/targets/filters/files/foo.txt b/test/integration/targets/filter_core/files/foo.txt
index a5839cee95..a5839cee95 100644
--- a/test/integration/targets/filters/files/foo.txt
+++ b/test/integration/targets/filter_core/files/foo.txt
diff --git a/test/integration/targets/filters/host_vars/localhost b/test/integration/targets/filter_core/host_vars/localhost
index a8926a52d8..a8926a52d8 100644
--- a/test/integration/targets/filters/host_vars/localhost
+++ b/test/integration/targets/filter_core/host_vars/localhost
diff --git a/test/integration/targets/filter_core/runme.sh b/test/integration/targets/filter_core/runme.sh
new file mode 100755
index 0000000000..ac4361f3a4
--- /dev/null
+++ b/test/integration/targets/filter_core/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@"
diff --git a/test/integration/targets/filter_core/runme.yml b/test/integration/targets/filter_core/runme.yml
new file mode 100644
index 0000000000..4af4b23c42
--- /dev/null
+++ b/test/integration/targets/filter_core/runme.yml
@@ -0,0 +1,3 @@
+- hosts: localhost
+ roles:
+ - { role: filter_core }
diff --git a/test/integration/targets/filters/tasks/main.yml b/test/integration/targets/filter_core/tasks/main.yml
index 5bf52522cf..e14889eb23 100644
--- a/test/integration/targets/filters/tasks/main.yml
+++ b/test/integration/targets/filter_core/tasks/main.yml
@@ -61,42 +61,6 @@
that:
- 'diff_result.stdout == ""'
-- name: Verify human_readable
- tags: "human_readable"
- assert:
- that:
- - '"1.00 Bytes" == 1|human_readable'
- - '"1.00 bits" == 1|human_readable(isbits=True)'
- - '"10.00 KB" == 10240|human_readable'
- - '"97.66 MB" == 102400000|human_readable'
- - '"0.10 GB" == 102400000|human_readable(unit="G")'
- - '"0.10 Gb" == 102400000|human_readable(isbits=True, unit="G")'
-
-- name: Verify human_to_bytes
- tags: "human_to_bytes"
- assert:
- that:
- - "{{'0'|human_to_bytes}} == 0"
- - "{{'0.1'|human_to_bytes}} == 0"
- - "{{'0.9'|human_to_bytes}} == 1"
- - "{{'1'|human_to_bytes}} == 1"
- - "{{'10.00 KB'|human_to_bytes}} == 10240"
- - "{{ '11 MB'|human_to_bytes}} == 11534336"
- - "{{ '1.1 GB'|human_to_bytes}} == 1181116006"
- - "{{'10.00 Kb'|human_to_bytes(isbits=True)}} == 10240"
-
-- name: Verify human_to_bytes (bad string)
- set_fact:
- bad_string: "{{ '10.00 foo' | human_to_bytes }}"
- ignore_errors: yes
- tags: human_to_bytes
- register: _human_bytes_test
-
-- name: Verify human_to_bytes (bad string)
- tags: human_to_bytes
- assert:
- that: "{{_human_bytes_test.failed}}"
-
- name: Test extract
assert:
that:
@@ -139,62 +103,12 @@
- "'localhost' | extract(hostvars, ['badsubkey', 'subsubkey']) | default('a') == 'a'"
- "('localhost' | extract(hostvars, 'badsubkey')).subsubkey | default('a') == 'a'"
-- name: Test json_query filter
- assert:
- that:
- - "users | json_query('[*].hosts[].host') == ['host_a', 'host_b', 'host_c', 'host_d']"
-
- name: Test hash filter
assert:
that:
- '"{{ "hash" | hash("sha1") }}" == "2346ad27d7568ba9896f1b7da6b5991251debdf2"'
- '"{{ "café" | hash("sha1") }}" == "f424452a9673918c6f09b0cdd35b20be8e6ae7d7"'
-- debug:
- var: "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit"
- verbosity: 1
- tags: debug
-
-- name: Test urlsplit filter
- assert:
- that:
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('fragment') == 'fragment'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('hostname') == 'www.acme.com'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('netloc') == 'mary:MySecret@www.acme.com:9000'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('path') == '/dir/index.html'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('port') == 9000"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('query') == 'query=term'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('scheme') == 'http'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('username') == 'mary'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('password') == 'MySecret'"
- - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit == { 'fragment': 'fragment', 'hostname': 'www.acme.com', 'netloc': 'mary:MySecret@www.acme.com:9000', 'password': 'MySecret', 'path': '/dir/index.html', 'port': 9000, 'query': 'query=term', 'scheme': 'http', 'username': 'mary' }"
-
-
-- name: Test urlsplit filter bad argument
- debug:
- var: "'http://www.acme.com:9000/dir/index.html' | urlsplit('bad_filter')"
- register: _bad_urlsplit_filter
- ignore_errors: yes
-
-- name: Verify urlsplit filter showed an error message
- assert:
- that:
- - _bad_urlsplit_filter is failed
- - "'unknown URL component' in _bad_urlsplit_filter.msg"
-
-- name: Test urldecode filter
- set_fact:
- urldecoded_string: key="@{}é&%£ foo bar '(;\<>""°)
-
-- name: Test urlencode filter
- set_fact:
- urlencoded_string: '{{ urldecoded_string|urlencode }}'
-
-- name: Verify urlencode en urldecode
- assert:
- that:
- - urldecoded_string == urlencoded_string|urldecode
-
- name: Flatten tests
block:
- name: use flatten
@@ -274,46 +188,6 @@
- "'00:00:00' | random_mac(seed='test') == '00:00:00' | random_mac(seed='test')"
- "'00:00:00' | random_mac(seed='test') != '00:00:00' | random_mac(seed='another_test')"
-- name: Verify that union can be chained
- vars:
- unions: '{{ [1,2,3]|union([4,5])|union([6,7]) }}'
- assert:
- that:
- - "unions|type_debug == 'list'"
- - "unions|length == 7"
-
-- name: Test union with unhashable item
- vars:
- unions: '{{ [1,2,3]|union([{}]) }}'
- assert:
- that:
- - "unions|type_debug == 'list'"
- - "unions|length == 4"
-
-- name: Test ipaddr filter
- assert:
- that:
- - "'192.168.0.1/32' | ipaddr('netmask') == '255.255.255.255'"
- - "'192.168.0.1/24' | ipaddr('netmask') == '255.255.255.0'"
- - "not '192.168.0.1/31' | ipaddr('broadcast')"
- - "'192.168.0.1/24' | ipaddr('broadcast') == '192.168.0.255'"
- - "'192.168.0.1/24' | ipaddr('prefix') == 24"
- - "'192.168.0.1/24' | ipaddr('address') == '192.168.0.1'"
- - "'192.168.0.1/24' | ipaddr('network') == '192.168.0.0'"
- - "'fe80::dead:beef/64' | ipaddr('broadcast') == 'fe80::ffff:ffff:ffff:ffff'"
- - "'::1/120' | ipaddr('netmask') == 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00'"
- - "{{ subnets | ipaddr(1) }} == ['10.1.1.1/24', '10.1.2.1/24']"
- - "{{ subnets | ipaddr('1') }} == ['10.1.1.1/24', '10.1.2.1/24']"
- - "{{ subnets | ipaddr(-1) }} == ['10.1.1.255/24', '10.1.2.255/24']"
- - "{{ subnets | ipaddr('-1') }} == ['10.1.1.255/24', '10.1.2.255/24']"
- - "'{{ prefix | ipaddr(1) }}' == '10.1.1.1/24'"
- - "'{{ prefix | ipaddr('1') }}' == '10.1.1.1/24'"
- - "'{{ prefix | ipaddr('network') }}' == '10.1.1.0'"
- - "'{{ prefix | ipaddr('-1') }}' == '10.1.1.255/24'"
- vars:
- subnets: ['10.1.1.0/24', '10.1.2.0/24']
- prefix: '10.1.1.0/24'
-
- name: Ensure dict2items works with hostvars
debug:
msg: "{{ item.key }}"
diff --git a/test/integration/targets/filters/templates/foo.j2 b/test/integration/targets/filter_core/templates/foo.j2
index 55893cc132..55893cc132 100644
--- a/test/integration/targets/filters/templates/foo.j2
+++ b/test/integration/targets/filter_core/templates/foo.j2
diff --git a/test/integration/targets/filters/templates/py26json.j2 b/test/integration/targets/filter_core/templates/py26json.j2
index dba62ad17c..dba62ad17c 100644
--- a/test/integration/targets/filters/templates/py26json.j2
+++ b/test/integration/targets/filter_core/templates/py26json.j2
diff --git a/test/integration/targets/filters/vars/main.yml b/test/integration/targets/filter_core/vars/main.yml
index bd7ac68c3a..aedecd8f99 100644
--- a/test/integration/targets/filters/vars/main.yml
+++ b/test/integration/targets/filter_core/vars/main.yml
@@ -5,18 +5,6 @@ some_structure:
warp: 9
where: endor
-users:
- - name: steve
- hosts:
- - host: host_a
- password: abc
- - host: host_b
- - name: bill
- hosts:
- - host: host_c
- password: default
- - host: host_d
-
other_data:
level1:
foo: bar
diff --git a/test/integration/targets/filter_ipaddr/aliases b/test/integration/targets/filter_ipaddr/aliases
new file mode 100644
index 0000000000..1603f4351b
--- /dev/null
+++ b/test/integration/targets/filter_ipaddr/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group2
+skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
+skip/aix
diff --git a/test/integration/targets/filters/runme.sh b/test/integration/targets/filter_ipaddr/runme.sh
index 2266ba3cc5..d498a5fc67 100755
--- a/test/integration/targets/filters/runme.sh
+++ b/test/integration/targets/filter_ipaddr/runme.sh
@@ -7,6 +7,6 @@ source virtualenv.sh
# Requirements have to be installed prior to running ansible-playbook
# because plugins and requirements are loaded before the task runs
-pip install jmespath netaddr
+pip install netaddr
-ANSIBLE_ROLES_PATH=../ ansible-playbook filters.yml "$@"
+ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@"
diff --git a/test/integration/targets/filter_ipaddr/runme.yml b/test/integration/targets/filter_ipaddr/runme.yml
new file mode 100644
index 0000000000..d2c5bda732
--- /dev/null
+++ b/test/integration/targets/filter_ipaddr/runme.yml
@@ -0,0 +1,3 @@
+- hosts: localhost
+ roles:
+ - { role: filter_ipaddr }
diff --git a/test/integration/targets/filter_ipaddr/tasks/main.yml b/test/integration/targets/filter_ipaddr/tasks/main.yml
new file mode 100644
index 0000000000..c0fde7ced8
--- /dev/null
+++ b/test/integration/targets/filter_ipaddr/tasks/main.yml
@@ -0,0 +1,23 @@
+- name: Test ipaddr filter
+ assert:
+ that:
+ - "'192.168.0.1/32' | ipaddr('netmask') == '255.255.255.255'"
+ - "'192.168.0.1/24' | ipaddr('netmask') == '255.255.255.0'"
+ - "not '192.168.0.1/31' | ipaddr('broadcast')"
+ - "'192.168.0.1/24' | ipaddr('broadcast') == '192.168.0.255'"
+ - "'192.168.0.1/24' | ipaddr('prefix') == 24"
+ - "'192.168.0.1/24' | ipaddr('address') == '192.168.0.1'"
+ - "'192.168.0.1/24' | ipaddr('network') == '192.168.0.0'"
+ - "'fe80::dead:beef/64' | ipaddr('broadcast') == 'fe80::ffff:ffff:ffff:ffff'"
+ - "'::1/120' | ipaddr('netmask') == 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00'"
+ - "{{ subnets | ipaddr(1) }} == ['10.1.1.1/24', '10.1.2.1/24']"
+ - "{{ subnets | ipaddr('1') }} == ['10.1.1.1/24', '10.1.2.1/24']"
+ - "{{ subnets | ipaddr(-1) }} == ['10.1.1.255/24', '10.1.2.255/24']"
+ - "{{ subnets | ipaddr('-1') }} == ['10.1.1.255/24', '10.1.2.255/24']"
+ - "'{{ prefix | ipaddr(1) }}' == '10.1.1.1/24'"
+ - "'{{ prefix | ipaddr('1') }}' == '10.1.1.1/24'"
+ - "'{{ prefix | ipaddr('network') }}' == '10.1.1.0'"
+ - "'{{ prefix | ipaddr('-1') }}' == '10.1.1.255/24'"
+ vars:
+ subnets: ['10.1.1.0/24', '10.1.2.0/24']
+ prefix: '10.1.1.0/24'
diff --git a/test/integration/targets/filter_json_query/aliases b/test/integration/targets/filter_json_query/aliases
new file mode 100644
index 0000000000..1603f4351b
--- /dev/null
+++ b/test/integration/targets/filter_json_query/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group2
+skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
+skip/aix
diff --git a/test/integration/targets/filter_json_query/runme.sh b/test/integration/targets/filter_json_query/runme.sh
new file mode 100755
index 0000000000..a0db5e5400
--- /dev/null
+++ b/test/integration/targets/filter_json_query/runme.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -eux
+
+source virtualenv.sh
+
+# Requirements have to be installed prior to running ansible-playbook
+# because plugins and requirements are loaded before the task runs
+
+pip install jmespath
+
+ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@"
diff --git a/test/integration/targets/filter_json_query/runme.yml b/test/integration/targets/filter_json_query/runme.yml
new file mode 100644
index 0000000000..68f6372c2f
--- /dev/null
+++ b/test/integration/targets/filter_json_query/runme.yml
@@ -0,0 +1,3 @@
+- hosts: localhost
+ roles:
+ - { role: filter_json_query }
diff --git a/test/integration/targets/filter_json_query/tasks/main.yml b/test/integration/targets/filter_json_query/tasks/main.yml
new file mode 100644
index 0000000000..02ad2f87ec
--- /dev/null
+++ b/test/integration/targets/filter_json_query/tasks/main.yml
@@ -0,0 +1,4 @@
+- name: Test json_query filter
+ assert:
+ that:
+ - "users | json_query('[*].hosts[].host') == ['host_a', 'host_b', 'host_c', 'host_d']"
diff --git a/test/integration/targets/filter_json_query/vars/main.yml b/test/integration/targets/filter_json_query/vars/main.yml
new file mode 100644
index 0000000000..36964115b4
--- /dev/null
+++ b/test/integration/targets/filter_json_query/vars/main.yml
@@ -0,0 +1,11 @@
+users:
+ - name: steve
+ hosts:
+ - host: host_a
+ password: abc
+ - host: host_b
+ - name: bill
+ hosts:
+ - host: host_c
+ password: default
+ - host: host_d
diff --git a/test/integration/targets/filter_mathstuff/aliases b/test/integration/targets/filter_mathstuff/aliases
new file mode 100644
index 0000000000..1603f4351b
--- /dev/null
+++ b/test/integration/targets/filter_mathstuff/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group2
+skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
+skip/aix
diff --git a/test/integration/targets/filter_mathstuff/tasks/main.yml b/test/integration/targets/filter_mathstuff/tasks/main.yml
new file mode 100644
index 0000000000..ffd2cad051
--- /dev/null
+++ b/test/integration/targets/filter_mathstuff/tasks/main.yml
@@ -0,0 +1,51 @@
+- name: Verify human_readable
+ tags: "human_readable"
+ assert:
+ that:
+ - '"1.00 Bytes" == 1|human_readable'
+ - '"1.00 bits" == 1|human_readable(isbits=True)'
+ - '"10.00 KB" == 10240|human_readable'
+ - '"97.66 MB" == 102400000|human_readable'
+ - '"0.10 GB" == 102400000|human_readable(unit="G")'
+ - '"0.10 Gb" == 102400000|human_readable(isbits=True, unit="G")'
+
+- name: Verify human_to_bytes
+ tags: "human_to_bytes"
+ assert:
+ that:
+ - "{{'0'|human_to_bytes}} == 0"
+ - "{{'0.1'|human_to_bytes}} == 0"
+ - "{{'0.9'|human_to_bytes}} == 1"
+ - "{{'1'|human_to_bytes}} == 1"
+ - "{{'10.00 KB'|human_to_bytes}} == 10240"
+ - "{{ '11 MB'|human_to_bytes}} == 11534336"
+ - "{{ '1.1 GB'|human_to_bytes}} == 1181116006"
+ - "{{'10.00 Kb'|human_to_bytes(isbits=True)}} == 10240"
+
+- name: Verify human_to_bytes (bad string)
+ set_fact:
+ bad_string: "{{ '10.00 foo' | human_to_bytes }}"
+ ignore_errors: yes
+ tags: human_to_bytes
+ register: _human_bytes_test
+
+- name: Verify human_to_bytes (bad string)
+ tags: human_to_bytes
+ assert:
+ that: "{{_human_bytes_test.failed}}"
+
+- name: Verify that union can be chained
+ vars:
+ unions: '{{ [1,2,3]|union([4,5])|union([6,7]) }}'
+ assert:
+ that:
+ - "unions|type_debug == 'list'"
+ - "unions|length == 7"
+
+- name: Test union with unhashable item
+ vars:
+ unions: '{{ [1,2,3]|union([{}]) }}'
+ assert:
+ that:
+ - "unions|type_debug == 'list'"
+ - "unions|length == 4"
diff --git a/test/integration/targets/filter_urls/aliases b/test/integration/targets/filter_urls/aliases
new file mode 100644
index 0000000000..1603f4351b
--- /dev/null
+++ b/test/integration/targets/filter_urls/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group2
+skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
+skip/aix
diff --git a/test/integration/targets/filter_urls/tasks/main.yml b/test/integration/targets/filter_urls/tasks/main.yml
new file mode 100644
index 0000000000..59d55d9092
--- /dev/null
+++ b/test/integration/targets/filter_urls/tasks/main.yml
@@ -0,0 +1,12 @@
+- name: Test urldecode filter
+ set_fact:
+ urldecoded_string: key="@{}é&%£ foo bar '(;\<>""°)
+
+- name: Test urlencode filter
+ set_fact:
+ urlencoded_string: '{{ urldecoded_string|urlencode }}'
+
+- name: Verify urlencode en urldecode
+ assert:
+ that:
+ - urldecoded_string == urlencoded_string|urldecode
diff --git a/test/integration/targets/filter_urlsplit/aliases b/test/integration/targets/filter_urlsplit/aliases
new file mode 100644
index 0000000000..1603f4351b
--- /dev/null
+++ b/test/integration/targets/filter_urlsplit/aliases
@@ -0,0 +1,3 @@
+shippable/posix/group2
+skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
+skip/aix
diff --git a/test/integration/targets/filter_urlsplit/tasks/main.yml b/test/integration/targets/filter_urlsplit/tasks/main.yml
new file mode 100644
index 0000000000..c3ff3ec943
--- /dev/null
+++ b/test/integration/targets/filter_urlsplit/tasks/main.yml
@@ -0,0 +1,30 @@
+- debug:
+ var: "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit"
+ verbosity: 1
+ tags: debug
+
+- name: Test urlsplit filter
+ assert:
+ that:
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('fragment') == 'fragment'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('hostname') == 'www.acme.com'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('netloc') == 'mary:MySecret@www.acme.com:9000'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('path') == '/dir/index.html'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('port') == 9000"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('query') == 'query=term'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('scheme') == 'http'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('username') == 'mary'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit('password') == 'MySecret'"
+ - "'http://mary:MySecret@www.acme.com:9000/dir/index.html?query=term#fragment' | urlsplit == { 'fragment': 'fragment', 'hostname': 'www.acme.com', 'netloc': 'mary:MySecret@www.acme.com:9000', 'password': 'MySecret', 'path': '/dir/index.html', 'port': 9000, 'query': 'query=term', 'scheme': 'http', 'username': 'mary' }"
+
+- name: Test urlsplit filter bad argument
+ debug:
+ var: "'http://www.acme.com:9000/dir/index.html' | urlsplit('bad_filter')"
+ register: _bad_urlsplit_filter
+ ignore_errors: yes
+
+- name: Verify urlsplit filter showed an error message
+ assert:
+ that:
+ - _bad_urlsplit_filter is failed
+ - "'unknown URL component' in _bad_urlsplit_filter.msg"
diff --git a/test/integration/targets/filters/filters.yml b/test/integration/targets/filters/filters.yml
deleted file mode 100644
index acac43bc64..0000000000
--- a/test/integration/targets/filters/filters.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-- hosts: localhost
- gather_facts: yes
- roles:
- - { role: filters }
diff --git a/test/integration/targets/filters/meta/main.yml b/test/integration/targets/filters/meta/main.yml
deleted file mode 100644
index 07faa21776..0000000000
--- a/test/integration/targets/filters/meta/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-dependencies:
- - prepare_tests