From bbd8f15a58c050a7df5966b55013a05e44c72607 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 9 Jul 2020 10:56:28 -0700 Subject: Correct name of fileglob lookup integration test. --- test/integration/targets/lookup_fileglob/aliases | 1 + .../lookup_fileglob/find_levels/files/play_adj_subdir.txt | 1 + .../find_levels/files/somepath/play_adj_subsubdir.txt | 1 + .../targets/lookup_fileglob/find_levels/play.yml | 13 +++++++++++++ .../targets/lookup_fileglob/find_levels/play_adj.txt | 1 + .../find_levels/roles/get_file/files/in_role.txt | 1 + .../roles/get_file/files/otherpath/in_role_subdir.txt | 1 + .../find_levels/roles/get_file/tasks/main.yml | 10 ++++++++++ .../targets/lookup_fileglob/non_existent/play.yml | 6 ++++++ test/integration/targets/lookup_fileglob/runme.sh | 15 +++++++++++++++ 10 files changed, 50 insertions(+) create mode 100644 test/integration/targets/lookup_fileglob/aliases create mode 100644 test/integration/targets/lookup_fileglob/find_levels/files/play_adj_subdir.txt create mode 100644 test/integration/targets/lookup_fileglob/find_levels/files/somepath/play_adj_subsubdir.txt create mode 100644 test/integration/targets/lookup_fileglob/find_levels/play.yml create mode 100644 test/integration/targets/lookup_fileglob/find_levels/play_adj.txt create mode 100644 test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/in_role.txt create mode 100644 test/integration/targets/lookup_fileglob/find_levels/roles/get_file/files/otherpath/in_role_subdir.txt create mode 100644 test/integration/targets/lookup_fileglob/find_levels/roles/get_file/tasks/main.yml create mode 100644 test/integration/targets/lookup_fileglob/non_existent/play.yml create mode 100755 test/integration/targets/lookup_fileglob/runme.sh (limited to 'test/integration/targets/lookup_fileglob') 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 -- cgit v1.2.3