summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix hash filter for non-ascii strings and Python3Toshio Kuratomi2017-02-151-0/+5
| | | | | | | | | | | hashlib hashes operate on byte strings. When given a text string on Python3, hashlib backtraces. When given a text string on Python2, hashlib will backtrace if the string contains non-ascii characters. Encode the text string to utf-8 prior to hashing to avoid this problem. Fixes #21452 (cherry picked from commit 99fd2328af598e35cb29f72694c8ea28c8469707)
* Fix @contextmanager leak on exception. (#21031)Matt Clay2017-02-154-13/+25
| | | | | | | * Fix @contextmanager leak on exception. * Fix test leaks of global module args cache. (cherry picked from commit 272ff10fa13e949eb637506969c40da453aae821)
* Use older setuptools for sanity tests.Matt Clay2017-02-061-1/+1
|
* Update test to use keyserver.ubuntu.com.Matt Clay2017-01-191-1/+1
| | | | (cherry picked from commit 4d616366c00334ff58fb85df151ba77797569cf3)
* Use jinja2 import instead of pip to get version.Matt Clay2017-01-191-1/+1
| | | | | | This resolves issues with older versions of pip. (cherry picked from commit a8fb6f0958704c2f6d5b1be776423dc6263a82cf)
* Only test map on jinja2 >= 2.7Matt Clay2017-01-191-0/+3
| | | | (cherry picked from commit ad652746437b4e7d225a9725a501ca1cdfd07969)
* Fixing iterator bug related to reworking of end-of-role detectionJames Cammarata2017-01-191-3/+64
| | | | | | Bug was introduced in cae682607 (cherry picked from commit 9d549c34981694e9fb62d3aa37392a439b5ae487)
* Reworking the way end of role detection is doneJames Cammarata2017-01-191-1/+40
| | | | | | | | | | | | Rather than trying to enumerate tasks or track an ever changing cur_role flag in PlayIterator, this change simply sets a flag on the last block in the list of blocks returned by Role.compile(). The PlayIterator then checks for that flag when the cur_block number is incremented, and marks the role as complete if the given host had any tasks run in that role. Fixes #20224 (cherry picked from commit cae682607cdbe710a51ae5181bbc84ee06f3f33e)
* Correct freebsd startup test for CI.Matt Clay2017-01-131-2/+4
|
* Test with jinja2 < 2.9.Matt Clay2017-01-121-0/+3
|
* Fix a test failure on Python 3.6 (#20030)Marius Gedminas2017-01-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix a test failure on Python 3.6 tox -e py36 failed with ====================================================================== ERROR: test_action_base__execute_module (units.plugins.action.test_action.TestActionBase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/mg/src/ansible/test/units/plugins/action/test_action.py", line 507, in test_action_base__execute_module self.assertEqual(action_base._execute_module(), dict(_ansible_parsed=True, rc=0, stdout="ok", stdout_lines=['ok'])) File "/home/mg/src/ansible/lib/ansible/plugins/action/__init__.py", line 596, in _execute_module remote_module_path = self._connection._shell.join_path(tmp, remote_module_filename) File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 939, in __call__ return _mock_self._mock_call(*args, **kwargs) File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 1005, in _mock_call ret_val = effect(*args, **kwargs) File "/home/mg/src/ansible/.tox/py36/lib/python3.6/posixpath.py", line 92, in join genericpath._check_arg_types('join', a, *p) File "/home/mg/src/ansible/.tox/py36/lib/python3.6/genericpath.py", line 149, in _check_arg_types (funcname, s.__class__.__name__)) from None TypeError: join() argument must be str or bytes, not 'MagicMock' because os.path.join() now checks argument types since Python 3.6 (due to pathlib support, I expect). * Use a more realistic module name in test (cherry picked from commit d9b89ca577eb3156b7cc7f489f80312ef5b2be5d)
* Fix group_by test to work with jinja2 >= 2.9.Matt Clay2017-01-091-2/+2
| | | | (cherry picked from commit cc3d131f503b34ae972dbed94a0b5fde567aab92)
* Add a encode() to AnsibleVaultEncryptedUnicode (#19840)Adrian Likins2017-01-041-0/+9
| | | | | | | | | | | | | | | | | | | * Add a encode() to AnsibleVaultEncryptedUnicode Without it, calling encode() on it results in a bytestring of the encrypted !vault-encrypted string. ssh connection plugin triggers this if ansible_password is from a var using !vault-encrypted. That path ends up calling .encode() instead of using the __str__. Fixes #19795 * Fix str.encode() errors on py2.6 py2.6 str.encode() does not take keyword arguments. (cherry picked from commit c771ab34c7fd1c3b66c3d2fff2124c668679644e)
* Use newer test images for Fedora and openSUSE.Matt Clay2017-01-031-3/+4
|
* fix multiple handler notificationsMatt Davis2016-12-232-0/+38
| | | | | | Fixes #19647 Adds integration test to catch multiple handler notifications (cherry picked from commit c2495677b0364d7e31dfcb51865976ba46586732)
* let chdir support relative path in more modules (#16736)Gordon Gao2016-12-221-0/+13
| | | | (cherry picked from commit d9e1e374b249b568b7b7376b5cc5586327a9a206)
* Fixes #16936 - Digest authentication not working in uri module (#18736)bart22016-12-211-0/+7
|
* Template "original_task" fields in _process_pending_resultsJames Cammarata2016-12-211-5/+14
| | | | | | | | | | | | | | | Since we no longer use a post-validated task in _process_pending_results, we need to be sure to template fields used in original_task as they are raw and may contain variables. This patch also moves the handler tracking to be per-uuid, not per-object. Doing it per-object had implications for the above due to the fact that the copy of the original task is now being used, so the only sure way is to track based on the uuid instead. Fixes #18289 (cherry picked from commit dd0257b995a729705fe39b3dc4dc9b8f9ea1ef8f)
* * Add test for git with local modificationsToshio Kuratomi2016-12-141-4/+107
| | | | | | (cherry picked from afca95739630891d5678d362362877270ae2e80e) From PR: Fix UnboundLocalError remote_head in git (#19057)
* Removed dict.iteritems() in several other files.Andrea Tartaglia2016-12-142-3/+3
| | | | | | This is for py3 compatibility #18506 (cherry picked from commit 59227d8c31f49e9aafe97119bbf501262fc8550c)
* Fix regression in search path behaviourDag Wieers2016-12-142-36/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR fixes a few issues: - Missing role parent directory for relative paths - Fix integration tests (add missing stage) - Redesign integration tests - Incorrect order with tasks-lookups - Duplicate paths are listed - Repetitive tasks/tasks or files/files were possible ==== using copy with test.txt Before: ``` 491 1481281038.29393: search_path: /home/dag/home-made/ansible.testing/roles/test134/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/test.txt /home/dag/home-made/ansible.testing/files/test.txt /home/dag/home-made/ansible.testing/test.txt ``` After: ``` 32505 1481280963.22418: search_path: /home/dag/home-made/ansible.testing/roles/test134/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt /home/dag/home-made/ansible.testing/files/test.txt /home/dag/home-made/ansible.testing/test.txt ``` ==== Using copy with files/test.txt Before: ``` 31523 1481280499.63052: search_path: /home/dag/home-made/ansible.testing/roles/test134/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt /home/dag/home-made/ansible.testing/files/files/test.txt /home/dag/home-made/ansible.testing/files/test.txt ``` After: ``` 31110 1481280299.38778: search_path: /home/dag/home-made/ansible.testing/roles/test134/files/test.txt /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt /home/dag/home-made/ansible.testing/files/test.txt ``` ==== Using template with files/test.txt.j2 Before: ``` 30074 1481280064.15191: search_path: /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt.j2 /home/dag/home-made/ansible.testing/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/files/test.txt.j2 ``` After: ``` 29201 1481279823.52752: search_path: /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2 /home/dag/home-made/ansible.testing/templates/files/test.txt.j2 /home/dag/home-made/ansible.testing/files/test.txt.j2 ``` This fixes #19048 (cherry picked from commit 7c71c678fae64f6962604b76664dd320128130d1)
* Fixes for uri under python3 and local (non-httptester) testingToshio Kuratomi2016-12-131-6/+2
| | | | (cherry picked from c6b42028c40e42662491bbd7a97c41f27e89ccd5)
* Fix AST nodes for Python 3 and enable dependent test_uri (#18597)Lumír 'Frenzy' Balhar2016-12-131-1/+0
| | | | | | | | | | | | * Enable tests on python 3 for uri * Added one more node type to SAFE_NODES into safe_eval module. ast.USub represents unary operators. This is necessary for parsing some unusual but still valid JSON files during testing with Python 3. (cherry picked from commit 84544ee8fd69b1345b969d89335f49c085a4fecb)
* make hash_params more robust in the face of many corner cases (#18701)Toshio Kuratomi2016-12-051-2/+91
| | | | | | | | | | | | | | | | * make hash_params more robust in the face of many corner cases Fixes #18680 Alternative fix to #18681 * add test case for role.hash_params * Add role.hash_params test for more types A set, a generator/iterable, and a Container that is not Iterable. (cherry picked from commit 5f5ea06ca4bcacb4687396f712be7e8516c5e46f)
* Corrected placement templates for test_lookups.Matt Clay2016-11-292-0/+0
|
* Fix regression in jinja2 include search path (#18617)Virgil Dupras2016-11-293-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix regression in jinja2 include search path Since commit 3c39bb5, the 'ansible_search_path' variable is used to set jinja2's search path for {% include %} directives. However, this path is the the proper one because our templates live in 'templates' subdirs in our search path. This is a regression because previously, our include search path would include the dirname of the currently interpreted file, which worked most of the time. fixes #18526 * Fix template lookup search path Improve fix in commit c96c853 so that the search path contain both template-suffixed paths as well as original paths. ref PR #18617 * Add integration test for template lookups Tests regression at #18526 This test fails on current devel branch and succeeds on PR #18617 (cherry picked from commit bf48383610e2edb1f10ebdda820b9fa0d81dedda)
* Make sure include_role inherit variables from parent role (#18627)Daniel Miranda2016-11-291-0/+229
| | | | | | | | | | | | | | | | | | | | * Make sure include_role inherit variables from parent role Setting the parent of task blocks generated by include_role after they have been produced is not sufficient - it means the tasks don't have the correct dependency chain set afterwards, and therefore, don't properly inherit variables from outer roles. In addition to manually setting the parents, pass the dep_chain when compiling the role, such that variables are correctly imported. Fixes #18540. * Add tests for include_role * Fix include_role variable inheritance for multiple parent levels (cherry picked from commit 57f4a9885ec03b6ee8774db2be336d5bf6765e31)
* manual backport of win_async test changes from develMatt Davis2016-11-182-26/+27
|
* Reworking iterator logic regarding failed states during alwaysJames Cammarata2016-11-181-2/+2
| | | | | | | | | | | | | | | | | | Previous changes addressed a corner case, which unfortunately introduced another bug. This patch adds a new flag to the host state (did_rescue) which is set to true when the rescue portion of a block completes. This flag is then checked in _check_failed_state() when the fail_state != FAILED_NONE. This lead to the discovery of another bug - current strategies are not advancing hosts to ITERATING_COMPLETE after doing a peek at the next task, leaving the host state in the run_state of the final task. To address this, before gathering the list of failed hosts in StrategyBase.run(), a final pass through the iterator for all hosts is done to ensure each host is in its final state. This way, no strategy derived from StrategyBase has to worry about it and it's handled. Fixes #17983 (cherry picked from commit ca5b361ad869103282faf6f67125a9316fdf9f79)
* Alternately track listening handlers by uuid if no name is setJames Cammarata2016-11-133-0/+51
| | | | | | Fixes #17846 (cherry picked from commit 4f06a861618953686672213500a3dba58168f65b)
* Fixing incorrect use of version_compare in docker integration testJames Cammarata2016-11-111-2/+2
|
* Fix docker connection unit tests.Matt Clay2016-11-091-3/+6
| | | | | | | | - Use assertRaisesRegexp to make sure correct exceptions are raised. - Set docker_command to avoid docker dependency (skips find_executable). - Use a fake path for docker_command to make sure mock.patch is working. (cherry picked from commit 8552ad6bf19b7b04d57c8fa7770202cb151509af)
* Fix bug (#18355) where encrypted inventories fail 18355 (#18373)Adrian Likins2016-11-072-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix bug (#18355) where encrypted inventories fail This is first part of fix for #18355 * Make DataLoader._get_file_contents return bytes The issue #18355 is caused by a change to inventory to stop using _get_file_contents so that it can handle text encoding itself to better protect against harmless text encoding errors in ini files (invalid unicode text in comment fields). So this makes _get_file_contents return bytes so it and other callers can handle the to_text(). The data returned by _get_file_contents() is now a bytes object instead of a text object. The callers of _get_file_contents() have been updated to call to_text() themselves on the results. Previously, the ini parser attempted to work around ini files that potentially include non-vailid unicode in comment lines. To do this, it stopped using DataLoader._get_file_contents() which does the decryption of files if vault encrypted. It didn't use that because _get_file_contents previously did to_text() on the read data itself. _get_file_contents() returns a bytestring now, so ini.py can call it and still special case ini file comments when converting to_text(). That also means encrypted inventory files are decrypted first. Fixes #18355 (cherry picked from commit dd0189839eaded82df9e2953600d97272871f2f8)
* Change `v2_playbook_on_start` logic to positively detect legacy pluginsSteve Kuznetsov2016-11-011-0/+141
| | | | | | | | | | | | | | | | | | | | | | | | | In order to support legacy plugins, the following two method signatures are allowed for `CallbackBase.v2_playbook_on_start`: def v2_playbook_on_start(self): def v2_playbook_on_start(self, playbook): Previously, the logic to handle this divergence checked to see if the callback plugin being called supported an argument named `playbook` in its `v2_playbook_on_start` method. This was fragile in a few ways: - if a plugin author did not use the literal `playbook` to name their method argument, their plugin would not be called correctly - if a plugin author wrapped their `v2_playbook_on_start` method and by doing so changed the argspec to no longer expose an argument with that literal name, their plugin would not be called correctly In order to continue to support both types of callback for backwards compatibility while making the call more robust for plugin authors, the logic can be reversed in order to have a positive check for the old method signature instead of a positive check for the new one. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com> (cherry picked from commit 0bc35354ceac31e6b7d6540e8a83123398e80f26)
* Set ansible_os_family correctly under KDE neonMatt Robinson2016-11-011-0/+19
| | | | | | | | As neon is derived from Ubuntu, ansible_os_family should have the value "Debian" instead of "Neon". Add a test case for KDE neon and set os_family correctly for it. (cherry picked from commit 4ff8890ec1fa4e0dfb7e1d4aebbedf6cd8d68621)
* Add tests for dnf modelled after the yum tests (#18226)Toshio Kuratomi2016-10-314-0/+229
| | | | (cherry picked from commit 02859a3e32bd7079b99c7d7f3f16c94edc42de9f)
* add large interleaved stdout/stderr integration tests for win_shell/win_commandMatt Davis2016-10-252-12/+18
| | | | (cherry picked from commit c1b7d2e560b27033ac2ecdf7ed5069815b865667)
* Fix the uri testserver to run on python3Toshio Kuratomi2016-10-241-5/+15
| | | | (cherry picked from commit 589e71dbc5c9e7fd4bd83c6cbc6d8fab15f134f7)
* reenable win_async loop testMatt Davis2016-10-241-27/+25
| | | | (cherry picked from commit 9a782736655f705574cf8558e781cba9d14ba4de)
* Set Suse family for openSUSE Tumbleweed & Leapstephane2016-10-231-0/+18
| | | | | | | | | | | | | On openSUSE Tumbleweed, lsb-release -a currently reports the distributor ID as "openSUSE Tumbleweed". On openSUSE Leap, the distributor ID is "SUSE LINUX". Add them to the OS_FAMILY dict as Suse family systems. Also add an entry to TESTSETS in test_distribution_version.py for openSUSE Tumbleweed. (cherry picked from commit 77868a410400f538a6ce6c8c340667227a09a782)
* Enable the git test on py3Toshio Kuratomi2016-10-211-1/+0
| | | | (cherry picked from commit 2ac12432ef666d43b39b5fa60087f839cc64f586)
* Handle 'smart' scp_if_ssh option for fetch (#18125)Ssawa2016-10-211-4/+31
| | | | (cherry picked from commit 8e47b9bc70e33534c308298df4b6c8c79886fef1)
* Enable filters test for python 3Michael Scherer2016-10-201-1/+0
| | | | (cherry picked from commit 2804e64ed5b883959eed5aab1b6d9a2017e13493)
* pip tests now pass on python3. Enable them.Toshio Kuratomi2016-10-201-1/+0
| | | | (cherry picked from commit 67ac37518830f92db8d4f453922abf328d48ddf4)
* Enable test for lookups on python 3Michael Scherer2016-10-201-1/+0
| | | | | | | | | | | Since passlib algo sometime takes a bytes, and sometime not, depending on a internal variable, we have to convert bnased on it, or it fail with "TypeError: salt must be bytes, not str" (or unicode instead of bytes) However, that's not great to use internal structure for that. (cherry picked from commit 578da9a615072231593daca1a01caaa21a03856e)
* Thanks to mscherer, these tests are now passingToshio Kuratomi2016-10-201-4/+0
| | | | (cherry picked from commit fd14048d46c684faae6decdaf5684c5799e9d25f)
* Let authorized_keys be tested on python 3Michael Scherer2016-10-201-1/+0
| | | | (cherry picked from commit e93a8814a36b6b2beece3f22d7319b077ba98b01)
* Port validate-modules to stable-2.2 (#18119)John R Barker2016-10-207-0/+997
|
* Fix test_filters fail because of dict sort (#18105)Adrian Likins2016-10-192-2/+2
| | | | | Fixes #17308 (cherry picked from commit f99ffb5620384434c02289a33f7169dc3c7229e7)
* Pixelrebel amc pr2654 (#18089)Toshio Kuratomi2016-10-191-0/+59
| | | | | | | | | | | | | | * Add tag verification test (ansible-modules-core PR 2654) * Fix typo * Use smaller repo for testing, add dependency control * Test is gpg exists before running git signing tasks * Correct the test conditionals so that gpg1 is tested (cherry picked from commit b902b5d046e7e3935c0d393100cbc34f45bf57c5)