Commit graph

1412 commits

Author SHA1 Message Date
Brian Coca
27f4730c29 correctly deals with non serializable type
combine_vars shoudl really be data types, but some just get in
in test, add dict to mock and avoid combine_vars using object
2016-01-18 15:17:43 -05:00
Matt Davis
acf49cf837 Merge pull request #13569 from mattclay/apt-repository-filename
Test for filename option in apt_repository module.
2016-01-15 09:01:48 -08:00
Toshio Kuratomi
bcb22b0e1a Integration tests for https://github.com/ansible/ansible-modules-core/pull/558 2016-01-11 17:16:40 -08:00
James Cammarata
749fbd43ef Removing test for map filter until we can figure out how that's supposed to work 2016-01-08 16:41:56 -05:00
Brian Coca
e7804a6fdd fixed test to use hostvars and not expect vars sub
vars is at the same level as hostvars and was only included in hostvars
temporarily as a bug
2016-01-08 16:25:57 -05:00
Toshio Kuratomi
46903c80fa More fixes for unicode handling in the connection plugins.
Tested that ssh, docker, local, lxc-libvirt, chroot all work with the
updated unicode integration test.
2016-01-06 15:19:40 -08:00
Toshio Kuratomi
c0a8cd950b Fix problems with non-ascii values passed as part of the command to connection plugins
@drybjed discovered this with non-ascii environment variables and
command line arguments to script and raw module.
2016-01-04 20:35:25 -08:00
Toshio Kuratomi
1ed3a018eb Revert "Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638."
This reverts commit e70061334a.

Going to do this in the connection plugins
2016-01-04 19:25:40 -08:00
James Cammarata
2d11cfab92 Squashed commit of the following:
commit 24efa310b58c431b4d888a6315d1285da918f670
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 11:23:52 2015 -0500

    Adding an additional test for copy exclusion

    Adds a negative test for the situation when an exclusion doesn't
    exist in the target to be copied.

commit 643ba054877cf042177d65e6e2958178bdd2fe88
Merge: e6ee59f 66a8f7e
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 10:59:18 2015 -0500

    Merge branch 'speedup' of https://github.com/chrismeyersfsu/ansible into chrismeyersfsu-speedup

commit 66a8f7e873
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Mon Dec 28 09:47:00 2015 -0500

    better api and tests added

    * _copy_results = deepcopy for better performance
    * _copy_results_exclude to deepcopy but exclude certain fields. Pop
    fields that do not need to be deep copied. Re-assign popped fields
    after deep copy so we don't modify the original, to be copied, object.
    * _copy_results_exclude unit tests

commit 93490960ff
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Fri Dec 25 23:17:26 2015 -0600

    remove uneeded deepcopy fields
2015-12-29 11:40:18 -05:00
Brian Coca
d89d7951e6 fixed tests to follow new invocation structure
also added maxdiff setting to see issues clearly when they happen
2015-12-23 11:45:07 -05:00
Yannig Perré
b22d998d1d Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638. 2015-12-22 16:47:27 -05:00
James Cammarata
d22bbbf52c Actually disable parallel makes for integration runner 2015-12-21 16:11:53 -05:00
James Cammarata
8119ea37af Dropping instance size back down since we're not doing parallel builds 2015-12-21 15:55:43 -05:00
James Cammarata
45afa642c3 Integration test runner tweaks 2015-12-21 15:48:58 -05:00
James Cammarata
6d6822e66e Kick up the integration runner test image size 2015-12-21 14:37:17 -05:00
James Cammarata
08b580decc Parallelize make command for integration test runner
Also adds a new var, used by the prepare_tests role, to prevent it from
deleting the temp test directory at the start of each play to avoid any
potential race conditions
2015-12-21 14:10:23 -05:00
Brian Coca
2281c455db Merge pull request #13616 from resmo/for-ansible-stable-2.0
[stable-2.0] cloudstack: test_cs_instance: more integration tests
2015-12-21 13:45:29 -05:00
Brian Coca
75e94e0cba allow for non standard hostnames
* Changed parse_addresses to throw exceptions instead of passing None
* Switched callers to trap and pass through the original values.
* Added very verbose notice
* Look at deprecating this and possibly validate at plugin instead
fixes #13608
2015-12-21 13:42:34 -05:00
Brian Coca
e957335b0d Merge pull request #13607 from mattclay/test-cache-typo
Fixed import typo for memcache module in tests.
2015-12-21 10:23:38 -05:00
James Cammarata
54455a06e5 Disable docker test for Fedora, due to broken packaging 2015-12-20 21:32:37 -05:00
James Cammarata
3a57d9472c Save output of integration test results to files we can archive 2015-12-20 17:55:39 -05:00
Rene Moser
b85b92ecdd cloudstack: test_cs_instance: more integration tests
cloudstack: extend test_cs_instance addressing recovering

cloudstack: test_cs_instance: add tests for using display_name as indentifier.
2015-12-20 22:37:48 +01:00
Rene Moser
b0525da8c8 cloudstack: cs_volume: add tests for volume resize
See https://github.com/ansible/ansible-modules-extras/pull/1333
2015-12-20 22:33:53 +01:00
Rene Moser
8b5e553828 cloudstack: add tests for cs_volume 2015-12-20 22:33:53 +01:00
Toshio Kuratomi
6963955cb4 And change the task a little more since different shlex versions are handling the quotes differently 2015-12-20 11:51:32 -08:00
Toshio Kuratomi
21ca0ce1ce Fix test playbook syntax 2015-12-20 11:46:49 -08:00
Toshio Kuratomi
3792a586b5 Since the velox test server seems to be dropping using iptables to drop requests from aws, test via a different website instead 2015-12-20 11:34:57 -08:00
Toshio Kuratomi
8d7892cc7b Done troubleshooting
Revert "Troubleshooting has reduced us to this"

This reverts commit 9abef1a1d7.
2015-12-20 11:34:57 -08:00
Toshio Kuratomi
5fef2c4297 Try updating the centos7 image to a newer version (trying to resolve issue being unable to connect to some webservers) 2015-12-20 09:11:53 -08:00
Toshio Kuratomi
b90506341a Fixes for tests that assumed yum as package manager for systems that
have dnf
2015-12-20 08:06:26 -08:00
Toshio Kuratomi
3da312da9c Switch from yum to package when installing sudo so that dnf is handled as well 2015-12-19 23:13:11 -08:00
James Cammarata
3ec0104128 Fixing bugs in conditional testing with until and some integration runner tweaks 2015-12-19 21:14:48 -05:00
Toshio Kuratomi
e2d9f4e2f2 Fix unittests for return of invocation from fail_json and exit_json 2015-12-19 15:49:59 -08:00
Toshio Kuratomi
9abef1a1d7 Troubleshooting has reduced us to this 2015-12-19 12:39:48 -08:00
Toshio Kuratomi
51cca87d67 Also need redhat-rpm-config to compile pycrypto 2015-12-19 11:27:16 -08:00
Toshio Kuratomi
c63ae99485 Make sure that yum is present on redhat family systems (makes things also work on fedora systems where dnf is the default) 2015-12-19 10:11:42 -08:00
Matt Clay
d2ad17e88f Fixed import typo for memcache module in tests.
The typo caused the test for the memcached cache plugin to be skipped
even when the necessary memcache python module was installed.
2015-12-19 00:08:49 -08:00
Toshio Kuratomi
f7ed33378e Fix the fedora host detection 2015-12-18 15:42:41 -08:00
Toshio Kuratomi
78dde62710 What is going on here 2015-12-18 15:14:38 -08:00
Toshio Kuratomi
26e5bcdb39 Bugfix the fedora 23 install task 2015-12-18 14:38:54 -08:00
Toshio Kuratomi
ec60bfbb3f Ubuntu images with hvm ssd 2015-12-18 14:36:17 -08:00
Toshio Kuratomi
68fe3d856f Fedora 23 needs to have python2 packages installed 2015-12-18 14:05:33 -08:00
James Cammarata
0823a2c16f Removing update all for test deps, it didn't fix the problem 2015-12-18 15:34:11 -05:00
James Cammarata
02f65eaa80 Make integration runner ec2 add_hosts use valid host names 2015-12-18 14:59:22 -05:00
Toshio Kuratomi
1cc83dd0d9 Make tests that use kennethreitz retry. 2015-12-18 11:50:36 -08:00
James Cammarata
73a0153b8e Fix typo in integration test runner role 2015-12-18 12:45:12 -05:00
James Cammarata
0c154e81f0 Make integration tests run in parallel with async 2015-12-18 11:30:51 -05:00
Toshio Kuratomi
f2364ecf5f Add a Fedora latest host into the mix 2015-12-18 08:13:22 -08:00
James Cammarata
1debc2da44 Do a full yum update to make sure packages are latest version
For the deps setup of integration tests, as we sometimes see odd
errors we can't reproduce, which may be related to slightly out of
date package dependencies.
2015-12-18 10:34:27 -05:00
James Cammarata
44e30e49dd Add awk to integration test deps list 2015-12-18 07:47:40 -05:00
Toshio Kuratomi
a391d6f89a Add state=latest to pip install of pycrypto 2015-12-17 20:10:26 -08:00
James Cammarata
3143b352c5 Add ca-certificates update to the integration deps playbook 2015-12-17 23:08:04 -05:00
Toshio Kuratomi
1f3eec293b Install an updated version of pycrypto on Ubuntu12 from pip 2015-12-17 20:06:53 -08:00
James Cammarata
12c0bb9414 Use --source instead of -e for awk in integration Makefile 2015-12-17 20:53:11 -05:00
Toshio Kuratomi
c5eda277ac Fix get_url tests in light of distros backporting SNI support 2015-12-17 17:51:42 -08:00
Toshio Kuratomi
8c6f56f982 kennetreitz.org times out but www.kennethreitz.org is fine 2015-12-17 11:46:26 -08:00
Toshio Kuratomi
ce1febe28b debug line needs var not msg 2015-12-17 11:25:45 -08:00
Brian Coca
8db4415e2e changed test to use filter for accurate reporting 2015-12-17 12:28:32 -05:00
James Cammarata
26bbabcfba Consolidating package lines for virtualenv install in test deps integration 2015-12-17 11:15:06 -05:00
James Cammarata
cf3d503f79 Moving apt cache update to top to ensure cache is updated before deps installed 2015-12-17 11:00:54 -05:00
James Cammarata
0b1ad8d490 Switch virtualenv dep installation from pip to package manager 2015-12-17 10:41:58 -05:00
James Cammarata
dd3d04e96a Adding pip install of virtualenv to test deps integration role 2015-12-17 10:31:14 -05:00
James Cammarata
5fa93ef8fc Merge pull request #13477 from chrismeyersfsu/jenkins-playbooks
Jenkins playbooks
2015-12-17 10:19:52 -05:00
James Cammarata
d7f2f606e1 Add has_hostkey to mock objects to fix broken unit tests 2015-12-16 21:49:33 -05:00
James Cammarata
857456ea5f Fixing template integration test for python 2.6 versions
No longer immediately fallback to to_json if simplejson is not installed
2015-12-16 18:22:22 -05:00
Toshio Kuratomi
fffd29d1ab Update mysql setup to handle installing mysql with dnf too. 2015-12-16 14:06:51 -08:00
James Cammarata
6109f70397 Attempt at fixing strategy unit test failures on py2.6 and py3 2015-12-16 14:02:25 -05:00
Toshio Kuratomi
1116bc6ca6 Merge pull request #13191 from Jmainguy/mysql
Add shared connection code for mysql modules
2015-12-16 10:47:49 -08:00
Jonathan Mainguy
34e88e48a5 Add shared connection code for mysql modules 2015-12-16 13:36:18 -05:00
Toshio Kuratomi
375eb501b3 Update url to site that has an invalid certificate 2015-12-16 09:41:01 -08:00
Matt Clay
9942d71d34 Test for filename option in apt_repository module. 2015-12-16 01:37:02 -08:00
Michael Scherer
a7ac98262d Make module_utils.known_hosts.get_fqdn work on ipv6 2015-12-14 19:30:54 +01:00
Toshio Kuratomi
457f86f61a Minor: Correct type pyhton => python 2015-12-14 08:50:37 -08:00
Toshio Kuratomi
fc19ad21ef Merge pull request #13494 from Jmainguy/msyql_hash_tests
add tests for encrypted hash mysql_user
2015-12-14 07:58:39 -08:00
Jonathan Mainguy
49dc9eea16 add tests for encrypted hash mysql_user 2015-12-14 10:12:06 -05:00
James Cammarata
35015aaa4a Merge pull request #13529 from mscherer/add_tests_known_hosts
Add tests for ansible.module_utils.known_hosts
2015-12-14 09:50:23 -05:00
James Cammarata
279c5a3596 Cleanup strategy tests broken by new forking strategy 2015-12-14 03:07:20 -05:00
Michael Scherer
3c4d2fc6f2 Add tests for ansible.module_utils.known_hosts 2015-12-12 20:03:35 +01:00
James Cammarata
97554fc222 Fixing filter test for extract to use proper group 2015-12-11 14:55:38 -05:00
James Cammarata
c402325085 Fixing up docker integration tests a bit 2015-12-10 13:10:59 -05:00
Toshio Kuratomi
04fc3f118f Code smell test for specifying both required and default in FieldAttributes 2015-12-09 08:25:29 -08:00
Chris Meyers
8d66dcda21 remove .gitignore 2015-12-09 09:39:45 -05:00
Chris Meyers
f16628ffec symbolic link role for testing 2015-12-09 09:37:39 -05:00
Chris Meyers
57391f49ba removed ansible_python_interpreter
* added missed renames of ansible_deps to ansible_test_deps
* removed acidential inventory.dynamic file
* modified README for ansible_test_deps role
2015-12-09 07:52:43 -05:00
=
ea72fd6547 adding integration tests for win_regmerge module (extras) 2015-12-09 08:57:06 +00:00
Chris Meyers
822624d061 rename role ansible_deps to ansible_test_deps 2015-12-08 14:05:57 -05:00
Chris Meyers
05c8bb79f8 playbook that Ansible jenkins runs moved into core
The playbook is already running in jenkins and works. This moves the
assets into core for ease of maintenance going forward.
2015-12-08 12:24:42 -05:00
James Cammarata
750adbaa27 Changing up how host (in)equality is checked
Fixes #13397
2015-12-04 12:57:46 -05:00
Toshio Kuratomi
cfeef81303 For now, skip tests of module_utils/basic functions that are failing on
py3 (these are only run on the target hosts, not on the controller).
2015-12-03 14:16:29 -08:00
Brian Coca
7d073bdd17 Merge pull request #13345 from amenonsen/extract
Add an 'extract' filter
2015-12-03 11:19:06 -08:00
Toshio Kuratomi
e00012994e Also some unicode tests for return_values() 2015-12-02 21:09:53 -08:00
Toshio Kuratomi
5fdfe6a0f2 Add some test data that has unicode values 2015-12-02 21:07:41 -08:00
Toshio Kuratomi
ac54ac618c Something's strange... let's see if python2.6 is really the same now... 2015-12-02 14:49:28 -08:00
Toshio Kuratomi
eb7db067f9 Fix template test results on python2.6 2015-12-02 10:32:10 -08:00
Abhijit Menon-Sen
8cf1815867 Add an 'extract' filter
At its most basic, this is nothing more than an array or hash lookup,
but when used in conjunction with map, it is very useful. For example,
while constructing an "ssh-keyscan …" command to update known_hosts on
all hosts in a group, one can get a list of IP addresses with:

    groups['x']|map('extract', hostvars, 'ec2_ip_address')|list

This returns hostvars[a].ec2_ip_address, hostvars[b].ec2_ip_address, and
so on. You can even specify an array of keys for a recursive lookup, and
mix string and integer keys depending on what you're looking up:

    ['localhost']|map('extract', hostvars, ['vars','group_names',0])|first
        == hostvars['localhost']['vars']['group_names'][0]
            == 'ungrouped'

Includes documentation and tests.
2015-12-02 18:16:38 +05:30
Brian Coca
c03afccc05 reformated test, changed big assert to with_items
much easier to see the individual condition that causes the failure
when using with_items and evaluating each part of the assert individually
2015-12-01 21:11:12 -08:00
James Cammarata
dc0fae1af7 Also make sure remote_user is defaulted correctly for delegated hosts
Fixes #13323
2015-11-30 16:15:14 -05:00
Chris Church
f3476b556d Add assertions for ansible_date_time in setup result. 2015-11-27 00:39:51 -05:00
James Cammarata
3c8c2fb090 Merge pull request #13208 from agx/zypper-integration-test
Add integration tests for zypper
2015-11-23 15:20:35 -05:00
James Cammarata
e62fb04a2e Merge pull request #13229 from zarnovican/bza_fix_test_hg
test_hg fix: remove reference to "head"
2015-11-23 14:34:13 -05:00
James Cammarata
138068c56e Merge pull request #13230 from zarnovican/bza_fix_test_svn
test_svn fix: remove hardcoded "~/ansible_testing/svn" path
2015-11-23 14:33:33 -05:00
Chris Church
272778f732 Modify task executor to reuse connection inside a loop. Fix WinRM connection to set _connected properly and display when remote shell is opened/closed. Add integration test using raw + with_items. 2015-11-23 11:53:05 -05:00
Brano Zarnovican
a30a52ef52 test_svn fix: remove hardcoded "~/ansible_testing/svn" path 2015-11-20 13:36:55 +01:00
Brano Zarnovican
5fc64deffe test_hg fix: remove reference to "head"
ERROR! error while evaluating conditional: head.stat.isreg

This is remnant from earlier change 50e5d81777
which removed stat on head file..
2015-11-20 13:02:17 +01:00
James Cammarata
91500f8f5f Fix include param precedence in variable manager 2015-11-19 09:01:51 -05:00
Guido Günther
0821d251c8 Add integration tests for zypper
Modeled after the yum tests but also tests local package installations
as fixed with PR#1256.

This depends on PRs #1256, #1261 and #1262 in ansible-modules-extra.
2015-11-18 18:25:43 +01:00
Will Thames
ff19233ad3 Add tests for #10620 2015-11-18 20:47:54 +10:00
Brano Zarnovican
90f99f29ae unittest cover for 'run_command'
All os.*, subprocess.* is mocked to avoid side-effects.
Tests are skipped in Py3, since 'run_command' is not Py3-ready, yet.
2015-11-17 11:57:50 +01:00
Brian Coca
e61882ca19 Merge pull request #13170 from robinro/integration_test_git_ansible-modules-core_pull_721
add test for changing git remote url
2015-11-16 14:53:47 -08:00
nitzmahone
349e072a74 fix for dynamic (add_host) hosts not available in hostvars
Looks like there are two pattern caches that need to be cleared for this to work- added the second one.
Added integration tests for add_host to prevent future regressions.
2015-11-16 10:53:10 -08:00
Will Thames
4f3430ebeb Handle unexpected database presence
Check for database presence in a nice way, rather than
dropping the database.

Thankfully there was a syntax error in the previous
version, so no database would have been dropped.
There was no check for whether it succeeded or not.
2015-11-15 10:45:24 +10:00
Robin Roth
6cefdfe148 add test for changing git remote url
integration test for https://github.com/ansible/ansible-modules-core/pull/721
clone a repo from one url
clone an updated version of that repo from a new url
make sure the remote url and the working copy are updated
2015-11-14 17:03:41 +01:00
Brian Coca
5d645f3a8b Merge pull request #13127 from willthames/test_become
Elevate privileges when checking for file existence
2015-11-12 22:35:01 -08:00
Toshio Kuratomi
318bfbb207 Migrate cli and dependencies to use global display 2015-11-11 10:44:22 -08:00
Brian Coca
206cc50bd9 breaks testing in non virtual envs, since env var can be used in those
cases removing it from here
2015-11-12 09:40:43 -08:00
Will Thames
5bb759e7ab Elevate privileges when checking for file existence
Certain OSs default to home directories as 0700
Without elevating privileges, checking for file existence
fails.
2015-11-11 23:42:35 +10:00
Toshio Kuratomi
74fe9d236a Add a disabled test for accessing private attributes of other objects
Need to cleanup the code before we can enable this test.
2015-11-10 09:50:27 -08:00
Toshio Kuratomi
aa034f4fcf Add unit tests for issue #12976 2015-11-05 10:52:37 -08:00
Toshio Kuratomi
37052a983a Fix unittest dailure with the new squash items code 2015-11-05 10:45:54 -08:00
James Cammarata
23ff08ee6b Merge pull request #13016 from dvarrazzo/pip-vcs-changed
Added tests to verify pip installation with VCS urls
2015-11-05 08:16:12 -05:00
Will Thames
91b6004149 Allow blank lines and comments/spaces in galaxy spec files
Fixes #10641 again. (Regression)
Added test to discourage future such regression.
2015-11-04 15:36:20 +10:00
Scott Miller
98b694f5ca Update README.md 2015-11-03 14:11:22 -05:00
Daniele Varrazzo
542a430e84 Added tests to verify pip installation with VCS urls
The test reproduces:
- bug ansible/ansible#1705
- bug ansible/ansible-modules-core#1645
2015-11-03 14:54:40 +00:00
Brian Coca
c267e1906e removed invocation from tests as it is only available on very very verbose mode 2015-10-31 13:00:53 -04:00
Chris Meyers
4b88cce6a1 update ansible_test_service checksum 2015-10-28 14:55:13 -04:00
Brian Coca
174de1161b fixed removing -n in password sudo tests 2015-10-28 02:36:28 -04:00
Brian Coca
b2fc5142eb moved sudo -S and -n into configurable flags as they might be absent in much older systems
if password is supplied exsiting -n would get remove from flags
2015-10-28 02:06:25 -04:00
James Cammarata
1910f23144 Merge pull request #12801 from chrismeyersfsu/fix-test_destructive_init
run correct init system tests
2015-10-27 15:58:19 -04:00
James Cammarata
9b22004540 Merge pull request #12795 from chrismeyersfsu/fix-test_destructive_mysql_user
remove module param quotes
2015-10-27 15:51:45 -04:00
Toshio Kuratomi
4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
Brian Coca
f78c82b9ee don't set user to current user
also remove condition to bypass setting user if user matches current user
this enables forcing user when set to the same user as current user and ignoring .ssh/config
while keeping .ssh/config with current user if nothing is specified.
2015-10-23 23:15:45 -04:00
Toshio Kuratomi
ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
2015-10-22 16:17:40 -07:00
Toshio Kuratomi
2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
2015-10-22 16:07:26 -07:00
James Cammarata
86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Toshio Kuratomi
ed6aa75d63 Add parsing test to travis to catch that invocation is missing 2015-10-22 09:03:12 -07:00
Toshio Kuratomi
6b6d03290a Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data."

This reverts commit 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
2015-10-22 08:53:37 -07:00
Will Thames
002972c6cf Allow meta/main.yml to include roles through spec file
ansible-playbook now works when run with a playbook
that includes a role that includes another role
specified using csv format

Updated one of the roles used in the tests to fix
broken tests - `make test_galaxy` now works

Fixes #11486. Also addresses the problem alluded to in #10620.
2015-10-22 13:30:42 +10:00
Toshio Kuratomi
5a0e63af1e Workaround seeming bug in python-2.6's sys.exit() 2015-10-21 11:54:02 -07:00
Toshio Kuratomi
6e5055e786 Update the use of no_log values to cover everything that heuristic_log_sanitize does.
Fixes #12792
2015-10-21 08:15:46 -07:00
Chris Meyers
6c265cde49 invoke systemd test for ubuntu >= 15.04 else invoke upstart test 2015-10-21 09:15:27 -04:00
Toshio Kuratomi
c2d188baff Hide values in json returns which were given in parameters marked no_log. 2015-10-20 12:42:36 -07:00
Toshio Kuratomi
a22cf8ffc1 Properly add the new test and limit six test to lib 2015-10-19 18:39:15 -07:00
Chris Meyers
f864fa8727 run systemd tests for fedora 2015-10-19 13:21:34 -04:00
Brian Coca
c1a404e6ec Merge pull request #12799 from resmo/for-ansible
cloudstack: add tests for cs_loadbalancer_rule and _member
2015-10-19 11:15:12 -04:00
James Cammarata
2346a7f170 Merge pull request #12800 from chrismeyersfsu/fix-test_destructive_yum
remove invocation keyword check
2015-10-18 10:19:08 -04:00
James Cammarata
549bdb2503 Merge pull request #12804 from chrismeyersfsu/fix-test_non_destructive_makefile
allow env variable override of creds file
2015-10-18 10:18:22 -04:00
Chris Meyers
1b2d17b844 allow env variable override of creds file
This is important because there is an integration test, test_git, that
require an ssh key to clone a privileged github repo.
2015-10-17 12:45:29 -04:00
James Cammarata
8baea3cba8 Merge pull request #12796 from chrismeyersfsu/fix-test_destructive_mysql_variables
fix up mysql variable assertion logic
2015-10-17 10:14:08 -04:00
Chris Meyers
d6dfd9f502 run correct init system tests 2015-10-17 09:25:49 -04:00
Chris Meyers
5177cb3f74 remove invocation keyword check 2015-10-17 09:24:03 -04:00
Rene Moser
bb5dcc00b6 cloudstack: add tests for cs_loadbalancer_rule and _member 2015-10-17 14:01:02 +02:00
James Cammarata
450c8d45c6 Merge pull request #12787 from chrismeyersfsu/fix-test_destructive_apt
keyword not in ubuntu 14.04
2015-10-17 07:43:34 -04:00
Chris Meyers
75833c248e fix up mysql variable assertion logic 2015-10-16 18:42:03 -04:00
Chris Meyers
ce4e98a6d0 remove module param quotes 2015-10-16 18:39:02 -04:00
Toshio Kuratomi
eebd3cc336 Merge pull request #12788 from chrismeyersfsu/fix-test_destructive_state
remove non-existant state var
2015-10-16 12:43:40 -07:00
Chris Meyers
a0264983ad remove non-existant state var 2015-10-16 15:40:31 -04:00
Chris Meyers
5c01622457 keyword not in ubuntu 14.04 2015-10-16 15:37:39 -04:00
Brian Coca
6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
2015-10-16 15:05:23 -04:00
Toshio Kuratomi
49f2b84253 Add a code smell test to make sure we're not using the raw system six
(So we know we have a recent enough version)
2015-10-16 10:31:35 -07:00
Toshio Kuratomi
baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Marius Gedminas
04a7ef416e Python 3: print function in a shell oneliner in Makefile
Fixes

    File "<string>", line 1
      import string,random; print 'ansible-testing-' + ''.join(random.choice(string.ascii_letters + string.digits) for _ in xrange(8));
                                                   ^
  SyntaxError: invalid syntax

when running integration tests with

  . hacking/env-setup
  . .tox/py35/bin/activate
  make -C test/integration test_var_precedence
2015-10-16 17:41:01 +03:00
Marius Gedminas
ec3ada1cda Fix test on Python 3: vault code expects bytes
(All tests now succeed on Python 3.5)
2015-10-16 09:13:46 +03:00
Marius Gedminas
5c70f932bd Fix test on Python 3: vault code expects bytes
(Third failing test out of four.)
2015-10-16 09:12:49 +03:00
Marius Gedminas
a1d95536f9 Fix test on Python 3: vault code expects bytes
(Different test than the last commit.)
2015-10-16 09:11:34 +03:00
Marius Gedminas
f58f0c62e1 Fix test on Python 3: vault code expects bytes 2015-10-16 09:10:25 +03:00
Brian Coca
9b088a1e40 implemented inventory_hostname lookup in v2 2015-10-15 13:11:42 -04:00
Chris Church
cb9f350c8f Merge pull request #12720 from jhawkesworth/test_amc_2147
integration tests for ansible modules core 2147
2015-10-14 15:35:21 -04:00
Marius Gedminas
225fe85530 Skip test_module_utils_basic_ansible_module_creation on Python 3
This reverts commit 073f10a52a and instead
disables the failing test.

We're focusing on Python 3 support on the controller first; modules will
come later.
2015-10-14 09:32:26 +03:00
James Cammarata
e6d3c6745f Revert to using local file/dir tests in inventory instead of loader's
Fixes #12719
2015-10-13 12:04:01 -04:00
=
e141101314 integration tests for ansible modules core 2147 2015-10-13 06:34:18 +01:00
Toshio Kuratomi
15d7f53846 AnsibleModules.log() fix for python3
Also add unittests for AnsibleModules.log()

Fixes #12586
2015-10-12 13:30:27 -07:00
James Cammarata
0e1a5919c8 Adding unit tests for PlaybookExecutor _get_serialized_batches 2015-10-12 11:27:37 -04:00
Brian Coca
abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
2015-10-09 13:01:32 -04:00
James Cammarata
de792ba3c2 Improve handling of unicode errors
Fixes #12669
2015-10-08 10:04:15 -04:00
James Cammarata
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
Brian Coca
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
Brian Coca
5680a9fa32 removed redundant tests, adjusted makefile expected count 2015-10-02 22:37:19 -04:00
Brian Coca
e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
Brian Coca
5c39538a73 added no_log tests as per #12214 2015-10-02 09:11:41 -04:00
James Cammarata
775486c9d6 Merge pull request #12589 from jemmyw/consul-http-checks
Update consul integration test with http checks
2015-10-01 10:44:31 -04:00
Marius Gedminas
0371b14567 Fix test: selinux gets passed byte strings
(I don't have a system with selinux to test if the module still wants
byte strings even on Python 3.)
2015-09-30 18:46:50 +03:00
Marius Gedminas
500e7a1263 Fix test: _to_filesystem_str produces byte strings 2015-09-30 18:46:49 +03:00
Marius Gedminas
f7571cb37f Python 3: there's no __builtin__ module
This caused an ImportError in a test module and showed up as one test
failure.  Now the test module can get imported and many more tests fail
(on Python 3).  Such is life.  ;-)
2015-09-30 18:40:47 +03:00
Brian Coca
ddafed4403 Merge pull request #12528 from bcoca/task_logging
task logging revamp
2015-09-30 11:38:34 -04:00
James Cammarata
6339bf8a82 Merge branch 'tests' of https://github.com/amenonsen/ansible into amenonsen-tests 2015-09-30 08:06:52 -04:00
James Cammarata
dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 2015-09-30 08:05:55 -04:00
Abhijit Menon-Sen
d100db837b Add basic tests for expand_hostname_range 2015-09-30 16:28:45 +05:30
Abhijit Menon-Sen
838e71edb7 Add more exhaustive tests for various IPv6 address notations 2015-09-30 16:15:39 +05:30
Brian Coca
8d024c3747 Merge pull request #12472 from resmo/for_ansible
cloudstack: improvements and tests
2015-09-28 14:27:22 -04:00
Brian Coca
37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
2015-09-25 23:57:28 -04:00
James Cammarata
ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata
31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
Toshio Kuratomi
a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
2015-09-24 13:33:57 -07:00
Toshio Kuratomi
03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
2015-09-24 08:57:19 -07:00
Marius Gedminas
0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
2015-09-24 12:46:06 +03:00
Marius Gedminas
a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 2015-09-24 12:43:33 +03:00
Marius Gedminas
5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
2015-09-24 12:36:05 +03:00
Rene Moser
9514ac860d cloudstack: more integration tests 2015-09-22 16:17:21 +02:00
Abhijit Menon-Sen
2fcdb37e7b Support «hosts: groupname[1:]» notation (~= 'the rest of the group') 2015-09-18 22:28:34 +05:30
Abhijit Menon-Sen
21142f5723 Add some tests for split/apply_subscript 2015-09-18 22:15:28 +05:30
Abhijit Menon-Sen
2d420a9bb7 Allow hexadecimal ranges in IPv6 addresses, not only 0-9 2015-09-17 23:32:58 +05:30
James Cammarata
951128d7a6 Merge branch 'hostpatterns' of https://github.com/amenonsen/ansible into amenonsen-hostpatterns 2015-09-17 13:31:51 -04:00
Victor Salgado
01ae60d524 Add more tests for _split_pattern for when the input is a list 2015-09-17 13:50:40 -03:00
Abhijit Menon-Sen
abd006657b Add test/units/inventory with a few _split_pattern tests
There were no inventory-specific unit tests earlier, so we add a new
directory for them with some initial low-level tests of _split_pattern
with various valid and deprecated pattern strings.
2015-09-17 19:32:14 +05:30
Florian Apolloner
d9f873495e Ported over #7158 to support SELinux context switches. 2015-09-17 15:03:46 +02:00
Florian Apolloner
8548690ca3 Added a test to ensure that sudo is only used if remote and become user difer. 2015-09-17 14:25:52 +02:00
Toshio Kuratomi
3db8070aa3 Fix urlopen usage to use open_url instead
Add a travis test for urlopen usage
2015-09-16 20:40:17 -07:00
Chris Church
43b15ab9a4 Merge pull request #12385 from cchurch/winrm_put_empty_file
Enable winrm put_file to upload an empty file.
2015-09-16 16:46:01 -04:00
Chris Church
93af0b327f Merge pull request #12384 from cchurch/powershell_strict_mode
Add PowerShell exception handling and turn on strict mode.
2015-09-16 16:45:40 -04:00
Chris Church
1d15e8f37a Pass windows command as-is without splitting/rejoining parameters.
* Fixes extra spaces added between parameters from https://github.com/ansible/ansible-modules-core/issues/1929
* Correctly decode PowerShell command encoded as UTF-16-LE so that it displays correctly in debug messages, fixes the other issue from https://github.com/ansible/ansible-modules-core/issues/1929
* Add test to verify that script parameters are passed as-is, so $true is interpreted as a boolean, fixes https://github.com/ansible/ansible/issues/10947
2015-09-16 16:30:10 -04:00
Chris Church
87db5119ea Merge pull request #12049 from cchurch/win_group_tests
Add integration tests for win_group module.
2015-09-16 16:27:44 -04:00
Chris Church
b44e02143a Merge pull request #12050 from cchurch/test_win_msi_creates
Add tests for creates parameter to win_msi module.
2015-09-16 16:22:47 -04:00
James Cammarata
3f8e12d1f7 Merge pull request #12359 from cchurch/fetch_no_fail_on_missing
Fix fetch to not fail for missing file when fail_if_missing=False
2015-09-16 11:05:39 -04:00
Chris Church
6ab4cff7db Enable winrm put_file to upload an empty file. 2015-09-15 17:21:27 -04:00
Chris Church
5c65ee7f0c Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-09-15 16:32:35 -04:00
James Cammarata
d818a72375 Merge branch 'normalize_plugin_paths' of https://github.com/bcoca/ansible into bcoca-normalize_plugin_paths 2015-09-15 14:41:09 -04:00
Chris Church
15070e2af8 Merge pull request #11790 from brianlloyd/win_lineinfile
Integration tests for windows implementation of lineinfile
2015-09-15 13:00:36 -04:00
Brian Coca
b6d6c2e4db corrected all missing paths changes 2015-09-15 11:57:54 -04:00
Chris Church
904b8ca27b Update win_msi tests to specify msi url and paths via variables. 2015-09-15 01:15:33 -04:00
Chris Church
0300294f6e Add tests for creates parameter to win_msi module. 2015-09-15 01:15:33 -04:00
Chris Church
260b9f648c Fix fetch action plugin to not fail if file is missing and fail_if_missing=False (the default). Add tests to test_fetch role to verify it works as expected. 2015-09-14 14:21:52 -04:00
James Cammarata
36b5858f51 Fix unit tests for change related to local_action 2015-09-14 14:07:17 -04:00
James Cammarata
49ca0eb797 Track local_action internally to prevent it from being overridden
Fixes #12053
2015-09-14 12:11:58 -04:00
Abhijit Menon-Sen
88a20e7a20 Fix broken integration test with unicode hostnames
1. The test did "name: '{{hostnames}}.{{item}}'" inside a with_sequence
   loop, which didn't do what was intended: it expanded hostnames into
   an array, appended ".1", and set name to the resulting string. This
   can be converted to a simple with_items loop.

2. Some of the entries in hostnames contained punctuation characters,
   which I see no reason to support in inventory hostnames anyway.

3. Once the add_host failures are fixed, the playbook later fails when
   the unicode hostnames are interpolated into debug output in ssh.py
   due to an encoding error. This is only one of the many places that
   may fail when using unicode inventory hostnames; we work around it
   by providing an ansible_ssh_host setting.
2015-09-11 21:47:19 +05:30
Abhijit Menon-Sen
7479ab47e0 Be stricter about parsing hostname labels
Labels must start with an alphanumeric character, may contain
alphanumeric characters or hyphens, but must not end with a hyphen.
We enforce those rules, but allow underscores wherever hyphens are
accepted, and allow alphanumeric ranges anywhere.

We relax the definition of "alphanumeric" to include Unicode characters
even though such inventory hostnames cannot be used in practice unless
an ansible_ssh_host is set for each of them.

We still don't enforce length restrictions—the fact that we have to
accept ranges makes it more complex, and it doesn't seem especially
worthwhile.
2015-09-11 21:47:19 +05:30
Abhijit Menon-Sen
065bb52109 Be systematic about parsing and validating hostnames and addresses
This adds a parse_address(pattern) utility function that returns
(host,port), and uses it wherever where we accept IPv4 and IPv6
addresses and hostnames (or host patterns): the inventory parser
the the add_host action plugin.

It also introduces a more extensive set of unit tests that supersedes
the old add_host unit tests (which didn't actually test add_host, but
only the parsing function).
2015-09-11 21:47:18 +05:30
Marius Gedminas
f91b28ef23 Fix safe_eval() of set literals
There was code to support set literals (on Python 2.7 and newer), but it
was buggy: SAFE_NODES.union() doesn't modify SAFE_NODES in place,
instead it returns a new set object that is then silently discarded.

I added a unit test and fixed the code.  I also changed the version
check to use sys.version_tuple instead of a string comparison, for
consistency with the subsequent Python 3.4 version check that I added in
the previous commit.
2015-09-11 09:41:05 +03:00
Brian Coca
5809a2e81d Merge pull request #12299 from resmo/feature/test_cs_user
cloudstack: new integration test role test_cs_user
2015-09-10 20:09:59 -04:00
James Cammarata
444987cde6 Fix unit test for plugins after basedir/push_basedir removal 2015-09-10 17:01:52 -04:00
Rene Moser
f6382a160d cloudstack: new integration test role test_cs_user 2015-09-09 22:36:19 +02:00
Toshio Kuratomi
e2c49b4ef4 Fix problem with "=" in the initial file path. 2015-09-09 11:14:31 -07:00
Toshio Kuratomi
3a50393cf7 Merge pull request #12269 from mgedmin/py3k
Python 3: fix TypeError: unorderable types in test
2015-09-08 18:11:31 -07:00
Toshio Kuratomi
c1039de70c Compatibility with six-1.3.0 2015-09-08 09:46:12 -07:00
James Cammarata
ac6f61ec7f Properly handle group/host_var files with dots in them
Fixes #12245
2015-09-08 03:20:09 -04:00
Marius Gedminas
c22f4ee697 Add a comment explaining why async = 1 in the test 2015-09-07 19:46:05 +03:00
Marius Gedminas
1a1c9203e2 Python 3: fix TypeError: unorderable types in test
The full error was

======================================================================
ERROR: test_task_executor_execute (units.executor.test_task_executor.TestTaskExecutor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mg/src/ansible/test/units/executor/test_task_executor.py", line 252, in test_task_executor_execute
    mock_action.run.return_value = dict(ansible_facts=dict())
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 317, in _execute
    if self._task.async > 0:
TypeError: unorderable types: MagicMock() > int()

----------------------------------------------------------------------

Experiments show that Python 2 MagicMock() > 0 is true, so I'm setting
the async property on mock_task to 1.  (If I set it to 0, the test fails
anyway.)
2015-09-07 09:49:28 +03:00
James Cammarata
ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
2015-09-04 16:41:38 -04:00
Brian Coca
c17fbf2f12 simplify become testing and handling, we had drifted and were doulbe checking prompt, become and become_pass
fixed tests to conform to new signature and now tests both with and w/o password
now we are more explicit about self.prompt
2015-09-04 10:36:16 -04:00
Toshio Kuratomi
e218bf8da9 Do not escape backslashes when processing a template file.
Fixes #12198
Fixes #12241
2015-09-03 17:45:17 -07:00
James Cammarata
b2cb3153f1 Fix unit tests for PlayIterator changes regarding fact gathering 2015-09-03 14:25:43 -04:00
Marius Gedminas
a32bf1ec18 Simplify FactCache.copy()
Also fix the bug (missing from six import iteritems) I introduced in
823677b490.
2015-09-03 09:44:44 +03:00
Marius Gedminas
823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
2015-09-03 09:23:27 +03:00
Toshio Kuratomi
1b64702b9a Fix templar unittests for change in preserve_trailing_newline parameter's default value 2015-09-02 11:58:01 -07:00
James Cammarata
45aac6a739 Adding unit tests for safe_eval 2015-09-02 14:12:06 -04:00
James Cammarata
843138e7d9 Merge pull request #12202 from mgedmin/py3k
Use rich comparisons for Attribute and FieldAttribute
2015-09-02 13:57:04 -04:00
Toshio Kuratomi
9ecfc30f9a * Mark all strings as unicode -- shouldn't matter for this dataset but
ansible is passing unicode arond internally so we should test the same
  data.
* Add a zero length test for _count_newlines and fix the zero newlines
  test to have no newlines.
2015-09-02 09:43:42 -07:00
Toshio Kuratomi
417bf1c805 Unittest the _count_trailing_newlines function 2015-09-02 08:59:31 -07:00
Brian Coca
a7231c2203 actually implemented flags correctly for all priv escalation methods 2015-09-02 11:31:39 -04:00
Brian Coca
14f061d5ea fixed become tests 2015-09-02 10:30:00 -04:00
Marius Gedminas
33a374edde Use rich comparisons for Attribute and FieldAttribute
Because __cmp__ is not supported on Python 3.
2015-09-02 12:33:42 +03:00