Commit graph

605 commits

Author SHA1 Message Date
Tom Melendez
d09ad82e71 Add regex support to gce_tag module, add unit tests and update integration test. (#19087)
The gce_tag module can support updating tags on multiple instances via an instance_pattern field.  Full Python regex is supported in the instance_pattern field.

'instance_pattern' and 'instance_name' are mutually exclusive and one must be specified.

The integration test for the gce_tag module has been updated to support the instance_pattern parameter.  Unit tests have been added to test the list-manipulation functionality.

Run the integration test with:

TEST_FLAGS='--tags "test_gce_tag"' make gce

Run the unit tests with:

python test/units/modules/cloud/google/test_gce_tag.py
2016-12-29 08:45:20 -05:00
Will Thames
5f0815d7f4 Fix too-many-quote problem in setup_ec2 role
An inner single-quote pair breaks out of the outer single-quote
pair. Rather than escaping the inner quotes to protect against
this, just use the fact that `str()` is equivalent to `""`.
2016-12-22 10:18:56 -08:00
Adrien Vergé
0e834fc9e4 Fix cosmetic problems in YAML source
This change corrects problems reported by the `yamllint` linter.

Since key duplication problems were removed in 4d48711, this commit
mainly fixes trailing spaces and extra empty lines at beginning/end of
files.
2016-11-11 14:50:57 -08:00
Tom Melendez
b9e07c8dd7 [GCE] updates to gce integration test (#18097)
* Added test for sequenced-name instance generation (num_instances)
* Added param-check tags to tests that only do argument checking
Should be merged AFTER ansible/ansible-modules-core#4276
2016-11-11 13:17:47 -05:00
Tom Melendez
28dc527b2c Basic integration test for gce_tag. (#17928) 2016-11-04 15:31:19 -04:00
Matt Clay
86c5eddb05 Move ec2_vpc_nat_gateway integration test role. 2016-10-31 14:07:05 -07:00
Matt Clay
c2ec86cb78 Migrate Windows CI roles to test targets. (#18005) 2016-10-13 18:03:19 +01:00
Matt Clay
75e4645ee7 Migrate Linux CI roles to test targets. (#17997) 2016-10-13 09:09:25 -07:00
Matt Clay
374e4348e4 Split out var_blending test into targets dir. (#17996) 2016-10-12 22:22:46 -07:00
Matt Clay
410b96d716 Clean up integration tests. (#17991) 2016-10-12 19:33:12 -07:00
Matt Clay
80a5c70ad7 Split integration tests out from Makefile. (#17976) 2016-10-12 14:57:53 -07:00
Matt Davis
aa0ad073b8 bugfixes to JSON junk filter, added unit/integration tests to exercise (#17834) 2016-10-02 08:03:42 -07:00
Matt Clay
6d78397b8b Update get_url test to use httptester. (#17787) 2016-09-27 18:11:09 -07:00
Toshio Kuratomi
0bf92d2b5c Add tests for the mount module (#17718)
* Add tests for the mount module

* Switch from unmounted to absent...

the code for mounting always modifies fstab so we need to always modify
fstab to cleanup as well.

* Fix comments and copyright
2016-09-23 12:38:31 -07:00
Tom Melendez
97a1b7ded1 Integration Playbook for Google Cloud DNS module. (#17698) 2016-09-22 14:40:57 -04:00
Matt Clay
3874e653c1 Remove tests for deprecated su and sudo. (#17697) 2016-09-21 15:12:26 -07:00
Tom Melendez
0e85f88f8e test_gce_mig integration test playbook (#17249)
Includes:
* Tests to create, delete, resize, recreate and configure an Autoscaler
* Tests for parameters only.  Use TEST_FLAGS="--tags 'param-check'" to execute only these tests.

Requires:
* An instance template to be configured in your project.
2016-09-21 17:48:09 -04:00
Matt Clay
39c5c558f8 Switch tests from sudo to become. (#17694) 2016-09-21 13:58:35 -07:00
Toshio Kuratomi
7889e1ffc1 Additional tests for check mode idempotence (#17679) 2016-09-20 17:56:07 -07:00
Matt Clay
e0ad02c6dd Remove test for deprecated first_available_file. (#17674) 2016-09-20 13:45:57 -07:00
Rob Cutmore
2716fe4362 Add test for checking pip package in check mode (#17360) 2016-09-20 07:07:27 -07:00
Steve Gargan
a06da86d52 update consul tests to reflect fixes to the core and session modules (#17451) 2016-09-16 14:58:17 -07:00
Matt Clay
355b29573c Use default on undefined vars in tests. (#17601) 2016-09-15 16:07:55 -07:00
Matt Clay
16baef1f72 Do not use bare vars in integration tests. (#17599) 2016-09-15 17:41:54 -04:00
Matt Davis
f497d771c8 win_shell/win_command changes + tests (#17557) 2016-09-15 11:25:56 -07:00
Matt Clay
7b3cbafbe9 Add python 3 awareness to apt module tests. (#17574)
Also remove unnecessary dependency from ubuntu1604py3 Dockerfile.
2016-09-14 15:38:27 -07:00
René Moser
28feba2fb3 jenkins_job: extend integration tests (#17558) 2016-09-14 10:44:01 +02:00
Michael Scherer
e9ffe2062f Add test for the pause in loop feature (#17336)
See https://github.com/ansible/ansible/pull/17289
2016-09-13 11:12:58 -07:00
René Moser
6a3e948a7c jenkins_job: add integration tests (#17499) 2016-09-13 16:03:58 +02:00
nitzmahone
69880f1640 add win_user regression tests
Ensure https://github.com/ansible/ansible-modules-core/issues/4369 doesn't occur again, also adds tests for password set when expired.
2016-09-11 20:45:00 -07:00
Matt Clay
784810a84c Add python 3 support to test_apt_repository. (#17472) 2016-09-08 18:05:44 -07:00
nitzmahone
7a9395b5e0 disable windows loop async test
Fails pretty regularly on Shippable/AWS, never locally- always seems to be on the last async task in the loop.
2016-09-06 22:13:31 -07:00
Matt Davis
f239e1e61f windows async changes and tests (#17400) 2016-09-06 17:38:12 -07:00
jhawkesworth
9fe4308670 add very basic tests of win_package, based on existing win_msi tests. (#17383)
* add very basic tests of win_package, based on existing win_msi tests.
2016-09-06 07:09:32 +01:00
Toshio Kuratomi
d6ebf9bdc6 Symink integration tests for fetch and stat 2016-09-05 20:12:37 -07:00
Michael Scherer
918d1e038e Do not hardcode python executable in test (#17380)
Based on https://github.com/ansible/ansible/pull/17376
2016-09-03 10:21:22 -07:00
Matt Clay
4ae59b2743 Use ansible_python for interpreter in test_uri. (#17376) 2016-09-03 10:19:52 -07:00
Jonathan Mainguy
a4cee11649 Add test for specific privlege grants on database.table (#17328)
For the mysql_user module
2016-08-31 14:23:40 -07:00
Jonathan Mainguy
2248d2464b add unit test for mysql_user (#17335)
this removes all blank users, and then does so again
to ensure changed the first time and ok the second time
2016-08-31 22:02:31 +02:00
Michael Scherer
878d0d5b87 Running the test with a locale other than English make that test fail
While tests are supposed to be run in docker, people might still
want to use them on their own boxes.
2016-08-31 00:55:14 +02:00
Allen Sanabria
03132041fb Include vars updated to work with directories (#17207)
* New features for include_vars

include_vars.py now allows you to include an entire directory and its nested directories of variable files.

Added Features..

* Ignore by default *.md, *.py, and *.pyc
* Ignore any list of files.
* Only include files nested by depth (default=unlimited)
* Match only files matching (valid regex)
* Sort files alphabetically and load in that order.
* Sort directories alphabetically and load in that order.

```
    - include_vars: 'vars/all.yml'

    - name: include all.yml
      include_vars:
        file: 'vars/all.yml'

    - name: include all yml files in vars/all and all nested directories
      include_vars:
        dir: 'vars/all'

    - name: include all yml files in vars/all and all nested directories and save the output in test.
      include_vars:
        dir: 'vars/all'
        name: test

    - name: include all yml files in vars/services
      include_vars:
        dir: 'vars/services'
        depth: 1

    - name: include only bastion.yml files
      include_vars:
        dir: 'vars'
        files_matching: 'bastion.yml'

    - name: include only all yml files exception bastion.yml
      include_vars:
        dir: 'vars'
        ignore_files: 'bastion.yml'
```

* Added whitelist for file extensisions (yaml, yml, json)

* Removed unit tests in favor of integration tests
2016-08-30 14:34:31 -07:00
René Moser
26118a51f8 exo_dns: new module utils and integration tests for exoscale DNS (#17230) 2016-08-30 21:48:28 +02:00
Michael Scherer
d8f66defd0 Ignore difference on whitespace (#17302)
While trying to fix the test suite on python3, I noticed
this test fail due to to_json adding more whitespace in
python3 than in python2. So -w should ignored those
differences.
2016-08-30 10:52:19 -07:00
Toshio Kuratomi
380a5801e9 Enable integration tests on python3 that are already working (#17212) 2016-08-24 16:41:05 -07:00
Toshio Kuratomi
51ec35378d xrange and izip_longest aren't available in vanilla python3 (#17226)
Fixes for these are either rewriting to get rid of the need for the
functions or using six.moves to get equivalent functions for both
python2 and python3
2016-08-24 12:28:02 -07:00
Yannig
27b0f3241b new filter human_bytes: convert a string (ex: 1Mo, 1K) into bytes (#12074)
* Rework human_readable and human_to_bytes.
New filter human_to_bytes.

* Fix for python 3.
2016-08-24 12:04:20 -07:00
Adrian Likins
e396d5d508 Implement vault encrypted yaml variables. (#16274)
Make !vault-encrypted create a AnsibleVaultUnicode
yaml object that can be used as a regular string object.

This allows a playbook to include a encrypted vault
blob for the value of a yaml variable. A 'secret_password'
variable can have it's value encrypted instead of having
to vault encrypt an entire vars file.

Add __ENCRYPTED__ to the vault yaml types so
template.Template can treat it similar
to __UNSAFE__ flags.

vault.VaultLib api changes:
    - Split VaultLib.encrypt to encrypt and encrypt_bytestring

    - VaultLib.encrypt() previously accepted the plaintext data
      as either a byte string or a unicode string.
      Doing the right thing based on the input type would fail
      on py3 if given a arg of type 'bytes'. To simplify the
      API, vaultlib.encrypt() now assumes input plaintext is a
      py2 unicode or py3 str. It will encode to utf-8 then call
      the new encrypt_bytestring(). The new methods are less
      ambiguous.

    - moved VaultLib.is_encrypted logic to vault module scope
      and split to is_encrypted() and is_encrypted_file().

Add a test/unit/mock/yaml_helper.py
It has some helpers for testing parsing/yaml

Integration tests added as roles test_vault and test_vault_embedded
2016-08-23 20:03:11 -04:00
Matt Clay
04bd6a3619 Make tests more cross platform. (#17154) 2016-08-19 10:23:14 -07:00
Dusty Mabe
b817f1f3ea actions/unarchive: fix unarchive from remote url (#17126)
* actions/unarchive: fix unarchive from remote url

Currently unarchive from remote url does not work because the core
unarchive module was updated to support 'remote_src' [1], but the
unarchive action plugin was not updated for this. This causes failures
because the action plugin assumes it needs to copy a file to the
remote server, but in the case of downloading a file from a remote
url a local file does not exist, so an error occurs when the file is
not found.

[1] https://github.com/ansible/ansible-modules-core/commit/467516e

* test_unarchive: fix test with wrong remote_src use

The non-ascii filenames test had improperly set remote_src=yes even
though it was actually copying the file from the local machine (i.e.
the file did not already exist remotely). This test was passing
until the remote_src behavior of unarchive was fixed in 276550f.
2016-08-19 08:16:21 -05:00
Matt Davis
e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
2016-08-16 20:39:23 -07:00