Commit graph

499 commits

Author SHA1 Message Date
Marius Gedminas
c846bab69b Fix assert statement syntax
`assert (condition, message)` gets parsed by Python as `assert
a_two_tuple`, and a 2-element tuple is never False.

Discovered by compileall on Python 3.4, which emits a SyntaxWarning for
this common mistake.
2015-08-27 22:15:57 +03:00
Marius Gedminas
727cb8a917 Support print() function in test/ 2015-08-27 22:15:57 +03:00
Marius Gedminas
9ae66a7f5c Use 'except ... as' syntax in contrib/ and test/ too 2015-08-27 22:15:57 +03:00
James Cammarata
601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
Toshio Kuratomi
9f9891df2c Add unicode characters to the data that we're testing that ansible-vault can decrypt 2015-08-25 15:14:43 -07:00
Brian Coca
3e13dfd7e8 used stdoutlines list to avoid string mismatches
added block environment test
2015-08-25 10:06:24 -04:00
Brian Coca
efa005c228 added names to assert tasks for easier debugging 2015-08-24 22:57:56 -04:00
Brian Coca
d6a1cbeefb corrected varname that started with number and broke templating 2015-08-24 22:44:12 -04:00
Brian Coca
104b8a9a7b avoid hostvars which is not a dict 2015-08-24 22:44:12 -04:00
Brian Coca
857d74a274 made diff ignore whitespace 2015-08-24 22:44:12 -04:00
Brian Coca
6da2587c36 Merge pull request #12058 from resmo/for-ansible
cloudstack: more integration tests and updates
2015-08-24 10:03:58 -04:00
James Cammarata
db65503778 Revert "Add PowerShell exception handling and turn on strict mode." 2015-08-23 21:09:16 -04:00
Rene Moser
69d5e62083 cloudstack: test_cs_account: account_state was renamed, fixes tests 2015-08-23 22:50:23 +02:00
Rene Moser
eb44f85dc8 cloudstack: test_cs_instance: make it more configurable 2015-08-23 22:49:45 +02:00
Rene Moser
15a7f818e1 cloudstack: add more integration tests 2015-08-23 22:48:32 +02:00
Chris Church
af9200c2de Add integration tests for win_group module. 2015-08-22 18:49:55 -04:00
Chris Church
4b2cdadc98 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-08-22 18:28:07 -04:00
Brian Coca
01708cc824 added test for environment directive 2015-08-21 00:37:17 -04:00
Feanil Patel
892e230514 Don't convert nulls to strings.
This change is similar to https://github.com/ansible/ansible/pull/10465

It extends the logic there to also support none types.  Right now if you have
a '!!null' in yaml, and that var gets passed around, it will get converted to
a string.

eg. defaults/main.yml
```
ENABLE_AWESOME_FEATURE: !!null # Yaml Null
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  features:
    awesame_feature: "{{ ENABLE_AWESOME_FEATURE}}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the feature flag would get represented in the output
as a string instead of as a null, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

I also updated the template test to test for this and made the changes to v2.

Added a changelog entry specifically for the change from empty string to null as the default.

Made the null representation configurable.

It still defaults to the python NoneType but can be overriden to be an emptystring by updating
the DEFAULT_NULL_REPRESENTATION config.
2015-08-19 18:35:07 -04:00
Rene Moser
9d3577a74a cloudstack: fix tests unhashable type: 'dict' 2015-08-19 21:39:58 +02:00
Rene Moser
8f3c181d90 cloudstack: tests: use resource_prefix 2015-08-19 21:37:54 +02:00
Jeremy Wells
9f9f476b6e Update consul integration test with http checks 2015-08-19 00:38:36 +02:00
Brian Coca
1acb29ff9b sequence will now run once for start=end, added test to suite
fixes #11979
2015-08-18 02:33:23 -04:00
Brian Coca
43cc27084d corrected on delete also 2015-08-13 09:58:30 -04:00
Brian Coca
089687140d corrected role path 2015-08-13 09:57:36 -04:00
Brian Coca
033c77a13b now creates/removes files/ dir 2015-08-13 09:54:06 -04:00
Brian Coca
464a436f8f fixed testplay host, included lookup path tests in all, added stage for easier debugging 2015-08-12 19:26:52 -04:00
Brian Coca
60803a1d3c added lookup paths testing 2015-08-12 19:26:52 -04:00
Yannig Perré
47db352725 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-05 11:20:41 +02:00
Yannig Perré
c0bd140959 Add documentation for the ini lookup plugin. 2015-08-05 11:09:40 +02:00
Yannig Perré
733d40a77c When value does not exist, return default value instead of stopping ansible with an exception. 2015-08-05 10:54:24 +02:00
Brian Coca
aefca24616 Merge pull request #10857 from jeffb-stell/devel
Add test for https://github.com/ansible/ansible/issues/9851
2015-08-03 19:23:59 -04:00
James Cammarata
a586c74967 Merge pull request #11838 from cchurch/stringify_powershell_unquote_value
Fix for PowerShell unquote method when passed None.
2015-08-02 22:57:27 -04:00
Chris Church
cafc35fd5b Fix for PowerShell unquote method when passed None. 2015-08-02 18:38:29 -04:00
Chris Church
6969b5ac8b Make sure raw doesn't eat key=value arguments. 2015-08-02 11:57:32 -04:00
Chris Church
2154212491 Merge pull request #11094 from cchurch/test_win_feature_has_servermanager
Only run win_feature tests when the host has the ServerManager module.
2015-07-31 17:52:45 -04:00
Chris Church
e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-31 14:38:31 -04:00
Brian Coca
c2d8ca4bf7 fixed test to expected output 2015-07-30 18:36:54 -04:00
Brian Lloyd
07b14b9731 integration tests for windows implementation of lineinfile 2015-07-29 19:50:06 -04:00
James Cammarata
ba56beda90 Fix include task using a potentially undefined variable 2015-07-29 15:49:29 -04:00
James Cammarata
71867f9480 Remove vars attribute from base
Fixes #11779
2015-07-29 09:45:30 -04:00
James Cammarata
e505a1b7c4 Fix variable precedence integrationt test 2015-07-28 00:51:58 -04:00
Brian Coca
c76a66694f fixed typo 2015-07-27 22:54:57 -04:00
Michael Scherer
106e942faa Document and test 'is undefined' rather than 'is not defined'
According to https://github.com/ansible/ansible/issues/10273,
this syntax should work better for nested dicts.
2015-07-25 14:05:27 +02:00
Toshio Kuratomi
b06353791c Don't pass mode from synchronize action plugin to the ansible module
Fixes https://github.com/ansible/ansible-modules-core/issues/1783
2015-07-23 00:42:27 -07:00
James Cammarata
46f74a0d69 Re-adding --start-at-task test to unicode integration test 2015-07-21 12:36:41 -04:00
James Cammarata
b09eed3353 Merge branch 'test_notify_with_loops' of https://github.com/pilou-/ansible into pilou--test_notify_with_loops 2015-07-20 21:09:34 -04:00
James Cammarata
dca36c1d16 Reestablishing the use of tags/when for role duplication detection
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
Pierre-Louis Bonicoli
aa23ea8462 tests: checks that handlers work with loops 2015-07-20 14:41:03 +02:00
Brian Coca
9dc5607730 Merge pull request #11519 from bcoca/human_readable
new human_readable filter to transform bits and bytes into cake
2015-07-18 23:10:53 -04:00
James Cammarata
d6b058eaae Removing invocation from async test, as it's pointless 2015-07-15 12:03:02 -04:00
Toshio Kuratomi
327b1676a8 Add support for SNI and TLS-1.1 and TLS-1.2 to the fetch_url() helper
Fixes #1716
Fixes #1695
2015-07-14 12:48:35 -07:00
Brian Coca
f6c64a8c00 fixed var file loading 2015-07-14 12:12:43 -04:00
Brian Coca
5eb25a48ee added empty include test 2015-07-14 12:06:31 -04:00
Brian Coca
22165dd046 fixed bad parsing tests 2015-07-14 12:06:31 -04:00
Brian Coca
44aef347cb enabled good parsing tests in parsing target
fixed test_good_parsing role
added raw duplicate parameters to test_good_parsing
2015-07-14 08:05:57 -04:00
James Cammarata
6971e92f39 Fixing up some output stuff 2015-07-14 00:23:17 -04:00
Brian Coca
b4de103bb2 Merge pull request #11555 from cchurch/test_win_get_url_updates
Update tests for win_get_url module to test force parameter
2015-07-10 17:07:20 -04:00
Chris Church
1aa2191fd5 Update tests for win_get_url module to test force parameter and invalid URLs/paths. 2015-07-10 15:54:18 -04:00
Brian Coca
c6dde19a5e Merge pull request #11537 from chrismeyersfsu/azure-test
assert password or ssh key provided on new image creation
2015-07-10 13:57:15 -04:00
Brian Coca
9c5a6d7b5a fixed all references to old plugins/inventory to point at contrib/inventory 2015-07-10 13:00:12 -04:00
James Cammarata
5430169b77 Cleaning up includes test to match 2.0 behavior
* Perhaps the only precedence change, in 2.0+ variables from set_fact
  will not override params to an include file, as params are expected
  to be more specific than host-based variables.
* Uncommented long-form include example.
2015-07-10 11:22:51 -04:00
James Cammarata
b520d5bc60 Lots of fixes for integration test bugs 2015-07-10 01:53:59 -04:00
Chris Meyers
32685f9648 assert password or ssh key provided on new image creation 2015-07-09 13:44:09 -04:00
James Cammarata
27fcf1a4b5 Fix bug in registered variables related to delegate_to changes 2015-07-08 12:38:24 -04:00
James Cammarata
f5baad4fb2 Removing unicode --start-at-task test for now as we haven't added that back into devel 2015-07-08 12:23:42 -04:00
James Cammarata
64a1b1e043 Fix first_available_file: support for copy and template actions 2015-07-08 12:23:42 -04:00
Brian Coca
48827a31bc added minimal testing for special template vars 2015-07-07 20:11:55 -04:00
Brian Coca
688088547b new human_readable filter to transform bits and bytes into cake (not really) 2015-07-07 15:58:18 -04:00
Brian Coca
5122455db8 ported missing sequence updates from 1.9 2015-07-03 13:54:51 -04:00
Matt Martz
43f81c7c01 Fix YAML formatting issue for rax integration tests 2015-06-30 09:38:12 -05:00
Brian Coca
200706d5ab Merge pull request #9812 from fgsch/fix_1904
Allow globbing in creates= and removes= directives
2015-06-30 07:58:54 -04:00
Matt Martz
c440762b61 Make the wait_timeout for rax tests a configurable default 2015-06-29 12:09:16 -05:00
Matt Martz
b370f6efce Add tests for rax_scaling_group 2015-06-18 13:08:35 -05:00
Toshio Kuratomi
605ddad37e Add test that url lookup checks tls certificates 2015-06-16 09:46:17 -07:00
James Cammarata
d913f169a8 Update failed_when integration test to be more thorough 2015-06-16 11:00:11 -04:00
Brian Coca
5ed2e44026 adjusted with_dict test to now work 2015-06-15 17:42:40 -04:00
Brian Coca
dc31086a17 added with_dict test 2015-06-15 17:12:36 -04:00
Brian Coca
11f1d99a5b added test for first_available and copy 2015-06-12 23:54:09 -04:00
Brian Coca
b9bb3e83b7 added new test that allows for listed bare strings
now with_times: barestring, will error out in test
2015-06-11 13:45:04 -04:00
Brian Coca
aa6e204b6e Merge pull request #11115 from jhawkesworth/second_go_at_fixing_1404
Part fix for https://github.com/ansible/ansible-modules-core/issues/1404 (replaces #11086)
2015-06-10 20:43:32 -04:00
James Cammarata
e547e1f9ba Merge branch 'devel' into devel_switch_v2 2015-06-01 16:53:15 -05:00
James Cammarata
fe41f109a9 Merge branch 'v2_final' into devel_switch_v2 2015-06-01 16:42:59 -05:00
James Cammarata
4bc7703db3 Fixing some small bugs related to integration tests (v2) 2015-06-01 16:42:10 -05:00
Jon Hawkesworth
30b92a6f4c Get-FileChecksum allways returns a string now,
and the test_win_copy integration tests that depend on the checksum
have been updated in this change too.
2015-06-01 21:53:49 +01:00
Chris Church
d2ba0de6aa When running winrm tests against multiple hosts, fail the play when any host has a failure. 2015-05-31 23:16:45 -04:00
Chris Church
8d742df1de Allow prepare_win_tests role to run multiple times, before each role that depends on it. 2015-05-31 23:15:28 -04:00
Chris Church
1e418fe56a Only run win_feature tests when the host has the ServerManager module. 2015-05-29 13:57:11 -04:00
Toshio Kuratomi
ac14ad1419 Test on fields that are actually set 2015-05-28 17:02:48 -07:00
Toshio Kuratomi
73b7d96501 Test on fields that exist 2015-05-28 17:01:18 -07:00
Toshio Kuratomi
1bda7cc200 Test that uri module validates certs 2015-05-28 15:35:45 -07:00
Toshio Kuratomi
0f4a3409d8 Add test that validate_certs=no works 2015-05-28 15:35:25 -07:00
James Cammarata
60bea844b3 Merge branch 'v2_final' into devel_switch_v2 2015-05-28 15:27:09 -05:00
James Cammarata
2bad888f28 Merge branch 'v2_final' into devel_switch_v2
Conflicts:
	lib/ansible/inventory/__init__.py
	lib/ansible/modules/core
	lib/ansible/utils/__init__.py
	lib/ansible/utils/module_docs.py
2015-05-28 15:26:03 -05:00
Toshio Kuratomi
afc19894e1 Make fetch_url check the server's certificate on https connections 2015-05-28 13:20:40 -07:00
Toshio Kuratomi
1ccf2a4685 Make fetch_url check the server's certificate on https connections 2015-05-28 12:35:37 -07:00
Toshio Kuratomi
b91532aff3 Drop the mysql test db first so that we test with a clean slate. 2015-05-27 13:39:09 -07:00
Yannig Perre
c2968d6d84 New lookup plugin : ini. Can handle ini file and java properties file.
Can also read a list of value in a section using regexp.
2015-05-27 21:51:20 +02:00
Toshio Kuratomi
a8d52e3e94 Have to setup the proper mime-types before importing SImpleHttpServer 2015-05-21 12:24:41 -07:00
Toshio Kuratomi
7af2632c87 Forgot to invoke wrapper instead of SimpleHttpServer 2015-05-21 11:56:58 -07:00