Commit Graph

2074 Commits (3700bcb6dd3df3e24defd9d1636253dd66e02174)

Author SHA1 Message Date
Rene Moser 6c2af29659 tests: add handler listen test cases 8 years ago
Robin Roth 9f2d22425b Run tests on opensuse42.2
* add to shippable
* add to completion/readme
* Fixes #18645
8 years ago
Robin Roth 61897fa4b7 Add Dockerfile for opensuse 42.2 (#19805) 8 years ago
Matt Clay 68346b128f Update Fedora tests to use releases 24 and 25. 8 years ago
Matt Clay 165e7c4e61 Add Dockerfile for fedora24 and fedora25. 8 years ago
John R Barker c252ac1a7d Make tests run on fresh install (#19566) 8 years ago
Marius Gedminas b0b7a636d8 authorized_key: support --diff (#19277)
* Refactoring: split readkeys() into readfile() and parsekeys()

* Refactoring: split writekeys() into writefile() and serialize()

* authorized_key: support --diff

* Refactoring: remove no-longer used readkeys()/writekeys()

* Integration test for authorized_key in check mode
8 years ago
Tom Melendez 7e88df7ebc Adding auth support for google-api-python-client and gcloud-python (#19090)
Support for the Google API and GCloud-Python Clients have been added.

The three libraries:
* GCloud-Python: A new function, get_google_cloud_credentials, should be used.  The credentials-object returned can be passed to any gcloud-python client.  Using this client library requires in the installation of gcloud-python.  This is preferred library for new modules.

* Google API: A new function, gcp_api_auth, should be used to take advantage of services requiring this client.  This client library should be used if the desired functionality is not available in GCloud-Python.  Using this library requires the installation of google-api-python-client.

* libcloud: Existing function, gcp_connect, should be used.  The interface and return values have not changed and existing modules (such as gce, gce_pd and gce_net) should work without modification.  Note that the credentials-fetching code has been refactored out of gcp_connect so that can be reused by all connection functions. To use this function, apache-libcloud must be installed.

Import guards have been added and will only be trigger if a user tries to use a function that is missing dependencies.

Credential-specifying mechanisms (i.e, ansible module params, env vars and libcloud secrets.py) have not changed.  They have been refactored and unit tests have been added to allow for changes going forward. We are deprecating (and removing in a subsequent release) the ability to specify credentials via the libcloud secrets file.  Also, we have deprecated (and also plan to remove in a subsequent release) the ability to use a p12 pem file for a key - the JSON format is strongly preferred.  Deprecation warnings have been added for both of these issues (see the Ansible docs on how to disable deprecation warnings).
8 years ago
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
8 years ago
Matt Davis f96ac8bff0 fix multiple handler notifications (#19655)
Fixes #19647
Adds integration test to catch multiple handler notifications
8 years ago
azenk f2458140f6 Lastpass lookup plugin (#16285)
This plugin can be used with the lpass cli interface for lastpass.
[lastpass-cli](https://github.com/lastpass/lastpass-cli)

Example:
Add a lookup to your playbooks/variables somewhere:
```
some_variable: "{{ lookup('lastpass','Some Lastpass entry name or ID', field='username') }}"
```
Usage:
* start a lpass session prior to using ansible
* run ansible
* logout when finished

```
lpass login user@domain.com
ansible-playbook foo.yml
lpass logout
```
8 years ago
Rob Cutmore 1da6a67c50 Add tests for Git remote URL changes (#16893)
* Update Git tests for set remote URL changes
* Git: report changed when needed in check mode
8 years ago
Dag Wieers 438cd6687f Added tests for sefcontext module 8 years ago
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 `""`.
8 years ago
Matt Clay dac226de4a Improve ansible-test completion and messaging. (#19627)
* Simplify type annotation of args.docker_util.
* Improve error messaging for ansible-doc test.
* Add completion for docker, remote and windows.
8 years ago
Gregory Shulov 6c3de3c299 Initial Commit for Infinidat Ansible Modules (#19429)
* Initial Commit for Infinidat Ansible Modules

Skip tests for python 2.4 as infinisdk doesn't support python 2.4

Move common code and arguments into module_utils/infinibox.py

Move common documentation to documentation_fragments. Cleanup Docs and Examples

Fix formating in modules description

Add check mode support for all modules

Import AnsibleModule only from ansible.module_utils.basic in all modules

Skip python 2.4 tests for module_utils/infinibox.py

Documentation and code cleanup

Rewrite examples in multiline format

Misc Changes

Test

* Add Infinibox modules to CHANGELOG.md

* Add ANSIBLE_METADATA to all modules
8 years ago
Gordon Gao d9e1e374b2 let chdir support relative path in more modules (#16736) 8 years ago
s-hertel 28b4931e3d testing GalaxyCLI.run() does what is expected 8 years ago
bart2 cdb35f4ce2 Fixes #16936 - Digest authentication not working in uri module (#18736) 8 years ago
Matt Clay 422857166b Remove legacy test alias migration script. (#19629)
* Require code-smell tests to be files.
* Add sanity check for integration test aliases.
* Remove migration script for test aliases.
8 years ago
James Cammarata dd0257b995 Template "original_task" fields in _process_pending_results
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
8 years ago
Adrian Likins 727ca6f436 Fix error on 'help module' in ansible-console (#19390)
If 'help xattr' for example, ansible-console would
traceback because module_docs.get_docstring() now
returns 4 values (module metadata was added)
8 years ago
Matt Clay cdd74b2b84 Fix foreman compile skip path. 8 years ago
Peter Sprygada 2a5a2773c8 adds new module net_command for network devices (#19468)
* new module net_command for sending a command to a network device
* adds unit test cases for module
* only works with connection=network_cli
8 years ago
Will Thames dce445f956 Improve error message for module validation (#19501)
Print out the data that fails to validate when doing
schema checking on modules

This allows easier interpretation of error messages.

From:

```
ERROR: DOCUMENTATION.notes.2: expected basestring
```

To:

```
ERROR: DOCUMENTATION.notes.2: expected basestring @ data['notes'][2].
Got {"As with C(include) this task can be static or dynamic, If static
it implies that it won't need templating nor loops nor conditionals and
will show included tasks in the --list options. Ansible will try to
autodetect what is needed, but you can set `static": 'yes|no` at task
level to control this.'}
```
8 years ago
Matt Clay 39f6368015 Update `aliases` file for `uri` integration test. 8 years ago
Matt Clay 9b5c782a0b Use `docker pull` by default in ansible-test. 8 years ago
Matt Clay 80c559bdef Test sftp and scp for ssh connection. 8 years ago
Toshio Kuratomi 0b440a9289 Code smell test for iteritems and itervalues (#19292)
* Code smell test for iteritems and itervalues

* Change the keydict object in authorized_keys so it doesn't throw a false postive

keydict is a bad data structure anyway.  We don't use the iteritems and
itervalues methods so just disable them so that the code-smell tests do
not trigger on it.

* Change release templates so they work with py3
8 years ago
Robin Roth afca957396 Fix UnboundLocalError remote_head in git (#19057)
* Fix UnboundLocalError remote_head in git

Fixes #5505

The use of remote_head was a leftover of #4562.
remote_head is not necessary, since the repo is unchanged anyway and
after is set correctly.

Further changes:
* Set changed=True and msg once local_mods are detected and reset.
* Remove need_fetch that is always True (due to previous if) to improve
clarity
* Don't exit early for local_mods but run submodules update and
switch_version

* Add test for git with local modifications
8 years ago
Andrea Tartaglia 59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
8 years ago
Dag Wieers 7c71c678fa Fix regression in search path behaviour
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
8 years ago
Matt Clay f28b5a0ed8 Add --tox-sitepackages option to ansible-test. 8 years ago
Toshio Kuratomi dd46cb7b05 Add a code-smell test for iterkeys (#18589)
* Add a code-smell test for iterkeys
* Add a message on how to port iterkeys problems and make the grep more robust
8 years ago
Matt Clay f789a20f29 Update log download url. 8 years ago
Matt Clay 45772b961f Add private fork CI support to ansible-test. 8 years ago
Toshio Kuratomi c6b42028c4 Fixes for uri under python3 and local (non-httptester) testing 8 years ago
Matt Clay dab2bf7e13 Skip test_uri on python 3. 8 years ago
Adrian Likins c693ba19f9 unit tests for playbook/conditional.py (#18586)
Start of unit tests for playbook/conditional.py
8 years ago
Adrian Likins 3efef40822 Add unit tests for playbook/helpers.py (#18709) 8 years ago
Adrian Likins 1653a77f1d add unit tests for playbook/included_file.py (#18710) 8 years ago
Adrian Likins 08a5d506bb Fix errors on 'ansible-playbook --flush-cache' (#18754)
Add a unit test, and split out the flush cache logic to
it's own method.
Fixes #18708
8 years ago
Adrian Likins 6c4f554f5a Provide slightly better msg on fact cache error (#18759)
If the configured fact_cache plugin (fact_caching config)
fails, raise a fatal error instead of failing mysteriously
later.

Fixes #18751
8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Lumír 'Frenzy' Balhar 84544ee8fd Fix AST nodes for Python 3 and enable dependent test_uri (#18597)
* 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.
8 years ago
John R Barker b915e790d3 veos-dut-01 is down, so use veos01 (#19299) 8 years ago
John R Barker bdc4fa6b99 Add group_vars/ops.yaml (#19288)
Authentication details for ops modules. Was missed during porting
8 years ago
Robin Roth 5bf07454cb Test apache2 force (#18500)
* Use native yaml for apache2 test

* Test removal of default modules with force

a2enmod on debian has `-f`, but not on SUSE (runs there without force).
Therefore don't test that option on SUSE.
The docs already specify that the option is intended for Debian systems
only.
8 years ago
Clark Boylan a65e34ce77 Fix synchronize retries (#18535)
* Fix synchronize retries

The synchronize module munges its task args on every invocation of
run(). This was problematic because the munged data was not fit for use
by a second pass of the synchronize module. Correct this by using a copy
of the task args on every invocation of run() so that the original args
are not affected.

Local testing using this playbook seems to confirm that things work as
expected:

  - hosts: all
  tasks:
    - delay: 2
      register: task_result
      retries: 1
      until: task_result.rc == 0
      synchronize:
        dest: /tmp/out
        mode: pull
        src: /tmp/nonexistent/

fixes #18281

* Update synchroncization fixture assertions

When we started operating on a copy of the task args the test assertions
were no longer asserting things about the munged state but of the
pristine state. Convert the copy of task args to a class member so that
it can be compared against later in testing and update the assertions to
check this munged copy.
* Shuffle objects around for cleaner testing

Attach the temporary args dict to the task rather than the action as
this makes updating the existing tests cleaner.
8 years ago
Matt Clay f9c4158ff8 Remove core/extras dirs from old PRs during CI. 8 years ago
John R Barker 39af9b5a86 Make it clearer where the network tests live (#19242) 8 years ago
Matt Clay cd47cb2a15 Remove remnants of obsolete fireball mode. 8 years ago
Matt Clay ac7edef2be Fix modules with documentation errors. 8 years ago
Robin Roth e18bc0d6f0 Add test for auto_import_keys in zypper_repository (#17898)
* tests the bug found in ansible/ansible-modules-extras#3086
8 years ago
Matt Clay 1c9a58a885 Run all tests when no last successful commit.
(cherry picked from commit 2e56035fddfd04eb084bd977fc1ee2f35c2f5283)
8 years ago
Matt Davis cb1888125d add metadata to doc support (#18802)
fix broken module docs
change doc AST id extraction to use == instead of in
8 years ago
Matt Clay 5628e260f2 Relocate module unit tests. (#18812)
* Relocate module unit tests.
* Fix classification of unit test changes.
8 years ago
Matt Clay 573078fc6b Fix unit test directory path target. 8 years ago
Matt Clay 75c281debc Fix compile errors in scripts. 8 years ago
Matt Clay 47083f145a Don't error if pytest skips all unit tests. 8 years ago
Matt Clay 8e951b9f98 Remove legacy `test/samples` directory. 8 years ago
Matt Clay 580401c02b Remove legacy test code. 8 years ago
Matt Clay 851b264fb0 Add missing znode module description. 8 years ago
Matt Clay 7d3e2b2121 Verify path before assigning to sanity test. 8 years ago
Matt Clay bd7ce0696e Fix tests after repo merge. 8 years ago
Peter Sprygada dc23667cc2 add back reverted change to network_cli (#18761)
This adds back the change to the network_cli plugin.  Ths change adds
the ensure_connect decorator to the open_shell() method to make sure
the connection is valid before trying to open a shell.

The issue was due to the addition of the decorator that will call
_connect() when there is no connection.  The _connect() method should
have been mocked in the test case.  This commit fixes the test
case as well

Change was originally reverted in c414ded69a
8 years ago
Matt Clay 14a2757116 Correct change classification for network plugins. 8 years ago
Toshio Kuratomi 5f5ea06ca4 make hash_params more robust in the face of many corner cases (#18701)
* 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.
8 years ago
Peter Sprygada 06f5bf980e adds unit test for network_cli connection plugin (#18729) 8 years ago
Matt Clay d2af88ba8a Do not replace existing test skip lists. 8 years ago
Matt Clay c0695ffa41 Add `unify_repos.sh` to shellcheck skip list. 8 years ago
Adrian Likins 47a7cb733a use log attribute %(process)d instead of os.getpid (#18691) 8 years ago
Adrian Likins ba56c87566 Add SSH_AUTH_SOCK to default env
So ssh-agent works when using locally.
8 years ago
Matt Clay bee58fe890 Fix compile skip path handling for targeted tests. 8 years ago
John R Barker d22f7b4919 vyos: Don't run show commands that are over ANSIBLE_VYOS_TERMINAL_LENGTH (#18682) 8 years ago
Matt Clay 4da7a7ce0e Update coverage exclusions. (#18675)
* Update coverage exclusions.
* Fix logic error in Windows change detection.
8 years ago
Matt Clay 6bbd92e422 Initial ansible-test implementation. (#18556) 8 years ago
Virgil Dupras bf48383610 Fix regression in jinja2 include search path (#18617)
* 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
8 years ago
Adrian Likins 9b1ce5dfb9 add integration tests for authorized_key (#18130)
Primarily for behavior related to
https://github.com/ansible/ansible-modules-core/issues/4780
8 years ago
John R Barker 2b6d5f9f95 Update network-test-runner.sh (#18672) 8 years ago
Adrian Likins a1ca10f7fc Add lots of test cases to inventory/test_host.py (#17827) 8 years ago
Brian Coca ca1514cf2a unified boolean function
optimized boolean function
fixes #17815
8 years ago
Adrian Likins d6e2f1846a add a unit test for playbook/base.py (#17688)
* wip: add a unit test for playbook/base.py

This commit include a failing test
TestBaseSubClass.test_attr_class_post_validate

It fails with the error:
Traceback (most recent call last):
  File "/home/adrian/src/ansible/test/units/playbook/test_base.py", line 264, in test_attr_class_post_validate
    bsc = self._base_validate(ds)
  File "/home/adrian/src/ansible/test/units/playbook/test_base.py", line 206, in _base_validate
    bsc.post_validate(templar)
  File "/home/adrian/src/ansible/lib/ansible/playbook/base.py", line 450, in post_validate
    " Error was: %s" % (name, value, attribute.isa, e), obj=self.get_ds())
AnsibleParserError: the field 'test_attr_class_post_validate' has an invalid value (<class 'units.playbook.test_base.ExampleSubClass'>), and could not be converted to an class. Error was: test_attr_class_post_validate is not a valid <class 'units.playbook.test_base.ExampleSubClass'> (got a <class 'ansible.playbook.base.BaseMeta'> instead)

* wip, test refactoring

* wip, trying to add a parent->child

* wip, fix isa=class.

the ds the base using needs an instance of the class
(ie, whats normally created by the yaml loaders)

* wip, theres no need to argue, I just dont understand parents

* stub a _preprocess_data for coverage

* cleanup, required, parent, etc
8 years ago
Adrian Likins f0c71ad68d More test coverage for plugins/callback/__init__ (#18020) 8 years ago
John R Barker 4875824357 Network dut (#18668)
* Use dedicated account for testing

This also avoids any instance of "vyos" being masked by no_log

* use vyos-dut-01
8 years ago
John R Barker 366b7c7691 Network test runner - Phase 1 (#18524)
* Initial commit of network-test-runner

* remove gist link

* Correctly source hackenv and improve logging

* Remove debug

* Log location
8 years ago
Daniel Miranda 57f4a9885e Make sure include_role inherit variables from parent role (#18627)
* 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
8 years ago
John R Barker 54c5ea29bb Update inventory.network (#18654) 8 years ago
John R Barker 0793cf3599 HACK test on older vyos machine (#18653) 8 years ago
John R Barker 09550e4f46 Ops (#18652)
* Link to missing ops.yaml

* Add missing ops.yaml
8 years ago
John R Barker a51d79c7a9 Tests are required for Network modules (#18618)
* Tests are required for Network modules

Also detail how to get help

* Update README.md

* Update README.md
8 years ago
John R Barker 4c1bb31611 Use DUT instance for veos (#18608) 8 years ago
Matt Clay 089ffae107 Make ansible-pull integration tests more robust. 8 years ago
Brian Coca 778c983ef9 ansible_playbook_python (#18530)
* ansible_playbook_python

fixes #18471

* fix tests

* removed dupe
8 years ago
Matt Clay 3fd13aaffe Detect default group in template integration test. 8 years ago
John R Barker 346aa8f1b2 Use DUT instance for vyos (#18599)
We now have a dedicated test machine, so use that
8 years ago
Adrian Likins 25aa757e80 add a intg test for vault encrypted inventory (#18550) 8 years ago
Matt Clay 324702c38f Use output_dir instead of outputdir for tests. 8 years ago
Sam Doran f68b49057f Add test cases for VyOS commands that don't honor paging settings (#18553)
* Add test cases for VyOS commands that don't honor paging settings

Testing for issue fixed in PR #18546

* Add provider line and fix indentation

For the way we invoke the tests we need to specify the `provider:` 
Also fix the indentation on `register:`
8 years ago
Toshio Kuratomi 493fb4b665 Test that changing the flags on a mounted filesystem works (#18552)
* Test that changing the flags on a mounted filesystem works
8 years ago
Matt Davis 4dba83afc5 disable win_async_wrapper success loop test to keep CI happy 8 years ago
Matt Clay 4d616366c0 Update test to use keyserver.ubuntu.com. 8 years ago
Matt Davis 602bba4a82 retag win_async_wrapper test to run on module changes 8 years ago
Ganesh Nalawade f6437f1b6e Fix command typo in integration tests README file (#18539) 8 years ago
Toshio Kuratomi ed00741a01 Mcsalgado's change to use shlex.quote instead of pipes.quote (#18534)
* Replace pipes.quote for shlex_quote

* More migration of pipes.quote to shlex_quote

Note that we cannot yet move module code over.  Modules have six-1.4
bundled which does not have shlex_quote.  This shouldn't be a problem as
the function is still importable from pipes.quote.  It's just that this
has become an implementation detail that makes us want to import from
shlex instead.

Once we get rid of the python2.4 dependency we can update to a newer
version of bundled six module-side and then we're free to use
shlex_quote everywhere.
8 years ago
Matt Martz b79bf14607 Add playbook and packer file for building httptester (#18107) 8 years ago
Adrian Likins 17738e6b73 Fix test_play_context fail with local config. (#17596)
If the current ansible enviroment has a config setup
that doesn't use 'smart' as the configured transport
test_play_context would fail when it assumes the
transport will be 'smart'.
8 years ago
James Cammarata ca5b361ad8 Reworking iterator logic regarding failed states during always
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
8 years ago
James Cammarata 4f06a86161 Alternately track listening handlers by uuid if no name is set
Fixes #17846
8 years ago
Adrien Vergé 527d8307c1 Lint YAML files under test/
This commit extends YAML linting by enabling standard rules from the
`yamllint` tool [1]. Since syntax errors and key duplicates are already
checked since 4d48711, this change only adds detection for cosmetic
problems. It also narrows checks to the test/ dir only.

The main goal is to prevent future problems to enter the code base
without being noticed. While it would be a huge effort to be PEP8
compliant, it is relatively easy to have correct YAML style *now* and
prevent future errors by enabling linting.

Note: for those (like me) caring about code attribution: use `git blame
-w` to ignore whitespace-only changes.

Note: I disabled some linting checks (such as indentation), they can be
enforced in the future if needed. Similarly, current checks can also be
disabled. See the `.yamllint` file.

[1]: https://yamllint.readthedocs.io/
8 years ago
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.
8 years ago
John R Barker de13f91a50 Update docker-setup-rht.yml 8 years ago
James Cammarata bd4f7fca27 Fixing incorrect use of version_compare in docker integration test 8 years ago
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
8 years ago
Matt Clay 3f785ee173 Remove unnecessary file. 8 years ago
Matt Clay c955688772 Move ansible ad-hoc tests to integration targets. 8 years ago
Matt Clay ac8842eee8 Fix unit test dirs to match code under test. 8 years ago
jctanner 05f02371ce Add a check for type() instead of isinstance() (#18439) 8 years ago
John R Barker 947e0f264e Network Tests - Extend examples (#18451) 8 years ago
Matt Clay 8552ad6bf1 Fix docker connection unit tests.
- 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.
8 years ago
Matt Clay 65f019fe82 Fix handling of ReaderError in validate-modules. 8 years ago
Adrian Likins 51e3ef89a9 Add error info if tabs are found in the yaml (#18343)
If a yaml file fails to load because of tabs being used
for formatting, detect that and show a error message
with more details.
8 years ago
Matt Clay 912d6ed8cc Clean up code-smell sanity scripts. (#18407)
- Replace find ';' with '+' for faster execution.
- Replace grep -R with -r to avoid recursive warnings.
- Exclude .git and .tox directories from recursive grep.
- Improve messaging on failed sanity checks.
- Add no-basestring check to Shippable.
8 years ago
Matt Clay 8c270ac75f Add empty-init code-smell script. (#18406)
Also removed boilerplate from otherwise empty __init__.py files
which should not contain any code (checked by empty-init script).
8 years ago
Brian Coca a0f27d552c File attributes (#18213)
* added attributes to base file params

* dont change attributes when none

* fixed test to deal with new attributes
8 years ago
Brian Coca 8cab33a779 skip vmware inventory when missing lib
fixes #18190
8 years ago
Matt Clay ecb7f13119 Update log url for Shippable download-logs script.
Also improved error handling.
8 years ago
Adrian Likins dd0189839e Fix bug (#18355) where encrypted inventories fail 18355 (#18373)
* 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
8 years ago
Tom Melendez 28dc527b2c Basic integration test for gce_tag. (#17928) 8 years ago
Matt Clay 1238a4c0c9 Run validate-modules with python 2 only.
This allows validate-modules to run in an environment where
python 3 is the default. This will no longer be necessary once
validate-modules is updated to work with both python 2 and 3.
8 years ago
Matt Clay bb3801bafd Cleanup and fixes for code smell scripts.
- Fix shellcheck issues.
- Add .tox exclusions.
8 years ago
Matt Clay 469c4a106b Fix and create code-smell test for line endings. 8 years ago
Matt Clay 0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
8 years ago
jctanner cb872415d1 set galaxy unit test server to None (#18298)
Prevents connections to the internet in isolated environments such as koji+mock

Fixes #18297
8 years ago
Matt Clay 37271867b1 Move amazon unit tests and apply fixes.
- Update import for relocated tests.
- Fix test to expect changed from update_tags.
- Add checks for boto3 and botocore to tests.
- Set check mode with kwarg.
- Python 3 fixes for unit tests.
- Python 2.6 fix for unit tests.
8 years ago
Allen Sanabria e56229747a fixed error message for releasing an ip when not waiting for the nat gateway to delete successfully 1st
Originally from ansible/ansible-modules-extras@950d76af0b
8 years ago
Allen Sanabria 423b14436a updated tests to reflect dict vs list
Originally from ansible/ansible-modules-extras@461553bda8
8 years ago
Allen Sanabria 56377b9d00 Updated module to be compliant with test cases.
* Added integration tests
* Added unit tests

Originally from ansible/ansible-modules-extras@ee523be26c
8 years ago
Allen Sanabria 9a4ce30789 Removed Ansible API based tests from this PR
Originally from ansible/ansible-modules-extras@e9fcb8b286
8 years ago
Allen Sanabria 300776a0d9 Including unit tests.
* Including unit tests as per https://groups.google.com/forum/#!topic/ansible-devel/ejY4CjKeC34
* This test suite is automatically run in https://github.com/linuxdynasty/ld-ansible-modules

Originally from ansible/ansible-modules-extras@1cc5ea7418
8 years ago
Matt Clay e24588902f Move test_os_server and apply fixes.
- Add missing meta value for test_create_server
- Add .gitignore for pytest .cache directory

Exclude test_os_server from nose test runs since it was designed
for pytest. The test will work correctly when run using pytest.

This is a temporary issue, as we'll be moving to pytest soon.
8 years ago
Lars Kellogg-Stedman a0f1dcbd0f add some unit tests for the os_server module
This commit adds some unit tests for the `cloud.openstack.os_server`
module.  These tests exercise `_network_args` thoroughly and
`_create_server` lightly.

These tests will **fail** until ansible/ansible-modules-core#2275 lands.

To run the tests:

    pip install -r test-requirements.txt
    PYTHONPATH=$PWD py.test

Originally from ansible/ansible-modules-core@3387526bca
8 years ago
Matt Clay 86c5eddb05 Move ec2_vpc_nat_gateway integration test role. 8 years ago
Allen Sanabria 157f631941 Updated module to be compliant with test cases.
* Added integration tests
* Added unit tests

Originally from ansible/ansible-modules-extras@ee523be26c
8 years ago
Matt Clay 71819c0a60 Test reorganization and cleanup. (#18270)
- Correct directory name in test/README.md
- Move code-smell tests to test/sanity/code-smell
- Update code-smell.sh to use new script paths
- Add test/integration/target-prefixes.win for ansible-test
- Move module unit tests to match module directory layout
8 years ago
Toshio Kuratomi 02859a3e32 Add tests for dnf modelled after the yum tests (#18226) 8 years ago
John R Barker 0f8ff0701d Disable testing on csr01 (#18264) 8 years ago
John R Barker 5b4ea08a1f Formatting (#18260)
* Formatting

* Update README.md

* Update
8 years ago
John R Barker 2f35ccb562 Network Test Documentation (#18234)
* Network Test Documentation

Will need improving over time, though this ensure that everything that was in `ansible/test-network-modules` is in `ansible/ansible`

* Update README.md

* Inventory file
8 years ago
John R Barker 5fa82f2b4e ops not openswitch (#18256)
The openswitch modules have a prefix of `ops`, not `openswitch`, which is the directory name.
8 years ago
John R Barker 9ca1025ea8 Network module prefixes (#18246)
* Network module prefixes

In ansible-test we should skip tests for these modules, they will be
tested via another process.

* Update target-prefixes.network
8 years ago
John R Barker 8331e915e0 Network inventory file (#18240) 8 years ago
John R Barker e0cc7b3415 Migrate Network Tests into ansible/ansible (#18233)
* Docs Networking tests

* Copy networking tests from test-network-modules

* Networking transport settings - group_vars

* Network playbooks

* Debug should be off by default

* Update nxos.yaml

* Remove items from top level

* Use dependencies, not pre-tasks

* Remove trailing blank lines

* Remove backup files

* newlines
8 years ago
Steve Kuznetsov 0bc35354ce Change `v2_playbook_on_start` logic to positively detect legacy plugins
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>
8 years ago
Matt Robinson 4ff8890ec1 Set ansible_os_family correctly under KDE neon
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.
8 years ago
Adrian Likins 0a1f391881 Fix fact gathering intg test asserts (#18168)
If the facts returned by setup included strings that
had double quotes in them, the asserts in test_gathering_facts.yml
would fail with errors like:

    "The conditional check '\"[{u'mounts': {u'options':
    u'rw,context=\"system_u:\"'}}]\" != \"UNDEF_HW\"' failed. The error was:
    template error while templating string: expected token 'end of statement
    block', got 'system_u'. String: {% if \"[{u'mounts': {u'options':
    u'rw,context=\"system_u:\"'}}]\" != \"UNDEF_HW\" %} True {% else %}
    False {% endif %}"

For one example, if mount facts returned an 'options' field that
included double quoated selinux context ids, the test would fail.

Fix is removing the double quoting in the assert 'that:' lines,
and removing the unneeded double curly brackets.
8 years ago
Matt Davis c1b7d2e560 add large interleaved stdout/stderr integration tests for win_shell/win_command 8 years ago
Toshio Kuratomi 589e71dbc5 Fix the uri testserver to run on python3 8 years ago
Matt Davis 9a78273665 reenable win_async loop test 8 years ago
Adrian Likins c0331d50dc Remove callback.CallbackBase._copy_result_exclude
Nothing seems to use this now.

Was added originally added in2d11cfab92f9d26448461b4bc81f466d1910a15e
but the code that used it was removed in
e02b98274b
8 years ago
Adrian Likins 6f9ca7bb83 test name TestPlayIterator->TestPlaybookExecutor 8 years ago
stephane 77868a4104 Set Suse family for openSUSE Tumbleweed & Leap
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.
8 years ago
Pierre-Louis Bonicoli 3edac76e1b tests: check that handlers are able to use 'include' 8 years ago
Toshio Kuratomi 2ac12432ef Enable the git test on py3 8 years ago
Ssawa 8e47b9bc70 Handle 'smart' scp_if_ssh option for fetch (#18125) 8 years ago
Michael Scherer 2804e64ed5 Enable filters test for python 3 8 years ago
Thilo Uttendorfer cf0da0948d Fix uninitialized variable in deserialize method (#18037)
The bug was introduced with commit 06d4f4ad0e.
Added a simple test.
8 years ago
Toshio Kuratomi 67ac375188 pip tests now pass on python3. Enable them. 8 years ago
Michael Scherer 578da9a615 Enable test for lookups on python 3
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.
8 years ago
Michael Scherer e93a8814a3 Let authorized_keys be tested on python 3 8 years ago
Adrian Likins f99ffb5620 Fix test_filters fail because of dict sort (#18105)
Fixes #17308
8 years ago
Toshio Kuratomi b902b5d046 Pixelrebel amc pr2654 (#18089)
* 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
8 years ago
Michael Scherer 5215832f15 Make the test run when used on a local system (#18050)
ANSIBLE_ROLES_PATH is relative to the config directory, if found. Use an absolute path instead.
8 years ago
Toshio Kuratomi 7e0bd5632d epdb doesn't work on python3 so we need a different package to test pip 8 years ago
Toshio Kuratomi 60acfd1e87 Fix ansible-pull on python3
On python3, we can't write bytes directly to sys.stdout.
8 years ago
Toshio Kuratomi fd14048d46 Thanks to mscherer, these tests are now passing 8 years ago
Thilo Uttendorfer 5ece97ae5b Fix call of wrong super class
Added a basic test
8 years ago
Brian Coca 04b86df815 updated pbrun test to match expected output 8 years ago
John R Barker d9b570aaae Location of Network Tests (#18048) 8 years ago
Toshio Kuratomi 91c1fdec3d unarchive tests now pass on python3 8 years ago
John R Barker 0ef3ff6a9d Install dependencies for validate-modules (#18028)
Currently (pre-repomerge) we aren't running sanity.sh from
ansible/ansible, after the merge we will. Therefore I've added the
requirements here, rather than in ansible-modules-*/test/utils/shippable
8 years ago
Adrian Likins 8bf4aa97b0 Skip test_aws.py if boto3/botocore are missing (#17814) 8 years ago
Matt Clay 656b82417e Fix role path for generate-tests. 8 years ago
Matt Clay 05531b99d0 Restore README.rst, update and fix formatting. (#18012)
* Revert "Update validate-modules README and convert to MD. (#18008)"
* This reverts commit 4916fe9962.
* Fix formatting of README.rst.
8 years ago
Matt Clay 4916fe9962 Update validate-modules README and convert to MD. (#18008) 8 years ago
Matt Clay c2ec86cb78 Migrate Windows CI roles to test targets. (#18005) 8 years ago
Matt Clay 9182619fef Merge pull request #18001 from gundalow/validate-modules
Take ownership of ansible-validate-modules
8 years ago
Matt Clay 75e4645ee7 Migrate Linux CI roles to test targets. (#17997) 8 years ago
John Barker 25286c3c7d README.rst to reference new name 8 years ago
John Barker ef06b5501c Port sivel/ansible-validate-modules into Ansible 8 years ago
Matt Clay 374e4348e4 Split out var_blending test into targets dir. (#17996) 8 years ago
Matt Clay 410b96d716 Clean up integration tests. (#17991) 8 years ago
Matt Clay 80a5c70ad7 Split integration tests out from Makefile. (#17976) 8 years ago
Toshio Kuratomi 9265016b95 Fix a test failure when run on a system with python-future installed. 8 years ago
Toshio Kuratomi 6a61b6d431 Add a whitelist for checking for six. Use it for digital_ocean.py 8 years ago
Toshio Kuratomi 1efe782b46 Refactor parsing of CLI args so that we can modify them in the base class
Implement tag and skip_tag handling in the CLI() class.  Change tag and
skip_tag command line options to be accepted multiple times on the CLI
and add them together rather than overwrite.

* Make it configurable whether to merge or overwrite multiple --tags arguments
* Make the base CLI class an abstractbaseclass so we can implement
  functionality in parse() but still make subclasses implement it.
* Deprecate the overwrite feature of --tags with a message that the
  default will change in 2.4 and go away in 2.5.

* Add documentation for merge_multiple_cli_flags
* Fix galaxy search so its tags argument does not conflict with generic tags
* Unit tests and more integration tests for tags
8 years ago
Toshio Kuratomi 23305540b4 Make ini parsing slightly more robust
Prior to this commit, the ini parser would fail if the inventory was
not 100% utf-8.  This commit makes this slightly more robust by
omitting full line comments from that requirement.

Fixes #17593
8 years ago
Toshio Kuratomi 08a58ae025 Fix for run_command tests now that it returns native strings 8 years ago
Toshio Kuratomi 5bc3cb278c Remove unicode escape (#17866)
* Remove unicode-escape which is not present on python3

Alternative fix for #17305

* Enable the assemble test on python3

* Fix other problems with assemble on python3
8 years ago
Matt Davis aa0ad073b8 bugfixes to JSON junk filter, added unit/integration tests to exercise (#17834) 8 years ago
Matt Clay 21857e8618 Disable privileged mode on Shippable. (#17844) 8 years ago
Brian Coca dfff608ceb dzdo prompt fix
fixed tests
dzdo has 2 paths now, with and w/o password
fixes #17838
8 years ago
jctanner fff161f2f6 Smart mode for sftp+scp (#17813)
If the sftp fails, roll over to scp by default. This saves users
from having to know about the scp_if_ssh method when sftp is broken
on the remote host.
8 years ago
Adrian Likins 1f03801fcc mv test_git to 'destructive' integration tests (#17526)
The test_git role removes ~/.ssh/known_hosts currently
and that is destructive.
8 years ago
Toshio Kuratomi 4452ee86bd Turn mount test back on (#17797)
* Turn mount test back on

* Mount tests need PRIVILEGED so turn that back on

Revert "Revert "Set PRIVILEGED=true for non_destructive tests. (#17733)" (#17738)"

This reverts commit dc0fb1c212.

* Add a needs_privileged tag so that we can skip mount tests on centos6

Some containers timeout on shippable tests when run with privileged.
Unfortunately, some tests require that in order to run.  Tagging those
allows us to skip those tests on the platforms that timeout when we get
ready to run the integration test in shippable.

* Centos6 times out with PRIVILEGED set so remove that (will disable the mount tests on centos6)

* Remove false start
8 years ago
Toshio Kuratomi efa78b4ff4 The mode that we fake from stat is checked more closely under python3.5 on El Capitan (#17794)
Python2 seems to allow any integer.  Python3.5 on Linux seems to allow
a 32 bit unsigned int.  Python3.5 on El Capitan seems to limit it to
a smaller size...  perhaps a 16 bit int.
8 years ago
Matt Clay a265d2d77d Run test_template tests on OS X. (#17791) 8 years ago
Matt Clay 0dc3db9e75 Enable unarchive tests for OS X and FreeBSD. (#17789) 8 years ago
Adrian Likins bba0fb3a42 Add mnt pnts with single quote to test (16855) (#17771)
This adds some test data to test_facts.py that
includes mnt points that have a single quote in
the path.

Ala, https://github.com/ansible/ansible/issues/16855

The bug was already fixed via other changes, but this is
for regression testing.
8 years ago
Matt Clay 6d78397b8b Update get_url test to use httptester. (#17787) 8 years ago
Matt Clay d05df5fc61 Disable expect continue in ansible-core-ci. (#17737)
This will allow use of larger SSH keys.
8 years ago
Toshio Kuratomi 1f311f0739 Disable mount tests for now. Mount is buggy on too many platforms 8 years ago
Matt Clay 2e0bec293c Improve error handling for ansible-core-ci. (#17734) 8 years ago
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
8 years ago
Matt Clay cf4d436e07 Remove run_tests.sh and update docs. (#17719)
Removed the obsolete test/utils/run_tests.sh script in favor of
using the newer test/utils/shippable/integration.sh instead.
8 years ago
Matt Clay 50b0d011fe Update integration.sh to copy source by default. (#17717)
Also add more documentation to the script.
8 years ago
Matt Clay 40ffd8269d Add shellcheck to code-smell checks. (#17715) 8 years ago
Adrian Likins e11f7d2339 add a defaults for integration.sh (#17709)
* add a default test image (ansible/ansible:centos7)
* add a default test target (all)
8 years ago
Matt Clay ada2432165 Add keep on failure option to integration.sh. (#17711) 8 years ago
Tom Melendez 97a1b7ded1 Integration Playbook for Google Cloud DNS module. (#17698) 8 years ago
Christoph f9e49de2ef Add a test for int/float parameter type checking (#16741)
A parameter of type int should accept int and string, but not float.
A parameter of type float should accept float, int, and string.

Also reset the arguments in another test so that it runs cleanly.  This
agrees with what all the other tests are doing.
8 years ago
Toshio Kuratomi 8aa8e07d13 Remove _load_hosts() from Play initialization as it's no longer needed and it breaks using extra_vars defining a list for hosts (#17699)
Thanks to @jimi-c for the solution

Fixes #16583
8 years ago
Matt Clay 3874e653c1 Remove tests for deprecated su and sudo. (#17697) 8 years ago
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.
8 years ago
Matt Clay 39c5c558f8 Switch tests from sudo to become. (#17694) 8 years ago
Toshio Kuratomi 7889e1ffc1 Additional tests for check mode idempotence (#17679) 8 years ago
Matt Clay e0ad02c6dd Remove test for deprecated first_available_file. (#17674) 8 years ago
James Cammarata 1b54d3b6dc Merge branch 'threaded_receiver' into devel 8 years ago
Rob Cutmore 2716fe4362 Add test for checking pip package in check mode (#17360) 8 years ago
Toshio Kuratomi 5e9a8d9202 Fix password lookup py3 plus alikins unittest additions refactoring (#17626)
* Improve unit testing of 'password' lookup

The tests showed some UnicodeErrors for the
cases where the 'chars' param include unicode,
causing the 'getattr(string, c, c)' to fail.
So the candidate char generation code try/excepts
UnicodeErrors there now.

Some refactoring of the password.py module to make
it easier to test, and some new tests that cover more
of the password and salt generation.

* More refactoring and fixes.

* manual merge of text enc fixes from pr17475

* moving methods to module scope

* more refactoring

* A few more text encoding fixes/merges

* remove now unused code

* Add test cases and data for _gen_candidate_chars

* more test coverage for password lookup

* wip

* More text encoding fixes and test coverage

* cleanups

* reenable text_type assert

* Remove unneeded conditional in _random_password

* Add docstring for _gen_candidate_chars

* remove redundant to_text and list comphenesion

* Move set of 'chars' default in _random_password

on py2, C.DEFAULT_PASSWORD_CHARS is a regular str
type, so the assert here fails. Move setting the
default into the method and to_text(DEFAULT_PASSWORD_CHARS)
if it's needed.

* combine _random_password and _gen_password

* s/_create_password_file/_create_password_file_dir

* native strings for exception msgs

* move password to_text to _read_password_file

* move to_bytes(content) to _write_password_file

* add more test assertions about genned pw's

* Some cleanups to alikins and abadger's password lookup refactoring:

* Make DEFAULT_PASSWORD_CHARS into a text string in constants.py
  - Move this into the nonconfigurable section of constants.
* Make utils.encrypt.do_encrypt() return a text string because all the
  hashes in passlib should be returning ascii-only strings and they are
  text strings in python3.
* Make the split up of functions more sane:
   - Don't split such that conditionals have to occur in two separate functions.
   - Don't go overboard: Good to split file system manipulation from parsing
     but we don't need to do every file manipulation in a separate
     function.
  - Don't split so that creation of the password store happens in two
    parts.
  - Don't split in such a way that no decisions are made in run.
* Organize functions by when it gets called from run().
* Run all potential characters through the gen_candidate_chars function
  because it does both normalization and validation.
* docstrings for functions
* Change when we store salt slightly.  Store it whenever it was already
  present in the file as well as when encrypt is requested.  This will
  head of potential idempotence bugs where a user has two playbook tasks
  using the same password and in one they need it encrypted but in the
  other they need it plaintext.
* Reorganize tests to follow the order of the functions so it's easier
  to figure out if/where a function has been tested.
* Add tests for the functions that read and write the password file.
* Add tests of run() when the password has already been created.
* Test coverage currently at 100%
8 years ago
cinerama70 02cec7dca9 Add os_family to test_distribution_version (#17620)
As suggested in feedback on
https://github.com/ansible/ansible/pull/17575, add
os_family to test_distribution_version. Add the
correct os_family to the existing testcase data
entries.

Also add os_family to the output of
gen_distribution_version_testcase.py so any new
generated entries will contain this data.
8 years ago
James Cammarata 5a57c66e3c Moving result reading to a background thread 8 years ago
Steve Gargan a06da86d52 update consul tests to reflect fixes to the core and session modules (#17451) 8 years ago
Tom Melendez 91a30e59e4 Changes to enable make gce to run. Added sys import so libcloud error is displayed; renamed credentials keys in template file so they work properly with gce_credentials.py. (#16607) 8 years ago
Toshio Kuratomi 8af8eec789 Merge pull request #17590 from abadger/vault-fixes
Vault fixes
8 years ago
Matt Clay 355b29573c Use default on undefined vars in tests. (#17601) 8 years ago
Toshio Kuratomi e70066a6f7 Many Cleanups to vault
* Make is_encrypted_file handle both files opened in text and binary mode
  On python3, by default files are opened in text mode.  Since we know
  the encoding of vault files (and especially the header which is the
  first set of bytes) we can decide whether the file is an encrypted
  vault file in either case.
* Fix is_encrypted_file not resetting the file position
* Update is_encrypted_file to check that all the data in the file is ascii
* For is_encrypted_file(), add start_pos and count parameters
  This allows callers to specify reading vaulttext from the middle of
  a file if necessary.
* Combine VaultLib.encrypt() and VaultLib.encrypt_bytestring()
* Change vault's is_encrypted() to take either text or byte strings and to return False if any part of the data is non-ascii.
* Remove unnecessary use of six.b
* Vault Cipher: mark a few methods as private.
* VaultAES256._is_equal throws a TypeError if given non byte strings
* Make VaultAES256 methods that don't need self staticmethods and classmethods
* Mark VaultAES and is_encrypted as deprecated
* Get rid of VaultFile (unused and feature implemented in a different way)
* Normalize variable and parameter names on plaintext, ciphertext, vaulttext
* Normalize variable and parameter names on "b_" prefix when dealing with bytes
* Test changes:
  * Remove redundant tests( both checking the same byte string)
  * Fix use of format string without format operator
  * Enable vault editor tests on python3
  * Initialize the vault_cipher for VaultAES256 testing in setUp()
  * Make assertTrue and assertFalse take the actual method calls for
    better error messages.
  * Test that non-ascii byte strings compare correctly.
  * Test that unicode strings and ints raise TypeError

* Test-specific:
  * Removed test_methods_exist().  We only have one VaultLib so the
    implementation is the assurance that the methods exist. (Can use an abc for
    this if it changes).
  * Add tests for both byte string and text string input where the API takes either.
  * Convert "assert" to unittest assert functions or add a custom message where
    that will make failures easier to debug.
  * Move instantiating the VaultLib into setUp().
8 years ago
Toshio Kuratomi 0139298786 Have unittests import mock from ansible.compat so they work on py3 without mock installed from pypi 8 years ago
James Cammarata dfb1c0647e Revert "Move queuing tasks to a background thread"
This reverts commit b71957d6e6.
8 years ago
Matt Clay 16baef1f72 Do not use bare vars in integration tests. (#17599) 8 years ago
Matt Davis f497d771c8 win_shell/win_command changes + tests (#17557) 8 years ago
Matt Clay 7b3cbafbe9 Add python 3 awareness to apt module tests. (#17574)
Also remove unnecessary dependency from ubuntu1604py3 Dockerfile.
8 years ago
Matt Clay bcb49fecb5 Add tool for downloading Shippable logs. 8 years ago
Toshio Kuratomi f4cd1c6321 Fix galaxy's parsing of the command line. (#17569)
Also make the parsing of the action in both galaxy and vault more
robust.

Fixes #17534
May Fix #17563
8 years ago
René Moser 28feba2fb3 jenkins_job: extend integration tests (#17558) 8 years ago
Allen Sanabria b510abce17 CloudRetry/AWSRetry backoff decorator with unit tests (#17039)
* Added aws_retry decorator function with unit tests

* Restructured the code to be used with a base class.

This base class CloudRetry can be reused by any other cloud provider.
This decorator should be used in situations, where you need to implement
a backoff algorithm and want to retry based on the status code from the
exception.

* updated documentation

* fixed tabs

* added botocore and boto3 to requirements.txt

* removed cloud.py from py24 tests, as it depends on boto3

* fix relative imports

* updated test to be 2.6 compat

* updated method name from retry to backoff

* readded lxd

* Updated default backoff from 2 seconds to 1.1s.

This will be about a total of 48 seconds in 10 tries. This is
configurable.
8 years ago
Michael Scherer e9ffe2062f Add test for the pause in loop feature (#17336)
See https://github.com/ansible/ansible/pull/17289
8 years ago
René Moser 6a3e948a7c jenkins_job: add integration tests (#17499) 8 years ago
Toshio Kuratomi bf29961947 Fixes to the controller text model (#17527)
* Fixes to the controller text model

* Change command line args to text type
* Make display replace undecodable bytes with replacement chars.  This
  is only a problem on pyhton3 where surrogates can enter into the msg
  but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml

* Fix up run_cmd to change its parameters to byte string at appropriate times.
8 years ago
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.
8 years ago