From f06474ae4f51eab8d3860f0878aac02c7b150650 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 16 Jan 2019 22:34:09 -0800 Subject: [PATCH] Remove unnecessary absolute paths from tests. --- .../{plugin => connection_plugins}/dummy.py | 0 .../targets/error_from_connection/play.yml | 1 + .../targets/error_from_connection/runme.sh | 2 +- .../targets/module_precedence/runme.sh | 26 +++++++++---------- .../integration/targets/module_utils/runme.sh | 2 +- .../targets/template_jinja2_latest/runme.sh | 2 +- test/integration/targets/test_infra/runme.sh | 2 +- .../targets/vmware_inventory/runme.sh | 7 ++--- 8 files changed, 20 insertions(+), 22 deletions(-) rename test/integration/targets/error_from_connection/{plugin => connection_plugins}/dummy.py (100%) diff --git a/test/integration/targets/error_from_connection/plugin/dummy.py b/test/integration/targets/error_from_connection/connection_plugins/dummy.py similarity index 100% rename from test/integration/targets/error_from_connection/plugin/dummy.py rename to test/integration/targets/error_from_connection/connection_plugins/dummy.py diff --git a/test/integration/targets/error_from_connection/play.yml b/test/integration/targets/error_from_connection/play.yml index b62239379a3..04320d8807c 100644 --- a/test/integration/targets/error_from_connection/play.yml +++ b/test/integration/targets/error_from_connection/play.yml @@ -16,4 +16,5 @@ - assert: that: - result is failed + - "'an error with' in result.msg" # makes sure plugin was found - debug_task is success diff --git a/test/integration/targets/error_from_connection/runme.sh b/test/integration/targets/error_from_connection/runme.sh index 2ab43e00663..92679fd1037 100755 --- a/test/integration/targets/error_from_connection/runme.sh +++ b/test/integration/targets/error_from_connection/runme.sh @@ -2,4 +2,4 @@ set -o nounset -o errexit -o xtrace -ANSIBLE_CONNECTION_PLUGINS="$(pwd)/plugin" ansible-playbook -i inventory "$(pwd)/play.yml" -v "$@" +ansible-playbook -i inventory "play.yml" -v "$@" diff --git a/test/integration/targets/module_precedence/runme.sh b/test/integration/targets/module_precedence/runme.sh index a9af3ca2bc3..45357d5cc47 100755 --- a/test/integration/targets/module_precedence/runme.sh +++ b/test/integration/targets/module_precedence/runme.sh @@ -6,25 +6,25 @@ set -eux ansible-playbook modules_test.yml -i ../../inventory -v "$@" # Library path ping module -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ansible-playbook modules_test_envvar.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_no_extension ansible-playbook modules_test_envvar.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ansible-playbook modules_test_envvar.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_no_extension ansible-playbook modules_test_envvar.yml -i ../../inventory -v "$@" # ping module from role -ANSIBLE_ROLES_PATH=$(pwd)/roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" -ANSIBLE_ROLES_PATH=$(pwd)/roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_ROLES_PATH=roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_ROLES_PATH=roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" # ping module from role when there's a library path module too -ANSIBLE_LIBRARY=$(pwd)/lib_no_extension ANSIBLE_ROLES_PATH=$(pwd)/roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ANSIBLE_ROLES_PATH=$(pwd)/roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_no_extension ANSIBLE_ROLES_PATH=$(pwd)/roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ANSIBLE_ROLES_PATH=$(pwd)/roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_no_extension ANSIBLE_ROLES_PATH=roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ANSIBLE_ROLES_PATH=roles_with_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_no_extension ANSIBLE_ROLES_PATH=roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ANSIBLE_ROLES_PATH=roles_no_extension ansible-playbook modules_test_role.yml -i ../../inventory -v "$@" # ping module in multiple roles: Note that this will use the first module found # which is the current way things work but may not be the best way -ANSIBLE_LIBRARY=$(pwd)/lib_no_extension ANSIBLE_ROLES_PATH=$(pwd)/multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ANSIBLE_ROLES_PATH=$(pwd)/multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_no_extension ANSIBLE_ROLES_PATH=$(pwd)/multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ANSIBLE_ROLES_PATH=$(pwd)/multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_no_extension ANSIBLE_ROLES_PATH=multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ANSIBLE_ROLES_PATH=multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_no_extension ANSIBLE_ROLES_PATH=multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ANSIBLE_ROLES_PATH=multiple_roles ansible-playbook modules_test_multiple_roles.yml -i ../../inventory -v "$@" # And prove that with multiple roles, it's the order the roles are listed in the play that matters -ANSIBLE_LIBRARY=$(pwd)/lib_with_extension ANSIBLE_ROLES_PATH=$(pwd)/multiple_roles ansible-playbook modules_test_multiple_roles_reverse_order.yml -i ../../inventory -v "$@" +ANSIBLE_LIBRARY=lib_with_extension ANSIBLE_ROLES_PATH=multiple_roles ansible-playbook modules_test_multiple_roles_reverse_order.yml -i ../../inventory -v "$@" diff --git a/test/integration/targets/module_utils/runme.sh b/test/integration/targets/module_utils/runme.sh index 4c8aab7ffe2..efbb7f8208c 100755 --- a/test/integration/targets/module_utils/runme.sh +++ b/test/integration/targets/module_utils/runme.sh @@ -3,4 +3,4 @@ set -eux ansible-playbook module_utils_test.yml -i ../../inventory -v "$@" -ANSIBLE_MODULE_UTILS=$(pwd)/other_mu_dir ansible-playbook module_utils_envvar.yml -i ../../inventory -v "$@" +ANSIBLE_MODULE_UTILS=other_mu_dir ansible-playbook module_utils_envvar.yml -i ../../inventory -v "$@" diff --git a/test/integration/targets/template_jinja2_latest/runme.sh b/test/integration/targets/template_jinja2_latest/runme.sh index 9f61e4879c1..e0fd0882b7d 100755 --- a/test/integration/targets/template_jinja2_latest/runme.sh +++ b/test/integration/targets/template_jinja2_latest/runme.sh @@ -18,7 +18,7 @@ source "${MYTMPDIR}/jinja2/bin/activate" pip install -U jinja2 -ANSIBLE_ROLES_PATH="$(dirname "$(pwd)")" +ANSIBLE_ROLES_PATH=../ export ANSIBLE_ROLES_PATH ansible-playbook -i ../../inventory main.yml -e @../../integration_config.yml -v "$@" diff --git a/test/integration/targets/test_infra/runme.sh b/test/integration/targets/test_infra/runme.sh index 25d3f8104d4..548d92f632b 100755 --- a/test/integration/targets/test_infra/runme.sh +++ b/test/integration/targets/test_infra/runme.sh @@ -25,7 +25,7 @@ echo "$PB_OUT" | grep -F "assert works (True)" || exit 1 set -e # ensure test-module script works well -PING_MODULE_PATH="$(pwd)/../../../../lib/ansible/modules/system/ping.py" +PING_MODULE_PATH="../../../../lib/ansible/modules/system/ping.py" ../../../../hacking/test-module -m "$PING_MODULE_PATH" -I ansible_python_interpreter="$(which python)" # ensure module.ansible_version is defined when using test-module diff --git a/test/integration/targets/vmware_inventory/runme.sh b/test/integration/targets/vmware_inventory/runme.sh index ce43650c727..9a713e4f3a8 100755 --- a/test/integration/targets/vmware_inventory/runme.sh +++ b/test/integration/targets/vmware_inventory/runme.sh @@ -4,10 +4,7 @@ set -euo pipefail -# Get Current test directory -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -contrib_dir=$(pwd)/../../../../contrib/inventory +contrib_dir=../../../../contrib/inventory echo "DEBUG: using ${contrib_dir}" @@ -57,6 +54,6 @@ echo "Debugging new instances" curl "http://${vcenter_host}:5000/govc_find" # Get inventory -ansible-playbook -i ./vmware_inventory.sh "${DIR}/test_vmware_inventory.yml" --connection=local "$@" +ansible-playbook -i ./vmware_inventory.sh "./test_vmware_inventory.yml" --connection=local "$@" echo "DEBUG: Done"