Commit Graph

1751 Commits (8c270ac75f3a82abac4583a5d4f004f32665bacf)

Author SHA1 Message Date
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