Commit Graph

1780 Commits (21813ed83eb899a7c2c78b024abcd9db6ce01023)

Author SHA1 Message Date
Toshio Kuratomi 57701d7115 Give native strings to selinux library functions. (#17184)
* Give native strings to selinux library functions.

SELinux takes pathnames as native strings.  That means we need to
convert to bytes on python2 and convert to text on python3.

Fixes #17155

* Read kitchen documentation, make module_utils params more like kitchen API

* Remove none nonstring strategy and add strict
* Raise TypeError on invalid nonstring strategy

* Document to_native()

* Make unittests for testing module_utils.text
8 years ago
Adrian Likins a4785c2691 Fix docker connection plugin version tests and py2.6 compat (#16841)
* Rm py2.7+ code in docker connection plugin

The docker connection plugin was using subprocess.check_output
which only exists in python 2.7 and later. Connection plugins
need to support python2.6 so this replaces it with Popen/communicate()

* Handle docker ver errors in docker connection

Add unit tests for DockerConnection

Fixes #16971
8 years ago
Toshio Kuratomi d29a7c55fe Enable some basic.py tests on python3 (#17167) 8 years ago
Adrian Likins 7d41f623dd Move py34 mock_open compat to compat/test/mock (#17157)
test/units/plugins/action/test_action.py had code
for handling a bug in python 3.4's mock_open that
causes errors when reading binary data.

Moved to compat/tests/mock.py so other tests can
use it by default.
8 years ago
Matt Clay 04bd6a3619 Make tests more cross platform. (#17154) 8 years ago
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.
8 years ago
Brian Coca 4fb09d5693 moved from extras repo where it incorrectly exists (#17124)
* moved from extras repo where it incorrectly exists

* added to sanity exclusion for 2.4

* changed license with author's consent
8 years ago
Toshio Kuratomi bd31cc096a Fix facts.py for python3 (#17131)
* Fix facts.py for python3

* Update facts unittest to account for filepaths being byte strings
8 years ago
Adrian Likins 7bd57acda4 Linux mount/fs (lsblk) facts fixes and tests. (#17036)
Fixes #10779

Refactor some of the block device, mount point, and
mtab/fstab facts collection for linux for better
performance on systems with lots of block devices.

Instead of invoking 'lsblk' for every entry in mtab,
invoke it once, then map the results to mtab entries.

Change the args used for invoking 'findmnt' since the
previous combination of args conflicts, so this would
always fail on some systems depending on version.

Add test cases for facts Hardware()/Network()/Virtual() classes
__new__ method and verify they create the proper subclass based
on the platform.system() results.

Split out all the 'invoke some command and grab it's output'
bits related to linux mount paths into their own methods so
it is easier to mock them in unit tests.

Fix the DragonFly* classes that did not defined a 'platform'
class attribute. This caused FreeBSD systems to potentially
get the DragonFly* subclasses incorrectly. In practice it
didnt matter much since the DragonFly* subclasses duplicated
the FreeBSD ones. Actual DragonFly systems would end up with
the generic Hardware() etc instead of the DragonFly* classes.

Fix Hardware.__new__() on PY3, passing args to __new__
would cause "object() takes no parameters" errors. So
check for PY3 and just call __new__ without the args

See
https://hg.python.org/cpython/file/44ed0cd3dc6d/Objects/typeobject.c#l2818
for some explaination.
8 years ago
Matt Davis e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
8 years ago
Brian Coca b1410fa278 fixed tests to accoutn for new parameter 8 years ago
James Cammarata c669a381d1 Don't immediately return failed for any_errors_fatal tasks
Instead of immediately returning a failed code (indicating a break in
the play execution), we internally 'or' that failure code with the result
(now an integer flag instead of a boolean) so that we can properly handle
the rescue/always portions of blocks and still remember that the break
condition was hit.

Fixes #16937
8 years ago
Matt Clay b44eb402bd Update ansible-core-ci endpoint. (#17071) 8 years ago
Matt Clay 901042f458 Generate test script to file instead of stdout. 8 years ago
Matt Clay 2b0d63b0d8 Flush stderr to avoid lost output. 8 years ago
James Cammarata 47acf55fa9 Cache tasks by uuid in PlayIterator for O(1) lookups
Rather than repeatedly searching for tasks by uuid via iterating over
all known blocks, cache the tasks when they are added to the PlayIterator
so the lookup becomes a simple key check in a dict.
8 years ago
James Cammarata e244895174 Avoid copying task parents in TaskExecutor
As Block.copy() is potentially expensive, avoid copying the parent
structure of tasks in TaskExecutor.
8 years ago
James Cammarata 06d4f4ad0e Move tasks/blocks to a single parent model 8 years ago
James Cammarata d2b3b2c03e Performance improvements 8 years ago
Matt Clay 80385a47bd Remove FreeBSD interpreter test hacks. (#17007)
* Add TEST_FLAGS to no_log target.
8 years ago
Filipe Niero Felisbino e54a9d3a51 Add generic data structures querying (#13684)
* Query lookup plugin

* Add license and docstrings

* Add python3-ish imports

* Change query plugin type from lookup to filter

* Switch from dq to jsonpath_rw

* Add integration test for query filter

* Rename query filter to json_query

* Add jsonpath-rw

* Rename query filter to json_query

* Switch query implementation from jsonpath-rw to jmespath
8 years ago
Matt Clay d2fb845955 Enable more FreeBSD integration tests. (#16991) 8 years ago
Matt Clay 72cca01cd4 Use file list, not recursion, in _fixup_perms. (#16924)
Run setfacl/chown/chmod on each temp dir and file.

This fixes temp file permissions handling on platforms such as FreeBSD
which always return success when using find -exec. This is done by
eliminating the use of find when setting up temp files and directories.

Additionally, tests that now pass on FreeBSD have been enabled for CI.
8 years ago
Matt Davis 746ea64d30 fix for unspecified retries on until + test (#16963)
fixes #16907
8 years ago
Will Thames eb2a3a91a8 task_result _check_key should handle empty results (#16766)
When a task result has an empty results list, the
list should be ignored when determining the results
of `_check_key`. Here the empty list is treated the
same as a non-existent list.

This fixes a bug that manifests itself with squashed
items - namely the task result contains the correct
value for the key, but an empty results list. The
empty results list was treated as zero failures
when deciding which handler to call - so the task
show as a success in the output, but is deemed to
have failed when deciding whether to continue.

This also demonstrates a mismatch between task
result processing and play iteration.

A test is also added for this case, but it would not
have caught the bug - because the bug is really in
the display, and not the success/failure of the
task (visually the test is more accurate).

Fixes ansible/ansible-modules-core#4214
8 years ago
James Cammarata 159aa26b36 FEATURE: adding variable serial batches
This feature changes the scalar value of `serial:` to a list, which
allows users to specify a list of values, so batches can be ramped
up (commonly called "canary" setups):

- hosts: all
  serial: [1, 5, 10, "100%"]
  tasks:
  ...
8 years ago
Matt Clay 5f12731797 Run more integration tests on FreeBSD. (#16923) 8 years ago
Matt Clay 00fbc76e69 Increase async time limit on tests to 10 seconds. (#16921) 8 years ago
Matt Clay ff4f4bc8a0 Add binary module tests to Windows CI. (#16914) 8 years ago
Matt Clay 17e4629d52 Add remote CI support for modules. (#16908) 8 years ago
Matt Clay e2602e9be0 Add FreeBSD to Shippable CI. (#16883) 8 years ago
Matt Clay 6dc148d82c Download files from S3 to improve reliability. (#16891)
Binary module tests now download pre-compiled binaries from S3
instead of downloading go and compiling the modules.

Files downloaded form SourceForge are now downloaded from S3.
8 years ago
Gennady Trafimenkov 2bc679be07 Testing that service not enabled during check run (#16739)
* Enabled more tests in test_service on systems with systemd.
* Fix inconsistency in cleaning up test service. The conditions for service setup and service cleanup were different.
* Add check mode run for service enable.
8 years ago
Matt Clay 380ed053e8 Add Windows integration tests to Shippable. (#16803)
Enable Windows integration tests on Shippable.
8 years ago
William Albert 409d95d67e Refactored gce util module to support other GCP services (#15924)
This is a refactoring of the existing GCE utility module to support other projects on Google Cloud Platform.

The previous gce.py module was hard-coded specifically for GCE, and attempting to use it with other projects in GCP failed.

See https://github.com/ansible/ansible/pull/15918#issuecomment-220165913  for more detail.

This has also been an issue for others in the past, although they've handled it by simply
duplicating some of the logic of gce.py in their own modules.

-   The existing gce.py module was renamed to gcp.py, and modified to remove any 
     imports or other code that refers to libcloud.compute or GCE (the GCE_* params were
     retained for compatibility). I also renamed the gce_connect function to gcp_connect, 
     and modified the function signature to make supplying a provider, driver, and agent 
     information mandatory.

-  A new gce.py module was created to handle connectivity to GCE. It imports the
   appropriate libcloud.compute providers and drivers, and then passes them on
   to gcp_connect in gcp.py. The constants and function signatures are the same
   as the old gce.py, so compatibility with existing modules is retained.

- A new gcdns.py module was created to support PR ansible/ansible-modules-extras#2252
  for two new Google Cloud DNS modules, and to demonstrate support for a non-GCE 
  Google Cloud service. It follows the same basic structure as the new gce.py module,
  but imports from libcloud.dns instead.
8 years ago
Gennady Trafimenkov ad24f2d206 Enable color output from integration tests in Docker containers (#16660)
Enable color output from integration tests in Docker containers:

* In run_tests.sh when output is attached to a terminal.
* In shippable/integration.sh using force mode (can be disabled).

Also fix blocks tests to work with or without color output
8 years ago
Matt Clay 9497a814a8 Add apache2 to improve test speed and reliability. (#16819) 8 years ago
Brian Coca e2f17f8d9b set cwd to task's basedir (#16805)
* switch cwd to basedir of task

This restores previous behaviour in pre 2.0 and allows for 'local type' plugins
and actions to have a more predictable relative path.

fixes #14489

* removed FIXME since prev commit 'fixes' this

* fix tests, now they need a loader (thanks jimi!)
8 years ago
Matt Martz 4065acc37d indent callback output if using 3verbosity or higher (#16231) 8 years ago
Robin Roth 2b28beb1d7 add check_mode option for tasks (#16056)
* add check_mode option for tasks

includes example testcases for the template module

* extend check_mode option

* replace always_run, see also proposal rename_always_run
* rename always_run where used and add deprecation warning
* add some documentation

* have check_mode overwrite always_run

* use unique template name to prevent conflicts

test_check_mode was right before, but failed due to using the same filename as other roles

* still mention always_run in the docs

* set deprecation of always_run to version 2.4

* fix rst style

* expand documentation on per-task check mode
8 years ago
s-hertel 93c5ec42cf Test GalaxyCLI when no actions are provided
Adds a new test for GalaxyCLI. Tests cases when:

- no actions are provided
- invalid actions are provided
- each valid action is provided

When parser() runs successfully the method returns True, creates a
SortedOptParser instance, a Galaxy instance, and updates certain class data.
8 years ago
s-hertel 671f9c3d15 Merge pull request #16783 from s-hertel/test_display_galaxy_info_fix
fixing a logic error in test_galaxy
8 years ago
s-hertel 3cb5747f54 fixing a logic error in test_galaxy 8 years ago
s-hertel aae5e50299 Adding a test for GalaxyCLI. Tests exit_without_ignore method. 8 years ago
Christoph Dittmann d55452d3ed Adding unit tests for role variable precedence
Originally from PR #16735
8 years ago
Matt Clay 4cc4dc6793 Add postgresql dependencies to opensuseleap. 8 years ago
nitzmahone 7aa39981c4 fix setup test for renamed windows fact 8 years ago
jctanner 238c6461f6 Add a function to check for killed processes in all strategies (#16684)
* Add a function to check for killed processes so that if any
threads are sigkilled or sigtermed, the entire playbook execution is aborted.
8 years ago
James Cammarata 153133132d Updating tests for new module feature for remote_src in unarchive
Fixes #10218
8 years ago
Toshio Kuratomi c8a8f546d4 A little unittest refactoring (#16704)
A little unittest refactoring

* Add a class decorator to generate tests when using a unittest.TestCase base class
* Add a TestCase subclass with setUp() and tearDown() that sets up
  module parameter parsing
* Move test_safe_eval to use the class decorator and ModuleTestCase base
  class
* Move testing of set_mode_if_different into its own file and separate
  some test methods out so we get better errors and more coverage in
  case of errors.
* Naming convention for test cases doesn't need to duplicate information
  that's already in the file path.
8 years ago
James Cammarata 221520cbad Fixing type in 293723f (mock_handler -> mock_handler_task) 8 years ago
James Cammarata 0ea2b2a6af Fix unit test for base strategy in regards to handler changes 8 years ago
s-hertel e84ab95733 Fixing bug in GalaxyCLI test; creates temp dir for role_path instead … (#16689)
* Fixing bug in GalaxyCLI test; creates temp dir for role_path instead of installing to /etc/ansible/roles

* Update test_galaxy.py
8 years ago
nitzmahone de549ad675 update action unit test for powershell shebang behavior 8 years ago
s-hertel 9c925eeeab Adding a test for GalaxyCLI and two methods on which it depends. Tes… (#16651)
* Adding a test for GalaxyCLI and two methods on which it depends. Tests execute_info method.

*  Adding a test for GalaxyCLI and two methods on which it depends. Tests execute_remove method.

* Update test_galaxy.py

* Revising test for GalaxyCLI execute_remove.

* Removing mocks
8 years ago
Matt Clay 0ada7eae5e Add test tags for shell and command modules. 8 years ago
= 3c66caa058 fix win_msi tests by setting wait: true on all win_msi tasks.
I suspect this problem was masked previously as older versions of pywinrm
where significantly slower, allowing more time for the windows installer service to complete.
8 years ago
Matt Clay bbffa0a0e9 Add tags for modules without dedicated test roles. 8 years ago
James Cammarata cd4412016a Updating integration tests for async testing 8 years ago
Matt Davis 30c63a41e9 Merge pull request #16555 from matsu-chara/fix-error-msg-default-to-defaults
fix default/main.yml to defaults/main.yml
8 years ago
Matt Clay 9a6b8ab271 Add more tags to test_async role. 8 years ago
Matt Clay fdf22b5a40 Support module tests on a single image. (#16620) 8 years ago
Matt Clay 696feacbb6 Add script to generate module tests. (#16617) 8 years ago
Robin Roth d0ccedc617 Fix git shallow update (#16224)
* add git shallow fetch test

covers https://github.com/ansible/ansible-modules-core/issues/3782

updating a repo with depth=1 fails silently if version==HEAD

* raise git version support supporting depth to 1.9.1
8 years ago
Robin Roth 1f04130c00 add more distribution version tests (#16563)
* ubuntu 16.04
* solaris 10, 11
* fedora 22, 25

Thanks Peter Oliver for providing the test data
8 years ago
Robin Roth 8021adfe97 use git-core ppa instead of menulibre
menulibre is no longer actively maintained and does not support 16.04
8 years ago
Robin Roth a5e394d23a reenable apt_repository tests in ubuntu 16.04
fixes #15718
8 years ago
matsu-chara 9f8b0cabcd fix default/main.yml to defaults/main.yml 8 years ago
Matt Clay 4e369a31db Fix test_async. (#16552)
* Conditionally run test_async in docker containers.
* Revise test_async test.
8 years ago
Matt Clay 292785ff2b Parse async response in async action. (#16534)
* Parse async response in async action.
* Add async test for non-JSON data before module output.
* Fix existing async unit test.

Resolves #16156
8 years ago
Abhijit Menon-Sen 950cc26aab Use loop_control.loop_var directly
6eefc11c converted task.loop_control into an object, but while the other
callers were updated to use .loop_var instead of .get('loop_var'), this
site was overlooked.

This can be reproduced by including with loop_control a file that does
set_fact; a simple regression test along these lines is included.
8 years ago
Matt Clay fbfadc47c7 Update shippable shared dir for COPY_SOURCE. (#16511)
Tests now use '/shared' instead of '/tmp/shared-dir' when using
COPY_SOURCE. This avoids issues with containers purging '/tmp'.
8 years ago
Matt Clay f1e1558f4f Unpin yamllint now that version 1.3.2 is out. (#16479)
The newer version of yamllint fixes the UnicodeEncodeError
which previously required pinning the version to 1.2.2.
8 years ago
jctanner 4ba60d00c8 Refactor the parameter splitting in ini lookup to handle more path formats (#16477)
Refactor the parameter splitting in ini lookup to handle more path formats.

Fixes #16468
8 years ago
Matt Clay 394430a61e Switch test_lookups to badssl/local testing. (#16466)
* Switch test_lookups to badssl/local testing.
* Use var for checking badssl host content.
8 years ago
Matt Clay 81a49912b0 Pin yamllint to 1.2.2 to avoid issues in 1.3.0. (#16464)
This also moves shippable test requirements to external files.
8 years ago
Pilou b361bf90d7 Lookup password omit salt (#16361)
* Lookup unencrypted password must not include salt
* Integration test lookup: remove previous directory
* Test that lookup password doesn't return salt
* Lookup password: test behavior with empty encrypt parameter

Closes #16189
8 years ago
Matt Clay 1b29c87936 Test ansible version and ping during sanity tests. (#16441) 8 years ago
YueMing Qin 310692abe0 Changes to be committed: (#16430)
renamed:    lookup_pipe.py -> lookup_pipe.yml
8 years ago
nitzmahone 1f92ade584 add integration test to assert included tasks run in proper order 8 years ago
Matt Clay 8a55a446bf Fix fedora23 Dockerfile after fedora:23 updates. 8 years ago
Pilou 7ffbbd34f4 Add python-passlib to docker images. (#16376)
Related to #16361
8 years ago
Matt Clay 7de23a1c5b Update opensuseleap Dockerfile.
- Do not update base image packages unnecessarily.
- Fix incorrect package names.
- Remove commented out RUN statements.
- Sort list of packages to install.
8 years ago
jctanner b7f9037b5b Add test for multi-options in authorized_key (#16375)
Addresses https://github.com/ansible/ansible-modules-core/issues/1715
8 years ago
James Cammarata ca6ee4c789 FEATURE: handler listeners
Fixes ansible/proposals#8
8 years ago
James Cammarata 8218591fec Track notified handlers by object rather than simply their name
Due to the fact that roles may be instantiated with different sets of
params (multiple inclusions of the same role or via role dependencies),
simply tracking notified handlers by name does not work. This patch
changes the way we track handler notifications by using the handler
object itself instead of just the name, allowing for multiple internal
instances. Normally this would be bad, but we also modify the way we
search for handlers by first looking at the notifying tasks dependency
chain (ensuring that roles find their own handlers first) and then at
the main list of handlers, using the first match it finds.

This patch also modifies the way we setup the internal list of handlers,
which should allow us to correctly identify if a notified handler exists
more easily.

Fixes #15084
8 years ago
Nate Coraor 706778ee7f Fix distro detection for Solaris derivatives 8 years ago
nitzmahone 7bc3be64ae fix win_setup integration test to match fact name 8 years ago
= 9857af2b6e added further tests for win_regedit to cover the changes made
under https://github.com/ansible/ansible-modules-extras/pull/2436
8 years ago
jctanner 587d3c368b Fix synchronize+vagrant dest assertions that were incorrect. (#16291)
Addresses #16284
8 years ago
Matt Clay cabbafb650 Update Fedora and CentOS docker images.
- Reduce image size by skipping weak package references.
- Consolidate and sort packages to install.
- Improve consistency between versions.
- Combine yum/dnf install and clean to avoid unwanted caching.
- Don't update existing packages from base image unnecessarily.
8 years ago
Matt Clay 82b978e186 Add curl to Ubuntu docker images. 8 years ago
Matt Clay 349b06974e Update Ubuntu docker images.
- Reduce image size by skipping recommended packages.
- Consolidate and sort packages to install.
- Improve consistency between Ubuntu versions.
- Combine apt-get update and install to avoid caching stale updates.
8 years ago
Matt Clay 2f1fc5a324 Update integration test runner on shippable. 8 years ago
Matt Clay 62e6f6b885 Add junit-xml to docker images. 8 years ago
jctanner 3b3ab605f6 Add a get_url test for www.google.com (#16212)
Add a get_url test for www.google.com

Addresses #16191
8 years ago
Dag Wieers d91df20620 Fix unit tests for module_name commit #16087 8 years ago
Brian Coca a529a60478 raw should not use default executable (#16085)
also removed unused cruft in script
8 years ago
Toshio Kuratomi 872f3c5503 Revert "Add git shallow fetch test (#16055)" -- Broke integration tests:
https://app.shippable.com/runs/57599a7897ae890c00c2898d

This reverts commit e81f14ab48.
8 years ago
Robin Roth e81f14ab48 Add git shallow fetch test (#16055)
* add git shallow fetch test

covers https://github.com/ansible/ansible-modules-core/issues/3782

updating a repo with depth=1 fails silently if version==HEAD

* disable git shallow tests for old git versions

Older git versions don't treat the --depth option correctly.
While the git module tried to work around this and introduced subtle
bugs, ansible/ansible-modules-core#3794 falls back to full checkouts.
Don't run the tests then.
8 years ago
James Cammarata fbec2d9692 Expand return code values returned by TQM and strategies
This allows the PlaybookExecutor to receive more information regarding
what happened internal to the TaskQueueManager and strategy, to determine
things like whether or not the play iteration should stop.

Fixes #15523
8 years ago
Matt Clay 03597143d0 Detect use of Travis tests on Shippable.
This can occur when building pre-Shippable branches or PRs.
8 years ago
James Cammarata 61f132a609 Adding unit tests for playbook group/host vars 8 years ago
Toshio Kuratomi 5a3493be5f Port urls.py to python3 and other byte vs text fixes (#16124)
* Port urls.py to python3

Fixes (largely normalizing byte vs text strings) for python3

* Rework what we do with attributes that aren't set already.

* Comments
8 years ago
Matt Clay 6e1e86028f Split integration tests into multiple groups.
This will allow tests to complete much faster.
8 years ago
Toshio Kuratomi 73bb06ae84 Fix the code-smell tests for six again 8 years ago
Adrien Vergé 4d48711242 Fix YAML source and check it on Shippable (#15678)
Fix YAML source and check it on Shippable
8 years ago
Matt Clay 643a7ec01d Merge pull request #16126 from mattclay/shippable-fix
Update how shippable scripts are called.
8 years ago
Matt Clay 7a533406f9 Merge pull request #13145 from Mic92/devel
lxc connection plugin
8 years ago
Matt Clay 6d74f43eff Update how shippable scripts are called. 8 years ago
Saran Ahluwalia fda927a14b added failing test for testing if executable is not empty string 8 years ago
Matt Clay b0e1efbd62 Add full support for Shippable CI. 8 years ago
Toshio Kuratomi 08fd017d99 Test file needed to be renamed 8 years ago
Toshio Kuratomi 2a5ef4496a Workaround test failures on OSX controllers for now -- will have to look
more heavily into normailizing the unicode later.
8 years ago
Toshio Kuratomi f86df7c88b Test that task.args are also set properly (#15950) 8 years ago
Adrian Likins 644f0fb190 Merge pull request #15178 from alikins/galaxy_info_output
galaxy info displayed 'galaxy_info' section wrong [fix for #15177]
8 years ago
Brian Coca 3387d557bc Revert "Add prefixing and suffixing fuctionality to assemble module" (#16084) 8 years ago
Matt Clay e45b3b89a2 Skip some service tests for systemd. 8 years ago
jctanner c52cea8db3 Add a framework, fixtures and test for common synchronize scenarios. (#15983)
* Add a framework, fixtures and test for common synchronize scenarios.

Addresses #15905
8 years ago
Chris Houseknecht ce34397cf8 Merge pull request #10399 from underyx/assemble-with-prefix-and-suffix
Add prefixing and suffixing fuctionality to assemble module
8 years ago
jctanner 373b23cc24 Fix mock loader for osx /etc symlinks (#16074)
Fix role based unit tests for osx via mock.patch
8 years ago
Robin Roth c06884eff0 Run tests on ubuntu1604 and opensuseleap (#15936)
* reduce async sleep time in test
* make zypper test less destructive (don't break following uses of zypper)
* fix ca cert on suse
* fix/enable postgres/mysql on opensuseleap
* fix mysql test for mysql versions 5.7.6 and newer
* skip sni_host check on ubuntu1604
* add HTTPTESTER flag for test_uri

ubuntu 16.04 uses dash which drops env variables containing a dot
we work around this by adding an explicit env variable to enable httptester
8 years ago
Bence Nagy 13210e346f Add integration test for assemble with a header and a footer 8 years ago
Matt Clay 027006b846 Don't use TEST_FLAGS for the test_tags target.
This allows use of --skip-tag in TEST_FLAGS without conflicting with the test.
8 years ago
Matt Clay 844b415066 Mark tasks expected to fail with EXPECTED FAILURE.
This allows for automated identification of tasks which are
expected to fail, but which cannot use ignore_errors because
they need to fail.
8 years ago
Adrian Likins 1468538414 galaxy info displayed 'galaxy_info' section wrong
The output of 'ansible-galaxy info' was formatting the
'galaxy_info' key with one char per line.

Previously, when building the output string, items in
role_info that had a dict for value, the label for
it's key ('galaxy_info' for ex) was being added to
the text list in addition to being appended. Only
the append is needed.

Also added a unit test in test/units/cli/test_galaxy.py,
but skip it on py3 until galaxy is py3 compatible.

fixes #15177
8 years ago
jctanner 018d3c3118 Add a new vmware inventory script backed by pyvmomi (#15967)
Add a new dynamic vmware inventory script backed by pyvmomi
8 years ago
Jörg Thalheim 88482234e6
lxc connection plugin 8 years ago
Toshio Kuratomi c03555b650 Fix unarchive failures when the destination is a symlink to a directory (#15999)
Also add integration tests for this problem and unicode filenames inside
a tarball.

Fixes #3725
8 years ago
Matt Clay b755bcd875 Corrected reference to httptester container. 8 years ago
Matt Martz 164f247ec8 Add httptester docker container files and update run_tests.sh to use ansible/httptester 8 years ago
Brian Coca 329c62e914 docker was deprecated, test now reflects new name 8 years ago
Toshio Kuratomi 650bfdce8f Update grep for six to not falsely trigger when six is only a substring of a different library 8 years ago
Robin Roth 0edec45c3d install packages for tests (#15979)
* curl is needed for test_binary_modules
* glibc-i18ndata is needed for postgresql (localedef)
8 years ago
John R Barker 1861151fa4 [WIP] Extra test and build dependencies in Docker images (#15692)
* Merge conflicts:

* [skip ci] Revert changes to run_tests.sh

gundalow will update this in a different PR

* [skip ci] Add in ubuntu1604 and opensuseleap

NOTE: We are not configuring anything to use these new images yet.
Therefore no impact on Travis performance

* python-mysql for opensuse

* It's mysql-server on centos6
8 years ago
Toshio Kuratomi b41b6b2ec5 Update test off make_become for ssh pty race mitigation (#15931) 8 years ago
nitzmahone 42f6114b61 fix windows integration tests to run under kerberos users 8 years ago
Michael Scherer 376fc21f92 Add a exception for module_utils/six.py regarding code smell (#15878)
Since six replace urlopen, it is normal to trigger the test,
hence the exception
8 years ago
Michael Scherer cc61531a74 Do not test vca and vmware.py for py2.4 (#15887)
Since both of them depend on libraries not
working on python 2.4, we shouldn't restrict
ourself on 2.4, cf https://github.com/ansible/ansible/pull/15870
8 years ago
Robin Roth 85477fa215 Don't use 'from ansible.module_utils import foo' style here as it breaks (#15756)
py.test"
8 years ago
Toshio Kuratomi c1cc9f1f23 Merge pull request #15845 from abadger/ziploader-constants
Ship constants to the modules via internal module params rather than a secondary dict
8 years ago
Toshio Kuratomi 186337db28 Ship constants to the modules via internal module params rather than a secondary dict. 8 years ago
Matt Davis bc7405efc9 Merge pull request #15797 from robinro/patch-1
reduce async timeout in unittests
8 years ago
Matt Martz 196453b9b2 Merge pull request #13771 from sivel/binary-modules
First pass at allowing binary modules
8 years ago
Matt Martz 651b83d8be Run test_binary_modules 8 years ago
Matt Martz 0faddfa168 Move binary module detection into executor/module_common.py 8 years ago
Matt Martz 3466e73c50 Resolve test failures 8 years ago
Matt Martz 2d18607f1e Add GPL3 header to helloworld.go 8 years ago
Matt Martz 6ad8ec0919 Add integration tests for binary modules 8 years ago
Toshio Kuratomi 292f0ed0d6 If we can't squash for any reason, then simply do not optimize the items loop.
Also add more squashing testcases

Fixes #15649
8 years ago
Toshio Kuratomi 8a184381af Strip junk after JSON return. (#15822)
Fixes #15601
8 years ago
James Cammarata 67c32ac30a Merge branch 'samples-to-test' of https://github.com/dagwieers/ansible into dagwieers-samples-to-test 8 years ago
Matt Martz accf40d8a8 Use httptester docker image for http tests (#15811)
* Use httptester docker image for http tests

* When not running with an httptester linked container, use public test sites
8 years ago
Toshio Kuratomi c730af5dc2 Remove reload from arg related tests. Changes to how ziploader passes args mean we don't need reload anymore. (#15782) 8 years ago
Toshio Kuratomi 7ccb08cc7e Switch to a different url for testing SNI right now. (#15798) 8 years ago
Robin Roth 254cf9ea68 reduce async timeout
reduce from 3 sec to 0.1 sec; the 3 sec sleep was about half of the total unittest time on my development machine...
8 years ago
Toshio Kuratomi 5c7ad654db Add some more tests for item squashing 8 years ago
nitzmahone 133395db30 add jimi-c's unit test for squashed skip results, tweaked is_skipped() logic to pass 8 years ago
Brian Coca 2af8e3b9d8 fix default for removing images 8 years ago
Brian Coca 27a1ae4732 added ability to also subset make tests 8 years ago
Rene Moser 5583027f99 tests, postgresql: add ubuntu 16.04 support 8 years ago
Rene Moser 39e4caafb2 tests, apt_repository: disable Ubuntu 16.04 as there is no package yet 8 years ago
Rene Moser c20d1fced7 tests: fix tests on Debian 8 8 years ago
Robin Roth cf62a62b83 use userdir module as example instead of alias (#15540)
* alias module is very basic and removing it leads to the suse default
  config failing
* future improvements might test different modules and the effect of
  them being removed
8 years ago
Brian Coca 47d58c30e4 another var 'defaulted' in run_tests 8 years ago
Brian Coca 3669ab2456 added defaults for 'optional' vars 8 years ago
Brian Coca 52a714143f fine tuned shell switches for run_tests.sh 8 years ago
Yannig 3901556b35 When var name is the same as var content, try to template it before reporting that var is not defined. (#13629)
* When var name is the same as var content, try to template it before reporting that var is not defined.
Add asserts in test_var_blending to check this special corner case.

* Fix integration tests when using debug with list or dict.
8 years ago
Robin Roth 1d6608e84f Dist version fix for Red Hat and more tests (#15663)
* add tests for centos6, rhel6 and rhel7

* gen_distribution_version_testcase with python2.6

* remove unused imports

* fix redhat/vmware/... parsing

* add centos7 test case
8 years ago
Toshio Kuratomi 1b78fd57b1 Merge pull request #15656 from abadger/ziploader-namespace
Fix ziploader for the cornercase of ansible invoking ansible.
8 years ago
Matt Davis ca5080d56b Merge pull request #15570 from jhawkesworth/regedit_fix_str_compare_tests
win_regedit integration test to cover change to allow empty string comparison
8 years ago
Toshio Kuratomi 487e6562ca Fix ziploader for the cornercase of ansible invoking ansible.
* Make ziploader's ansible and ansible.module_utils libraries into
  namespace packages.
* Move __version__ and __author__ from ansible/__init__ to
  ansible/release.py.  This is because namespace packages only load one
  __init__.py.  If that is not the __init__.py with the author and
  version info then those won't be available.
* In ziplaoder, move the version ito ANSIBLE_CONSTANTS.
* Change PluginLoader to properly construct the path to the plugins even
  when namespace packages are present.
8 years ago
Toshio Kuratomi d652b2edc0 Fix for unittests on python2.6 or less 8 years ago
Robin Roth 12f7f50f31 extend zypper integration tests (#15596)
* extend zypper integration tests

* fix caching issue of local RPMS on openSUSE 42.1 Leap
* add tests for simultaneous install/remove via prefixes +-
* test fail cases (rm patch or URL)
* test patch install (succes, unchanged second run, fail on wrong name)

* add test for pattern install
8 years ago
Toshio Kuratomi 7e1fbe2e03 Some algorithmic unittests for the apt and docker modules 8 years ago
Toshio Kuratomi e4a1622f53 Do not check docker or azure module_utils code for py2.4 compat (the libs require py2.6+) 8 years ago
Toshio Kuratomi 85bef402b1 Merge pull request #14614 from gundalow/test_binary
non-destructive says we should run test_binary at v2
8 years ago
Tegan Snyder bf0da4aa3c add centrify dzdo escalation (#15219)
add dzdo context, and test
8 years ago
= bd74091ed9 win_regedit integration test to cover change to allow empty strings to be compared 8 years ago
Toshio Kuratomi 44e21f7062 Allow AnsibleModules to be instantiated more than once in a module
Fix SELINUX monkeypatch in test_basic
8 years ago
jctanner 4d36b3f7b6 Extend the get_url integration tests to include file schemas. (#15532)
Addresses https://github.com/ansible/ansible-modules-core/issues/3511
8 years ago
Toshio Kuratomi e893b65a9b Don't pick up whole commented lines in the urlopen code-smell tests 8 years ago
Robin Roth 7a4e4c2b02 extend integration test for zypper_repository (#15387)
* include options refresh and priority introduced in ansible/ansible-modules-extras#1990
* test repo update both based on name and URL
* run on all suse flavors
* test overwriting repos by url or name
8 years ago
Robin Roth 59bad647b6 Revert "Disable new git tests until a fix for rhel6/7 is merged."
This reverts commit 197d3dfe97.
8 years ago
Toshio Kuratomi 03126f7097 Fix cut and paste error of test code 8 years ago
Toshio Kuratomi 197d3dfe97 Disable new git tests until a fix for rhel6/7 is merged. 8 years ago
Toshio Kuratomi 0a31c24938 Merge pull request #15419 from nitzmahone/module_debug_arg_override
add _load_params debug overrides for module args/file passed on cmdline
8 years ago
Brian Coca 33761efd19 Merge pull request #15417 from bcoca/copy_vaulted
Copy vaulted
8 years ago
Robin Roth e8b1c4e14a add test for git with both depth and version arguments (#15471)
* add test for ansible/ansible-modules-core#3456

combination of options version and depth

* add test of switching to older branch
8 years ago
Matt Davis 822f904aa6 Merge pull request #14813 from mattclay/lxd-plugin
Add lxd connection plugin.
8 years ago
James Cammarata 6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
8 years ago
nitzmahone 5b336832af add _load_params debug overrides for module args/file passed on cmdline
Updated python module wrapper explode method to drop 'args' file next to module.
Both execute() and excommunicate() debug methods now pass the module args via file to enable debuggers that are picky about stdin.
Updated unit tests to use a context manager for masking/restoring default streams and argv.
8 years ago
Matt Davis 6322ed833e Merge pull request #15422 from jhawkesworth/win_regedit_binary_tests
Windows: add win_regedit integration tests (needs https://github.com/ansible/ansible-modules-extras/pull/2034)
8 years ago
James Cammarata ed35e8bce2 Don't override the http status code when successful in urls.py 8 years ago
Toshio Kuratomi 7833b5bec4 Merge pull request #15420 from robinro/distribution_version_tests
Distribution version tests
8 years ago
Robin Roth 9bb069f873 Apache2 module integration test (#15380)
* add integration test for apache2_module

* fix assert syntax

* check os_family for this test

* add comment why only debian and suse are tested

* move apache2 test to destructive

* install apache2 package
8 years ago
Matt Clay 5fc76df18b Add lxd connection plugin. 8 years ago
Matt Martz a985bf6a31 Don't pass context to urlopen, instead add it to the handlers. Fixes https://github.com/ansible/ansible-modules-core/issues/3437 8 years ago
Robin Roth 49cdc565c5 remove nose.tools use 8 years ago
Robin Roth 4088aa2b4c get rid of assert_in 8 years ago
Robin Roth 692bf51fde move gen_testcase to hacking/tests
* also use json instead of pprint
8 years ago
Robin Roth 37188ea336 cleanup tests
* use nose test generator
* more comments
* move facts import inside the skipped function, fix python3 warning
8 years ago
Robin Roth 2b104fe6ad fix tests for SLES and CoreOS
* include #15230
8 years ago
Robin Roth b48e628429 test git version before running test on depth 8 years ago
= 157072a39f Windows: win_regedit integration tests (following https://github.com/ansible/ansible-modules-extras/pull/2034 ) 8 years ago
Cambell cdf6e3e4bf feature/copy-vault-dataloader: Add method get_real_file(file_path) to dataloader
- get_real_file will decrypt vault encrypted files and return a path to
  a temporary file.

- cleanup_real_file will remove a temporary file created previously with
  get_real_file
8 years ago
Robin Roth 776bffb52b Expand git integration test (#15391)
* add testcases to git for depth

* also in combination with refspec, which gets more tricky

* add testcase for ansible/ansible-modules-core#527
8 years ago
Robin Roth 3c883d8a6d add testcases from refactor PR 8 years ago
Matt Clay af8258cdf2 Revert "Increase verbosity of connection tests." (#15305) 8 years ago
Toshio Kuratomi 208ad36ce4 Merge pull request #15344 from abadger/ziploader
Ziploader "recursive imports" and caching
8 years ago
Jonathon Klobucar 7bee994e1c Fix for serial when percent amount is less than one host (#15396)
Ansible when there was a percentage that was calculated to be less than
1.0 would run all hosts as the value for a rolling update.

The error is due to the fact that Python will round a
float that is under 1.0 to 0, which will trigger the case of
0 hosts. The 0 host case tells ansible to run all hosts.

The fix will see if the percentage calculation after int
conversion is 0 and will else to 1 host.
8 years ago
Toshio Kuratomi 75546678d9 Fix unittests 8 years ago
Toshio Kuratomi dcc5dfdf81 Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as
pre-ziploader baseline.

Since this unittest isn't testing that the returned module data is
correct we don't need to worry about os.rename not having any module
data.  Should devise a separate test for the module and caching code
8 years ago
Matt Martz dd39f57ae7 Merge pull request #15289 from sivel/sni-urllib3-contrib-try2
Optional Use of urllib3 for SNI verification
8 years ago
nitzmahone 698ae7c383 ensure test_win_user fails on bogus error
We weren't previously checking the error message- it failed as expected, but for the wrong reason.
8 years ago
Strahinja Kustudić eed6cf5dad Adds 'ansible_check_mode' boolean magic variable
* Makes it possible to pass any options variable to VariableManager
  by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
8 years ago
Matt Martz 6e9c09d7f7 Utilize urllib3.contrib.pyopenssl functionality for SNI capability in python versions lacking SNI support
Also add SNI tests, move test_uri to destructive since we are messing with packages for SNI testing
8 years ago
Toshio Kuratomi 4b0aa1214c Ziploader
* Ziploader proof of concept (jimi-c)

* Cleanups to proof of concept ziploader branch:

* python3 compatible base64 encoding
* zipfile compression (still need to enable toggling this off for
  systems without zlib support in python)
* Allow non-wildcard imports (still need to make this recusrsive so that
  we can have module_utils code that imports other module_utils code.)
* Better tracebacks: module filename is kept and module_utils directory
  is kept so that tracebacks show the real filenames that the errors
  appear in.

* Make sure we import modules that are used into the module_utils files that they are used in.

* Set ansible version in a more pythonic way for ziploader than we were doing in module replacer

* Make it possible to set the module compression as an inventory var

This may be necessary on systems where python has been compiled without
zlib compression.

* Refactoring of module_common code:

* module replacer only replaces values that make sense for that type of
  file (example: don't attempt to replace python imports if we're in
  a powershell module).
* Implement configurable shebang support for ziploader wrapper
* Implement client-side constants (for SELINUX_SPECIAL_FS and SYSLOG)
  via environment variable.
* Remove strip_comments param as we're never going to use it (ruins line
  numbering)

* Don't repeat ourselves about detecting REPLACER

* Add an easy way to debug

* Port test-module to the ziploader-aware modify_module()

* strip comments and blank lines from the wrapper so we send less over the wire.

* Comments cleanup

* Remember to output write the module line itself in powershell modules

* for line in lines strips the newlines so we have to add them back in
8 years ago
jpic 4985411816 Test other use-cases for PluginLoader's config 8 years ago
jpic da175d0a57 Bugfix: proper plugin configuration was reset
Before this patch, if config was ['/some/path'] then it would enter the
else block and config would be set to [].

The regression this patch fixes was introduced by 700db154.
8 years ago
Toshio Kuratomi 4b0f65a3e5 Merge pull request #15207 from mattclay/verbose-test
Increase verbosity of connection tests.
8 years ago
Matt Davis 3f70d7a70d Merge pull request #15144 from mattclay/winrm-test
Add winrm tests and fix exposed unicode errors.
8 years ago
James Cammarata 180a0a8e77 Fixing up the logic in the test_script tests removal portion 8 years ago
Matt Clay 262c341cda Add connection tests for winrm connection plugin.
These are the same tests used for the other connection plugins,
adapted to use winrm modules and Windows friendly paths.
8 years ago
Matt Clay a0361626c9 Increase verbosity of connection tests. 8 years ago
James Cammarata 5fdac707fd New unit tests for #13630 fix 8 years ago
René Moser f2a81e580d Merge pull request #15169 from mgruener/test_cloudflare_dns
Integration tests for the cloudflare_dns module
8 years ago
James Cammarata d00ac6e2d1 Merge pull request #15072 from rajatguptarg/fix-requirements
Add pycrypto as a requirement to run tests
8 years ago
Michael Gruener 94806e1953 Add integration tests for the cloudflare_dns module 8 years ago
Brian Coca 1ebc2fda71 removes python requirement to script
mistakenly added when checksum was made to use stat module
fixed assertion in test
8 years ago
Matt Clay 943e4d37f5 Run more connection tests in Docker.
Connection tests are now run before non_destructive to make sure
that the known_hosts file in our Docker image has not been removed.
8 years ago
Toshio Kuratomi 52e9209491 Don't create world-readable module and tempfiles without explicit user permission 8 years ago
Toshio Kuratomi 1802e09b08 Exclude .tox from paths scanned for urlopen 8 years ago
Toshio Kuratomi d3583108ec Fix log_invocation test on python2 with hash randomization 8 years ago
Matt Martz ad30bad14f Skip test_module_utils_basic__log_invocation until we can figure out the cause of the failure 8 years ago
Matt Martz a6d52ce098 Ensure that any command in run_tests.sh that fails results in immediate failure 8 years ago
Toshio Kuratomi c3548677de Add TEST_FLAGS to test_hash 8 years ago
James Cammarata 6afed7083a Revert "Use docker cp instead of docker volumes to allow for testing with remote docker servers"
This reverts commit 18599047cd.
8 years ago
James Cammarata 90ffb8d8f0 Also remove volumes when removing containers 8 years ago
James Cammarata 9a2c1cf94d Force removal of docker container after test ends 8 years ago
Matt Martz 18599047cd Use docker cp instead of docker volumes to allow for testing with remote docker servers 8 years ago
James Cammarata 081c33c451 Adding a docker pull to the run_tests.sh script 8 years ago
James Cammarata 395ff361d4 Adding acl package to all docker images 8 years ago
Toshio Kuratomi 3511abb9d9 Merge pull request #15055 from ansible/ansible_sudo_pass-should-override-cli
Fix ansible_sudo_pass inventory variable so that it overrides setting of sudo password from the command line
8 years ago
Brian Coca 9c6b49fd3d Merge pull request #15004 from agx/zypper-repository-integration-tests
Integration tests for zypper repository
8 years ago
Toshio Kuratomi ed9e164b80 Fix ansible_sudo_pass inventory variable so that it overrides setting of sudo password from the command line 8 years ago
Rajat Gupta dd27157b9d Add pycrypto as a requirement to run tests 8 years ago
James Cammarata 7460f76f8d Merge pull request #15052 from mattclay/travis-docker-ssh
Add ssh client and server to docker containers.
8 years ago
Matt Clay 4224c11b5f Combine new RUN commands into one RUN command. 8 years ago
Toshio Kuratomi 6824f3a7cc Change url so that we don't test https in the tests for file perms 8 years ago