From e5094e8071ad4693089f7345e7aa4715ccfaa429 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 10 Jan 2019 14:45:12 -0800 Subject: [PATCH] Cleanup integration test inventory. (#50753) * Move var_blending test inventory into test. * Remove Amazon specific inventory entry for tests. * Remove Azure specific inventory entry for tests. * Move var_precedence test inventory into test. * Move unicode test inventory into test. * Remove unused inventory entry. * Move gathering_facts test inventory into test. * Move delegate_to test inventory into test. * Clean up inventory for binary_modules test. * Clean up integration test inventory. --- test/integration/inventory | 58 ++----------------- test/integration/inventory.winrm.template | 4 +- .../download_binary_modules.yml | 2 +- .../binary_modules/test_binary_modules.yml | 2 +- test/integration/targets/delegate_to/aliases | 1 + .../integration/targets/delegate_to/inventory | 5 ++ test/integration/targets/delegate_to/runme.sh | 8 +-- .../targets/gathering_facts/inventory | 2 + .../targets/gathering_facts/runme.sh | 8 +-- test/integration/targets/unicode/inventory | 5 ++ test/integration/targets/unicode/runme.sh | 4 +- .../targets/var_blending/inventory | 26 +++++++++ .../integration/targets/var_blending/runme.sh | 2 +- .../targets/var_precedence/inventory | 13 +++++ .../targets/var_precedence/runme.sh | 2 +- test/runner/lib/cloud/aws.py | 7 --- test/runner/lib/cloud/azure.py | 7 --- 17 files changed, 72 insertions(+), 84 deletions(-) create mode 100644 test/integration/targets/delegate_to/inventory create mode 100644 test/integration/targets/gathering_facts/inventory create mode 100644 test/integration/targets/unicode/inventory create mode 100644 test/integration/targets/var_blending/inventory create mode 100644 test/integration/targets/var_precedence/inventory diff --git a/test/integration/inventory b/test/integration/inventory index 11a709dee0a..1a87fb93c3a 100644 --- a/test/integration/inventory +++ b/test/integration/inventory @@ -1,52 +1,8 @@ -[local] -testhost ansible_ssh_host=127.0.0.1 ansible_connection=local host_var_role_name=role3 -testhost2 ansible_ssh_host=127.0.0.1 ansible_connection=local host_var_role_name=role2 -# For testing delegate_to -testhost3 ansible_ssh_host=127.0.0.3 -testhost4 ansible_ssh_host=127.0.0.4 -# For testing fact gathering -facthost[0:25] ansible_host=127.0.0.1 ansible_connection=local +# Do not put test specific entries in this inventory file. +# For script based test targets (using runme.sh) put the inventory file in the test's directory instead. -[binary_modules] -testhost_binary_modules ansible_host=127.0.0.1 ansible_connection=local - -[local_group] -kube-pippin.knf.local - -# the following inline declarations are accompanied -# by (preferred) group_vars/ and host_vars/ variables -# and are used in testing of variable precedence - -[inven_overridehosts] -invenoverride ansible_ssh_host=127.0.0.1 ansible_connection=local - -[all:vars] -extra_var_override=FROM_INVENTORY -inven_var=inventory_var -unicode_host_var=CaféEñyei - -[inven_overridehosts:vars] -foo=foo -var_dir=vars - -[arbitrary_parent:children] -local - -[local:vars] -parent_var=6000 -groups_tree_var=5000 - -[arbitrary_parent:vars] -groups_tree_var=4000 -overridden_in_parent=1000 - -[arbitrary_grandparent:children] -arbitrary_parent - -[arbitrary_grandparent:vars] -groups_tree_var=3000 -grandparent_var=2000 -overridden_in_parent=2000 +[testgroup] +testhost ansible_connection=local [aci:vars] aci_hostname=your-apic-1 @@ -69,9 +25,3 @@ msc_use_proxy=no [msc] localhost ansible_ssh_host=127.0.0.1 ansible_connection=local - -[amazon] -localhost ansible_ssh_host=127.0.0.1 ansible_connection=local - -[azure] -localhost ansible_ssh_host=127.0.0.1 ansible_connection=local diff --git a/test/integration/inventory.winrm.template b/test/integration/inventory.winrm.template index 954deca7b95..34bbee2d4a5 100644 --- a/test/integration/inventory.winrm.template +++ b/test/integration/inventory.winrm.template @@ -23,6 +23,6 @@ ansible_winrm_server_cert_validation=ignore [winrm:children] windows -# support winrm binary module tests (temporary solution) -[testhost_binary_modules:children] +# support tests that target testhost +[testhost:children] windows diff --git a/test/integration/targets/binary_modules/download_binary_modules.yml b/test/integration/targets/binary_modules/download_binary_modules.yml index 456ddb4a795..52ec83333ab 100644 --- a/test/integration/targets/binary_modules/download_binary_modules.yml +++ b/test/integration/targets/binary_modules/download_binary_modules.yml @@ -1,4 +1,4 @@ -- hosts: testhost_binary_modules +- hosts: testhost tasks: - debug: var=ansible_system diff --git a/test/integration/targets/binary_modules/test_binary_modules.yml b/test/integration/targets/binary_modules/test_binary_modules.yml index e02271bea2c..bdf2a06119d 100644 --- a/test/integration/targets/binary_modules/test_binary_modules.yml +++ b/test/integration/targets/binary_modules/test_binary_modules.yml @@ -1,4 +1,4 @@ -- hosts: testhost_binary_modules +- hosts: testhost roles: - role: test_binary_modules tags: diff --git a/test/integration/targets/delegate_to/aliases b/test/integration/targets/delegate_to/aliases index b59832142f2..1bf9c0dc226 100644 --- a/test/integration/targets/delegate_to/aliases +++ b/test/integration/targets/delegate_to/aliases @@ -1 +1,2 @@ shippable/posix/group3 +needs/ssh diff --git a/test/integration/targets/delegate_to/inventory b/test/integration/targets/delegate_to/inventory new file mode 100644 index 00000000000..dfd3a953722 --- /dev/null +++ b/test/integration/targets/delegate_to/inventory @@ -0,0 +1,5 @@ +[local] +testhost ansible_connection=local +testhost2 ansible_connection=local +testhost3 ansible_ssh_host=127.0.0.3 +testhost4 ansible_ssh_host=127.0.0.4 diff --git a/test/integration/targets/delegate_to/runme.sh b/test/integration/targets/delegate_to/runme.sh index 733274cdaf8..9cb64ed8808 100755 --- a/test/integration/targets/delegate_to/runme.sh +++ b/test/integration/targets/delegate_to/runme.sh @@ -3,14 +3,14 @@ set -eux ANSIBLE_SSH_ARGS='-C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null' \ - ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_delegate_to.yml -i ../../inventory -v "$@" + ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_delegate_to.yml -i inventory -v "$@" ansible-playbook test_loop_control.yml -v "$@" ansible-playbook test_delegate_to_loop_randomness.yml -v "$@" -ansible-playbook delegate_and_nolog.yml -i ../../inventory -v "$@" +ansible-playbook delegate_and_nolog.yml -i inventory -v "$@" -ansible-playbook delegate_facts_block.yml -i ../../inventory -v "$@" +ansible-playbook delegate_facts_block.yml -i inventory -v "$@" -ansible-playbook test_delegate_to_loop_caching.yml -i ../../inventory -v "$@" +ansible-playbook test_delegate_to_loop_caching.yml -i inventory -v "$@" diff --git a/test/integration/targets/gathering_facts/inventory b/test/integration/targets/gathering_facts/inventory new file mode 100644 index 00000000000..8c6c24a3794 --- /dev/null +++ b/test/integration/targets/gathering_facts/inventory @@ -0,0 +1,2 @@ +[local] +facthost[0:25] ansible_connection=local diff --git a/test/integration/targets/gathering_facts/runme.sh b/test/integration/targets/gathering_facts/runme.sh index 4baf8379e35..db237641579 100755 --- a/test/integration/targets/gathering_facts/runme.sh +++ b/test/integration/targets/gathering_facts/runme.sh @@ -2,8 +2,8 @@ set -eux -# ANSIBLE_CACHE_PLUGINS=cache_plugins/ ANSIBLE_CACHE_PLUGIN=none ansible-playbook test_gathering_facts.yml -i ../../inventory -v "$@" -ansible-playbook test_gathering_facts.yml -i ../../inventory -v "$@" -#ANSIBLE_CACHE_PLUGIN=base ansible-playbook test_gathering_facts.yml -i ../../inventory -v "$@" +# ANSIBLE_CACHE_PLUGINS=cache_plugins/ ANSIBLE_CACHE_PLUGIN=none ansible-playbook test_gathering_facts.yml -i inventory -v "$@" +ansible-playbook test_gathering_facts.yml -i inventory -v "$@" +# ANSIBLE_CACHE_PLUGIN=base ansible-playbook test_gathering_facts.yml -i inventory -v "$@" -ANSIBLE_GATHERING=smart ansible-playbook test_run_once.yml -i ../../inventory -v "$@" +ANSIBLE_GATHERING=smart ansible-playbook test_run_once.yml -i inventory -v "$@" diff --git a/test/integration/targets/unicode/inventory b/test/integration/targets/unicode/inventory new file mode 100644 index 00000000000..256e8c0ddf6 --- /dev/null +++ b/test/integration/targets/unicode/inventory @@ -0,0 +1,5 @@ +[local] +testhost ansible_connection=local + +[all:vars] +unicode_host_var=CaféEñyei diff --git a/test/integration/targets/unicode/runme.sh b/test/integration/targets/unicode/runme.sh index 0182093f414..8757530f966 100755 --- a/test/integration/targets/unicode/runme.sh +++ b/test/integration/targets/unicode/runme.sh @@ -2,6 +2,6 @@ set -eux -ansible-playbook unicode.yml -i ../../inventory -v -e 'extra_var=café' "$@" +ansible-playbook unicode.yml -i inventory -v -e 'extra_var=café' "$@" # Test the start-at-task flag #9571 -ansible-playbook unicode.yml -i ../../inventory -v --start-at-task '*¶' -e 'start_at_task=True' "$@" +ansible-playbook unicode.yml -i inventory -v --start-at-task '*¶' -e 'start_at_task=True' "$@" diff --git a/test/integration/targets/var_blending/inventory b/test/integration/targets/var_blending/inventory new file mode 100644 index 00000000000..542f8ecab3a --- /dev/null +++ b/test/integration/targets/var_blending/inventory @@ -0,0 +1,26 @@ +[local] +testhost ansible_connection=local +testhost2 ansible_connection=local + +# the following inline declarations are accompanied +# by (preferred) group_vars/ and host_vars/ variables +# and are used in testing of variable precedence + +[arbitrary_parent:children] +local + +[local:vars] +parent_var=6000 +groups_tree_var=5000 + +[arbitrary_parent:vars] +groups_tree_var=4000 +overridden_in_parent=1000 + +[arbitrary_grandparent:children] +arbitrary_parent + +[arbitrary_grandparent:vars] +groups_tree_var=3000 +grandparent_var=2000 +overridden_in_parent=2000 diff --git a/test/integration/targets/var_blending/runme.sh b/test/integration/targets/var_blending/runme.sh index 8f09e3e919d..24e523ced5c 100755 --- a/test/integration/targets/var_blending/runme.sh +++ b/test/integration/targets/var_blending/runme.sh @@ -2,4 +2,4 @@ set -eux -ansible-playbook test_var_blending.yml -i ../../inventory -e @integration_config.yml -v "$@" +ansible-playbook test_var_blending.yml -i inventory -e @integration_config.yml -v "$@" diff --git a/test/integration/targets/var_precedence/inventory b/test/integration/targets/var_precedence/inventory new file mode 100644 index 00000000000..3fcf28e72c1 --- /dev/null +++ b/test/integration/targets/var_precedence/inventory @@ -0,0 +1,13 @@ +[local] +testhost ansible_connection=local + +[all:vars] +extra_var_override=FROM_INVENTORY +inven_var=inventory_var + +[inven_overridehosts] +invenoverride ansible_connection=local + +[inven_overridehosts:vars] +foo=foo +var_dir=vars diff --git a/test/integration/targets/var_precedence/runme.sh b/test/integration/targets/var_precedence/runme.sh index c6dc3e99717..0f0811c3e9d 100755 --- a/test/integration/targets/var_precedence/runme.sh +++ b/test/integration/targets/var_precedence/runme.sh @@ -2,7 +2,7 @@ set -eux -ansible-playbook test_var_precedence.yml -i ../../inventory -v "$@" \ +ansible-playbook test_var_precedence.yml -i inventory -v "$@" \ -e 'extra_var=extra_var' \ -e 'extra_var_override=extra_var_override' diff --git a/test/runner/lib/cloud/aws.py b/test/runner/lib/cloud/aws.py index 77937ccb6fa..9844347171e 100644 --- a/test/runner/lib/cloud/aws.py +++ b/test/runner/lib/cloud/aws.py @@ -103,10 +103,3 @@ class AwsCloudEnvironment(CloudEnvironment): if not tries and self.managed: display.notice('If %s failed due to permissions, the IAM test policy may need to be updated. ' 'For help, consult @mattclay or @gundalow on GitHub or #ansible-devel on IRC.' % target.name) - - @property - def inventory_hosts(self): - """ - :rtype: str | None - """ - return 'amazon' diff --git a/test/runner/lib/cloud/azure.py b/test/runner/lib/cloud/azure.py index a28f3e4a60a..03297fc9d72 100644 --- a/test/runner/lib/cloud/azure.py +++ b/test/runner/lib/cloud/azure.py @@ -161,13 +161,6 @@ class AzureCloudEnvironment(CloudEnvironment): display.notice('If %s failed due to permissions, the test policy may need to be updated. ' 'For help, consult @mattclay or @gundalow on GitHub or #ansible-devel on IRC.' % target.name) - @property - def inventory_hosts(self): - """ - :rtype: str | None - """ - return 'azure' - def get_config(config_path): """