From 379fe02104b045394475b329e65d0273343d96f2 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 20 Feb 2014 17:16:16 -0500 Subject: [PATCH] Move inventory tests into subdir, prune non-integration tests. --- test/TestInventory.py | 3 ++- test/action_plugins/categorized_plugin.py | 15 ----------- .../category/categorized_plugin.py | 11 -------- test/action_plugins/uncategorized_plugin.py | 11 -------- test/{ => inventory_test_data}/ansible_hosts | 0 .../{ => inventory_test_data}/common_vars.yml | 0 test/{ => inventory_test_data}/complex_hosts | 0 test/{ => inventory_test_data}/hosts_list.yml | 0 .../inventory/test_alpha_end_before_beg | 0 .../inventory/test_combined_range | 0 .../inventory/test_incorrect_format | 0 .../inventory/test_incorrect_range | 0 .../inventory/test_leading_range | 0 .../inventory/test_missing_end | 0 .../inventory_api.py | 0 .../inventory_dir/0hosts | 0 .../inventory_dir/1mythology | 0 .../inventory_dir/2levels | 0 .../inventory_dir/3comments | 0 test/{ => inventory_test_data}/large_range | 0 .../restrict_pattern | 0 test/{ => inventory_test_data}/simple_hosts | 0 .../callback_plugins/test_log.py | 27 ------------------- test/test_callbacks/test_playbook.yml | 5 ---- test/test_hash_behavior/goodbye.yml | 3 --- test/test_hash_behavior/hello.yml | 3 --- test/test_hash_behavior/message.j2 | 3 --- test/test_hash_behavior/playbook.yml | 16 ----------- .../hash_behavior_test_role/tasks/main.yml | 2 -- .../templates/role_message.j2 | 3 --- 30 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 test/action_plugins/categorized_plugin.py delete mode 100644 test/action_plugins/category/categorized_plugin.py delete mode 100644 test/action_plugins/uncategorized_plugin.py rename test/{ => inventory_test_data}/ansible_hosts (100%) rename test/{ => inventory_test_data}/common_vars.yml (100%) rename test/{ => inventory_test_data}/complex_hosts (100%) rename test/{ => inventory_test_data}/hosts_list.yml (100%) rename test/{ => inventory_test_data}/inventory/test_alpha_end_before_beg (100%) rename test/{ => inventory_test_data}/inventory/test_combined_range (100%) rename test/{ => inventory_test_data}/inventory/test_incorrect_format (100%) rename test/{ => inventory_test_data}/inventory/test_incorrect_range (100%) rename test/{ => inventory_test_data}/inventory/test_leading_range (100%) rename test/{ => inventory_test_data}/inventory/test_missing_end (100%) rename test/{ => inventory_test_data}/inventory_api.py (100%) rename test/{ => inventory_test_data}/inventory_dir/0hosts (100%) rename test/{ => inventory_test_data}/inventory_dir/1mythology (100%) rename test/{ => inventory_test_data}/inventory_dir/2levels (100%) rename test/{ => inventory_test_data}/inventory_dir/3comments (100%) rename test/{ => inventory_test_data}/large_range (100%) rename test/{ => inventory_test_data}/restrict_pattern (100%) rename test/{ => inventory_test_data}/simple_hosts (100%) delete mode 100644 test/test_callbacks/callback_plugins/test_log.py delete mode 100644 test/test_callbacks/test_playbook.yml delete mode 100644 test/test_hash_behavior/goodbye.yml delete mode 100644 test/test_hash_behavior/hello.yml delete mode 100644 test/test_hash_behavior/message.j2 delete mode 100644 test/test_hash_behavior/playbook.yml delete mode 100644 test/test_hash_behavior/roles/hash_behavior_test_role/tasks/main.yml delete mode 100644 test/test_hash_behavior/roles/hash_behavior_test_role/templates/role_message.j2 diff --git a/test/TestInventory.py b/test/TestInventory.py index 43c9bc82ab..1fd7b88744 100644 --- a/test/TestInventory.py +++ b/test/TestInventory.py @@ -8,8 +8,9 @@ from ansible.inventory import Inventory class TestInventory(unittest.TestCase): def setUp(self): + self.cwd = os.getcwd() - self.test_dir = os.path.join(self.cwd, 'test') + self.test_dir = os.path.join(self.cwd, 'test', 'inventory_test_data') self.inventory_file = os.path.join(self.test_dir, 'simple_hosts') self.large_range_inventory_file = os.path.join(self.test_dir, 'large_range') diff --git a/test/action_plugins/categorized_plugin.py b/test/action_plugins/categorized_plugin.py deleted file mode 100644 index 62fa6ab510..0000000000 --- a/test/action_plugins/categorized_plugin.py +++ /dev/null @@ -1,15 +0,0 @@ -from ansible.runner import return_data - - -class ActionModule (object): - def __init__(self, runner): - self.runner = runner - - def run(self, conn, tmp, module_name, module_args, inject, - complex_args=None, **kwargs): - # This plug-in should be ignored in deference to - # category/categorized_plugin.py, so it should never actually - # run. - return return_data.ReturnData( - conn=conn, comm_ok=True, - result={"msg": "this plug-in should never be run"}) diff --git a/test/action_plugins/category/categorized_plugin.py b/test/action_plugins/category/categorized_plugin.py deleted file mode 100644 index da23814c18..0000000000 --- a/test/action_plugins/category/categorized_plugin.py +++ /dev/null @@ -1,11 +0,0 @@ -from ansible.runner import return_data - - -class ActionModule (object): - def __init__(self, runner): - self.runner = runner - - def run(self, conn, tmp, module_name, module_args, inject, - complex_args=None, **kwargs): - return return_data.ReturnData(conn=conn, comm_ok=True, - result={"msg": "categorized"}) diff --git a/test/action_plugins/uncategorized_plugin.py b/test/action_plugins/uncategorized_plugin.py deleted file mode 100644 index bf4bf809bd..0000000000 --- a/test/action_plugins/uncategorized_plugin.py +++ /dev/null @@ -1,11 +0,0 @@ -from ansible.runner import return_data - - -class ActionModule (object): - def __init__(self, runner): - self.runner = runner - - def run(self, conn, tmp, module_name, module_args, inject, - complex_args=None, **kwargs): - return return_data.ReturnData(conn=conn, comm_ok=True, - result={"msg": "uncategorized"}) diff --git a/test/ansible_hosts b/test/inventory_test_data/ansible_hosts similarity index 100% rename from test/ansible_hosts rename to test/inventory_test_data/ansible_hosts diff --git a/test/common_vars.yml b/test/inventory_test_data/common_vars.yml similarity index 100% rename from test/common_vars.yml rename to test/inventory_test_data/common_vars.yml diff --git a/test/complex_hosts b/test/inventory_test_data/complex_hosts similarity index 100% rename from test/complex_hosts rename to test/inventory_test_data/complex_hosts diff --git a/test/hosts_list.yml b/test/inventory_test_data/hosts_list.yml similarity index 100% rename from test/hosts_list.yml rename to test/inventory_test_data/hosts_list.yml diff --git a/test/inventory/test_alpha_end_before_beg b/test/inventory_test_data/inventory/test_alpha_end_before_beg similarity index 100% rename from test/inventory/test_alpha_end_before_beg rename to test/inventory_test_data/inventory/test_alpha_end_before_beg diff --git a/test/inventory/test_combined_range b/test/inventory_test_data/inventory/test_combined_range similarity index 100% rename from test/inventory/test_combined_range rename to test/inventory_test_data/inventory/test_combined_range diff --git a/test/inventory/test_incorrect_format b/test/inventory_test_data/inventory/test_incorrect_format similarity index 100% rename from test/inventory/test_incorrect_format rename to test/inventory_test_data/inventory/test_incorrect_format diff --git a/test/inventory/test_incorrect_range b/test/inventory_test_data/inventory/test_incorrect_range similarity index 100% rename from test/inventory/test_incorrect_range rename to test/inventory_test_data/inventory/test_incorrect_range diff --git a/test/inventory/test_leading_range b/test/inventory_test_data/inventory/test_leading_range similarity index 100% rename from test/inventory/test_leading_range rename to test/inventory_test_data/inventory/test_leading_range diff --git a/test/inventory/test_missing_end b/test/inventory_test_data/inventory/test_missing_end similarity index 100% rename from test/inventory/test_missing_end rename to test/inventory_test_data/inventory/test_missing_end diff --git a/test/inventory_api.py b/test/inventory_test_data/inventory_api.py similarity index 100% rename from test/inventory_api.py rename to test/inventory_test_data/inventory_api.py diff --git a/test/inventory_dir/0hosts b/test/inventory_test_data/inventory_dir/0hosts similarity index 100% rename from test/inventory_dir/0hosts rename to test/inventory_test_data/inventory_dir/0hosts diff --git a/test/inventory_dir/1mythology b/test/inventory_test_data/inventory_dir/1mythology similarity index 100% rename from test/inventory_dir/1mythology rename to test/inventory_test_data/inventory_dir/1mythology diff --git a/test/inventory_dir/2levels b/test/inventory_test_data/inventory_dir/2levels similarity index 100% rename from test/inventory_dir/2levels rename to test/inventory_test_data/inventory_dir/2levels diff --git a/test/inventory_dir/3comments b/test/inventory_test_data/inventory_dir/3comments similarity index 100% rename from test/inventory_dir/3comments rename to test/inventory_test_data/inventory_dir/3comments diff --git a/test/large_range b/test/inventory_test_data/large_range similarity index 100% rename from test/large_range rename to test/inventory_test_data/large_range diff --git a/test/restrict_pattern b/test/inventory_test_data/restrict_pattern similarity index 100% rename from test/restrict_pattern rename to test/inventory_test_data/restrict_pattern diff --git a/test/simple_hosts b/test/inventory_test_data/simple_hosts similarity index 100% rename from test/simple_hosts rename to test/inventory_test_data/simple_hosts diff --git a/test/test_callbacks/callback_plugins/test_log.py b/test/test_callbacks/callback_plugins/test_log.py deleted file mode 100644 index 3bed373bf7..0000000000 --- a/test/test_callbacks/callback_plugins/test_log.py +++ /dev/null @@ -1,27 +0,0 @@ -# (C) 2013, Michael Scherer, - -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -import os - - -class CallbackModule(object): - def playbook_on_play_start(self, foo): - if os.path.exists('/tmp/ansible_test_disable'): - self.disabled = True - - def playbook_on_stats(self, stats): - open('/tmp/ansible_test_finish', 'w').close() diff --git a/test/test_callbacks/test_playbook.yml b/test/test_callbacks/test_playbook.yml deleted file mode 100644 index b3049153f1..0000000000 --- a/test/test_callbacks/test_playbook.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: 127.0.0.1 - connection: local - tasks: - shell: id diff --git a/test/test_hash_behavior/goodbye.yml b/test/test_hash_behavior/goodbye.yml deleted file mode 100644 index d04fd368e8..0000000000 --- a/test/test_hash_behavior/goodbye.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -messages: - goodbye: "Goodbye World!" diff --git a/test/test_hash_behavior/hello.yml b/test/test_hash_behavior/hello.yml deleted file mode 100644 index a50c088353..0000000000 --- a/test/test_hash_behavior/hello.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -messages: - hello: "Hello World!" diff --git a/test/test_hash_behavior/message.j2 b/test/test_hash_behavior/message.j2 deleted file mode 100644 index c2da7b9e71..0000000000 --- a/test/test_hash_behavior/message.j2 +++ /dev/null @@ -1,3 +0,0 @@ -{% for k, v in messages.iteritems() %} -{{ k }}: {{ v }} -{% endfor %} diff --git a/test/test_hash_behavior/playbook.yml b/test/test_hash_behavior/playbook.yml deleted file mode 100644 index 2f7c32bffb..0000000000 --- a/test/test_hash_behavior/playbook.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- hosts: all - connection: local - - vars_files: - - hello.yml - - goodbye.yml - - tasks: - - name: generate messages - action: template src=message.j2 dest=/tmp/ansible_test_messages.out - - roles: - - role: hash_behavior_test_role - messages: - inside_a_role: "Indeed!" diff --git a/test/test_hash_behavior/roles/hash_behavior_test_role/tasks/main.yml b/test/test_hash_behavior/roles/hash_behavior_test_role/tasks/main.yml deleted file mode 100644 index f297fb6a99..0000000000 --- a/test/test_hash_behavior/roles/hash_behavior_test_role/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -- name: generate role messages - action: template src=role_message.j2 dest=/tmp/ansible_test_role_messages.out diff --git a/test/test_hash_behavior/roles/hash_behavior_test_role/templates/role_message.j2 b/test/test_hash_behavior/roles/hash_behavior_test_role/templates/role_message.j2 deleted file mode 100644 index c2da7b9e71..0000000000 --- a/test/test_hash_behavior/roles/hash_behavior_test_role/templates/role_message.j2 +++ /dev/null @@ -1,3 +0,0 @@ -{% for k, v in messages.iteritems() %} -{{ k }}: {{ v }} -{% endfor %}