Commit graph

1546 commits

Author SHA1 Message Date
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.
2016-07-28 12:54:39 -04:00
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
2016-07-25 14:07:15 -07:00
Matt Clay
9497a814a8 Add apache2 to improve test speed and reliability. (#16819) 2016-07-25 07:19:49 -07:00
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!)
2016-07-25 08:11:45 -04:00
Matt Martz
4065acc37d indent callback output if using 3verbosity or higher (#16231) 2016-07-23 18:10:53 -04:00
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
2016-07-22 20:40:14 -04:00
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.
2016-07-22 14:39:01 -04:00
s-hertel
671f9c3d15 Merge pull request #16783 from s-hertel/test_display_galaxy_info_fix
fixing a logic error in test_galaxy
2016-07-21 15:22:07 -04:00
s-hertel
3cb5747f54 fixing a logic error in test_galaxy 2016-07-21 15:02:19 -04:00
s-hertel
aae5e50299 Adding a test for GalaxyCLI. Tests exit_without_ignore method. 2016-07-21 13:53:44 -04:00
Christoph Dittmann
d55452d3ed Adding unit tests for role variable precedence
Originally from PR #16735
2016-07-20 10:14:44 -04:00
Matt Clay
4cc4dc6793 Add postgresql dependencies to opensuseleap. 2016-07-18 16:55:10 -04:00
nitzmahone
7aa39981c4 fix setup test for renamed windows fact 2016-07-14 18:02:04 -07:00
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.
2016-07-14 16:37:35 -04:00
James Cammarata
153133132d Updating tests for new module feature for remote_src in unarchive
Fixes #10218
2016-07-14 12:15:17 -05:00
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.
2016-07-14 09:22:54 -07:00
James Cammarata
221520cbad Fixing type in 293723f (mock_handler -> mock_handler_task) 2016-07-12 17:00:29 -05:00
James Cammarata
0ea2b2a6af Fix unit test for base strategy in regards to handler changes 2016-07-12 16:50:10 -05:00
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
2016-07-12 16:01:47 -04:00
nitzmahone
de549ad675 update action unit test for powershell shebang behavior 2016-07-11 12:38:18 -07:00
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
2016-07-11 13:54:29 -04:00
Matt Clay
0ada7eae5e Add test tags for shell and command modules. 2016-07-08 17:41:58 -07:00
=
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.
2016-07-08 06:46:27 +01:00
Matt Clay
bbffa0a0e9 Add tags for modules without dedicated test roles. 2016-07-07 12:42:07 -07:00
James Cammarata
cd4412016a Updating integration tests for async testing 2016-07-07 13:48:11 -05:00
Matt Davis
30c63a41e9 Merge pull request #16555 from matsu-chara/fix-error-msg-default-to-defaults
fix default/main.yml to defaults/main.yml
2016-07-07 11:14:54 -07:00
Matt Clay
9a6b8ab271 Add more tags to test_async role. 2016-07-07 10:38:41 -07:00
Matt Clay
fdf22b5a40 Support module tests on a single image. (#16620) 2016-07-06 23:37:56 -07:00
Matt Clay
696feacbb6 Add script to generate module tests. (#16617) 2016-07-06 20:07:33 -07:00
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
2016-07-05 15:07:42 -04:00
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
2016-07-04 15:57:57 +02:00
Robin Roth
8021adfe97 use git-core ppa instead of menulibre
menulibre is no longer actively maintained and does not support 16.04
2016-07-03 15:18:08 +02:00
Robin Roth
a5e394d23a reenable apt_repository tests in ubuntu 16.04
fixes #15718
2016-07-03 14:43:04 +02:00
matsu-chara
9f8b0cabcd fix default/main.yml to defaults/main.yml 2016-07-02 21:16:33 +09:00
Matt Clay
4e369a31db Fix test_async. (#16552)
* Conditionally run test_async in docker containers.
* Revise test_async test.
2016-07-01 17:59:06 -07:00
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
2016-07-01 14:52:45 -07:00
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.
2016-07-01 07:03:42 +05:30
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'.
2016-06-29 15:09:40 -07:00
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.
2016-06-28 11:40:14 -07:00
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
2016-06-28 13:24:57 -04:00
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.
2016-06-27 18:58:13 -07:00
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.
2016-06-27 16:34:19 -07:00
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
2016-06-27 10:44:25 -07:00
Matt Clay
1b29c87936 Test ansible version and ping during sanity tests. (#16441) 2016-06-24 19:32:54 -07:00
YueMing Qin
310692abe0 Changes to be committed: (#16430)
renamed:    lookup_pipe.py -> lookup_pipe.yml
2016-06-24 10:26:51 -04:00
nitzmahone
1f92ade584 add integration test to assert included tasks run in proper order 2016-06-23 17:53:08 -07:00
Matt Clay
8a55a446bf Fix fedora23 Dockerfile after fedora:23 updates. 2016-06-22 19:21:40 -07:00
Pilou
7ffbbd34f4 Add python-passlib to docker images. (#16376)
Related to #16361
2016-06-22 13:30:10 -07:00
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.
2016-06-21 17:46:30 -07:00
jctanner
b7f9037b5b Add test for multi-options in authorized_key (#16375)
Addresses https://github.com/ansible/ansible-modules-core/issues/1715
2016-06-20 21:12:45 -04:00