summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/lookup_fileglob
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2020-07-09 19:56:28 +0200
committerMatt Clay <matt@mystile.com>2020-07-09 21:28:06 +0200
commitbbd8f15a58c050a7df5966b55013a05e44c72607 (patch)
treee4a2ffc73d4d3148ae7aa5f296ba860c6a7bfeda /test/integration/targets/lookup_fileglob
parentFix decrypt argument in assemble module (#70465) (diff)
downloadansible-bbd8f15a58c050a7df5966b55013a05e44c72607.tar.xz
ansible-bbd8f15a58c050a7df5966b55013a05e44c72607.zip
Correct name of fileglob lookup integration test.
Diffstat (limited to 'test/integration/targets/lookup_fileglob')
-rw-r--r--test/integration/targets/lookup_fileglob/aliases1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/files/play_adj_subdir.txt1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/files/somepath/play_adj_subsubdir.txt1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/play.yml13
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/play_adj.txt1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/in_role.txt1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/otherpath/in_role_subdir.txt1
-rw-r--r--test/integration/targets/lookup_fileglob/find_levels/roles/get_file/tasks/main.yml10
-rw-r--r--test/integration/targets/lookup_fileglob/non_existent/play.yml6
-rwxr-xr-xtest/integration/targets/lookup_fileglob/runme.sh15
10 files changed, 50 insertions, 0 deletions
diff --git a/test/integration/targets/lookup_fileglob/aliases b/test/integration/targets/lookup_fileglob/aliases
new file mode 100644
index 0000000000..a6dafcf8cd
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/aliases
@@ -0,0 +1 @@
+shippable/posix/group1
diff --git a/test/integration/targets/lookup_fileglob/find_levels/files/play_adj_subdir.txt b/test/integration/targets/lookup_fileglob/find_levels/files/play_adj_subdir.txt
new file mode 100644
index 0000000000..5025588071
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/files/play_adj_subdir.txt
@@ -0,0 +1 @@
+in files subdir adjacent to play
diff --git a/test/integration/targets/lookup_fileglob/find_levels/files/somepath/play_adj_subsubdir.txt b/test/integration/targets/lookup_fileglob/find_levels/files/somepath/play_adj_subsubdir.txt
new file mode 100644
index 0000000000..96c7a54936
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/files/somepath/play_adj_subsubdir.txt
@@ -0,0 +1 @@
+in play adjacent subdir of files/
diff --git a/test/integration/targets/lookup_fileglob/find_levels/play.yml b/test/integration/targets/lookup_fileglob/find_levels/play.yml
new file mode 100644
index 0000000000..4bdee05de3
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/play.yml
@@ -0,0 +1,13 @@
+- hosts: localhost
+ gather_facts: false
+ vars:
+ expected:
+ play_adj: ajectent to play
+ play_adj_subdir: in files subdir adjacent to play
+ somepath/play_adj_subsubdir: in play adjacent subdir of files/
+ in_role: file in role
+ otherpath/in_role_subdir: file in role subdir
+ tasks:
+ - name: Import role lookup
+ import_role:
+ name: get_file
diff --git a/test/integration/targets/lookup_fileglob/find_levels/play_adj.txt b/test/integration/targets/lookup_fileglob/find_levels/play_adj.txt
new file mode 100644
index 0000000000..14f0cf502b
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/play_adj.txt
@@ -0,0 +1 @@
+ajectent to play
diff --git a/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/in_role.txt b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/in_role.txt
new file mode 100644
index 0000000000..fdfc9476c8
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/in_role.txt
@@ -0,0 +1 @@
+file in role
diff --git a/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/otherpath/in_role_subdir.txt b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/otherpath/in_role_subdir.txt
new file mode 100644
index 0000000000..40e75a40db
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/otherpath/in_role_subdir.txt
@@ -0,0 +1 @@
+file in role subdir
diff --git a/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/tasks/main.yml b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/tasks/main.yml
new file mode 100644
index 0000000000..2fc21df70d
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/find_levels/roles/get_file/tasks/main.yml
@@ -0,0 +1,10 @@
+- name: show file contents
+ debug:
+ msg: '{{ q("fileglob", seed + ".*") }}'
+ register: found
+
+- name: did we get right one?
+ assert:
+ that:
+ - found['msg'][0].endswith(seed + '.txt')
+ - q('file', found['msg'][0])[0] == expected[seed]
diff --git a/test/integration/targets/lookup_fileglob/non_existent/play.yml b/test/integration/targets/lookup_fileglob/non_existent/play.yml
new file mode 100644
index 0000000000..e92dff5acc
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/non_existent/play.yml
@@ -0,0 +1,6 @@
+- hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: fileglob should be empty
+ assert:
+ that: q("fileglob", seed) | length == 0
diff --git a/test/integration/targets/lookup_fileglob/runme.sh b/test/integration/targets/lookup_fileglob/runme.sh
new file mode 100755
index 0000000000..1e0297c79d
--- /dev/null
+++ b/test/integration/targets/lookup_fileglob/runme.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -eux
+
+# fun multilevel finds
+for seed in play_adj play_adj_subdir somepath/play_adj_subsubdir in_role otherpath/in_role_subdir
+do
+ ansible-playbook find_levels/play.yml -e "seed='${seed}'" "$@"
+done
+
+# non-existent paths
+for seed in foo foo/bar foo/bar/baz
+do
+ ansible-playbook non_existent/play.yml -e "seed='${seed}'" "$@"
+done