Commit Graph

504 Commits (263fd64759d32338d30e5a5f991b97ffc2e6d9bd)

Author SHA1 Message Date
Toshio Kuratomi e10902d744
Add the ansible_2_10 intersphinx reference. (#71028)
There are links from the scenario guides to collections but collections
docs aren't built in testing or locally when we're on the devel branch.
Due to that we need to make sure those references resolve to the
production docsite.  We can use intersphinx to make sure that happens.

* The test for binary files wasn't reading enough of the file.

Checking for null bytes in the first 1024 bytes failed to diagnose the
ansible_2_10.inv file as binary
4 years ago
Matt Clay 2e0097ada3 Fix ansible-test relative import analysis. 4 years ago
Matt Clay 3a8ac62596 Cap pytest version to avoid relative import issue. 4 years ago
Felix Fontein 7e2cc7db12
validate-modules: fix version_added validation for top-level, fix error codes (#70869)
* Also validate top-level version_added.

* Fix error code.

* Produce same version_added validation error in schema than in code (and stop returning it twice).

* Return correct error codes for invalid version_added for options and return values.

* Add changelog.

* Fix forgotten closing braket.

* Accept 'historical' for some top-level version_added.
4 years ago
Matt Clay 8b96caf712
Update ansible-base test container to 1.5.0. (#70856) 4 years ago
Abhijeet Kasurde c1402ddee0
validate_modules: added missing single quote (#70744)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
4 years ago
Matt Clay 1e02a201a6 Fix ansible-test virtualenv management. 4 years ago
Matt Clay 09f02980a4 Update ansible-test change detection for plugins. 4 years ago
Alan Rominger b0d9deeae3
Fix ansible-test error in community.aws (#70507)
* Fix ansible-test error in community.aws

* Add changelog entry for fix

* Change check from None to string_types

* Update changelogs/fragments/70507-validate-null-author.yaml

clarify wording "or a list of strings"

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/schema.py

clarify wording - single string or not specified valid

Co-authored-by: Felix Fontein <felix@fontein.de>

* Do not fail but return None when given outside list

Co-authored-by: Felix Fontein <felix@fontein.de>
4 years ago
Matt Martz ce570691e7
Test against galaxy_ng (#70303)
* Test against galaxy_ng

* Switch container image

* Remove redundant |default

* Re-enable

* Update image

* Update wording

* Don't use pulp as the container name
4 years ago
Jordan Borean 40ce448657
ansible-test - do not validate blacklisted ps modules (#70376)
* ansible-test - do not validate blacklisted ps modules

* Update changelogs/fragments/validate-modules-ps-doc-blacklist.yaml

Co-authored-by: Matt Clay <matt@mystile.com>

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 74494a1908 Code cleanup for ansible-test coverage support. 4 years ago
Matt Clay 8d92df4537 Test netconf plugins in ansible-doc sanity test. 4 years ago
Matt Clay 262f93e22c Code cleanup in the import sanity test. 4 years ago
Matt Clay 70c59423fc Pin ansible-test requirements for RHEL.
The `packaging` and `pyparsing` packages are now installed by `ansible-test` during provisioning of RHEL instances to match the downstream vendored versions.
4 years ago
Matt Clay fa48678a08
Rename pylint plugin and add tests. (#70225)
* Renamed custom pylint plugin for unwanted names.
* Add integration tests for sanity test failures.
4 years ago
Matt Clay 1a0d8a51cd Fix yamllint sanity test line numbers.
Parse errors from libyaml now compensate for the offset of the documentation within a module.
4 years ago
Matt Clay feb163e0de
Improve consistency of ansible-test pylint results. (#70132)
* Disable too-many-ancestors pylint check.

This check was only enabled for ansible-test code.

In some cases this check counts 1 more ancestor in python 3.7+ than under python 3.6, making the check inconsistent and unsuitable for use in ansible-test.

* Disable additional pylint checks:

- import-error
- no-name-in-module

These checks were only enabled for ansible-test code.

These checks provide inconsistent results since they are dependent on available imports, which vary between environments.

It may be practical to enable these checks in the future if changes are made to ensure a consistent test environment for pylint.
4 years ago
Matt Clay e3f3b4002e
Clean up ansible-test pylint configs. (#70129)
* Sort disabled pylint codes in config.
* Fix comments in pylint config.
* Add comments to pylint config.
* Prepare to sort pylint config.
* Fix pylint config indentation.
* Sort pylint good/bad names in config.
* Add changelog fragment.
4 years ago
Matt Martz fa1fb2d13b
Test ansible-galaxy against pulp/pulp_ansible (#69605)
* Test galaxy cli against pulp

* linting fix

* Renames and small fixes

* Better handling for resetting pulp

* Clean up some things, add a comment

* I can't spell

* Bump fallaxy, use alternate pulp image

* Only reset pulp when we're are executing against pulp

* Update for updated pulp container

* Update some comments with correct URLs and typos

* Linting fix

* Pin pulp-fedora31 to a digest

* Address review comments for documentation
4 years ago
Matt Clay 8152d8bc1a Disabled inconsistent pylint checks. 4 years ago
Monty Taylor 0133757d44 Add an author exception for OpenStack Ansible SIG
The current author line wants to match a github author id. But
some people, including the OpenStack project, do not use github,
and additionally do not claim individual ownership but instead
group ownership.

Since there are already a couple of hard-coded examples in the
regex, just add one more. Alternately we could come up with some
mechanism to indicate that the author is purposely not listing
a github id, but that seems a bit heavywight.
4 years ago
Matt Clay 598786e16d Update ansible-test default test containers.
The main change is the upgrade to Python 3.9.0b3.
4 years ago
Matt Clay f69b1846f9 Add pyparsing constraint to ansible-test.
The upcoming pyparsing 3 release will require Python 3.5 or later, see:

https://github.com/pypa/packaging/issues/313

Unfortunately pip 8.x and earlier versions do not support python version requirements, which is why this constraint is needed.
4 years ago
Matt Clay 7641d32f8e
Fix ansible-test import sanity test issues. (#70084) 4 years ago
Felix Fontein 80410f292b Fix missing allow_date=False. 4 years ago
Felix Fontein 0617514176
Boolean error: fix deprecation date sanity check. (#70047) 4 years ago
Matt Clay 5b3719805e Update ansible-test test containers. 4 years ago
Felix Fontein 2fa65eb5e1
validate-modules: allow YAML dates in module documentation and meta/runtime.yml. (#70025) 4 years ago
John R Barker 37785255f2
validate ansible-base's and collections runtime.yml (#69742)
* Validate ansible-base & collection's runtime.yml

Add new test `runtime-metadata`

* Schema validation of file
* Error if a a legacy meta/routing.yml exist in a collection
* removal_date OR removal_version

* Add tombstone validation.

* Allow both ISO 8601 date strings and datetime.date objects (from YAML dates).

* Address review comments.

* Add metadata to test collection.

* Add requirements file.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 9f49db1f99 Avoid use of deprecated junit-xml method. 4 years ago
Matt Clay 26f318d277 Ignore return code from antsibull_changelog lint. 4 years ago
Matt Clay 8ffaed00f8 Add Azure Pipelines support to ansible-test. 4 years ago
Matt Martz 4a4a11d282
Add mccabe complexity testing (#64623)
* Add mccabe complexity testing

* Make mccabe complexity an optional error

* Add mccabe to new sanity pylint requirements

* Add a changelog fragment.

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 2251b239a3 Fix changelog sanity test config detection. 4 years ago
James Cassell 47d14a33bd
config: singular ANSIBLE_COLLECTIONS_PATH (#70007)
* config: singular ANSIBLE_COLLECTIONS_PATH

Every other *_PATH setting in ansible is singular, and the traditional
$PATH variable is also singular despite containing a list of
directories.  Let's be consistent both internally and with POSIX
tradition.

* update all ANSIBLE_COLLECTIONS_PATHS env references to be singular

* deprecate plural ANSIBLE_COLLECTIONS_PATHS setting
4 years ago
Felix Fontein a114da80ee
Use antsibull-changelog instead of packaged changelog generator (#69313)
Replace the ansible-base changelog linting and generation tool with antsibull-changelog and make it available for linting collections. Previously changelog linting was limited to ansible-base.
4 years ago
Gonéri Le Bouder 4869874337
ansible-test: vcenter initialize group/vmware (#70011)
Ensure the vcenter provider initialize the `module_defaults` of all
the vmware modules, not just `vmware_guest`.
The VMware CI relies on this for the authentication of the different
VMware modules.

The commit adjust `incidental_vmware_prepare_tests/tasks/init_vcsim.yml`.
The test-suite uses a copy of `vmware_guest` that is not in the
`group/vmware` group. As a result, we need to manually pass the
authentification parameter.
4 years ago
Matt Clay 6c2be04b6f Intercept code-smell tests using subprocess.
Some code-smell sanity tests for ansible-base use subprocess to invoke ansible commands.
Intercept these commands to make sure the correct script and python version are used.
4 years ago
Jordan Borean a58fcde3a0
Use common ps sanity requirements file (#69992)
* Use common pssanity requirements file

* Fix up sanity ignore
4 years ago
Matt Clay a5679d4dd1
Additional ansible-test sanity adjustments. (#69974)
* Fix ansible-test check_pyyaml usage.
* Avoid unnecessary pip commands.
* Avoid pointless pip check.
* Only install ansible-test requirements as needed.
4 years ago
Matt Clay dc9c1d202b Fix ansible-test pip filter on Fedora 32.
The original version works on CentOS 8 but not Fedora 32.
4 years ago
Felix Fontein f1ab7cf0c6
Validate-modules: adjust test to fixes in #69977 (#69978) 4 years ago
Jordan Borean 15f07e7a6c
Fix up schema for collection deprecation (#69977)
* Fix up schema for collection deprecation

* Fix up modules using wrong name

* Another fix
4 years ago
Matt Clay a81dd4f06a
Update ansible-test default containers. (#69819)
* Move ansible-test completion code.

* Fix a few type hints.

* Change docker completion based on context.

Collections now use version 2.0 of the default-test-container.
This is an updated version of the earlier 1.x default-test-container with ansible-base and cloud specific requirements removed.

Testing of ansible-base now uses version 1.0 of a new ansible-base-test-container.
This container is similar to the earlier 1.x default-test-container, but with unnecessary duplication of requirements across Python versions removed.

Collections which have tests that depend on requirements no longer present in the default test container should specify them in their test requirements files:

* tests/integration/requirements.txt
* tests/unit/requirements.txt

* Bump test container versions

Co-authored-by: Jordan Borean <jborean93@gmail.com>
4 years ago
Sloane Hertel 51f6d129cb
support hard coded module_defaults.yml groups for collections (#69919)
* Only allow groups which were hardcoded in module_defaults.yml

only load action groups from the collection if module_defaults contains a potential group for the action

* Fix tests using modules that override those whitelisted in lib/ansible/config/module_defaults.yml

Third party modules should not be using group/ - use the action name instead

* add externalized module_defaults tests

add the missing group and collections

ci_complete

Co-authored-by: Matt Davis <mrd@redhat.com>

* changelog

ci_complete

* Fix import in tests

ci_complete

* Update with requested changes

ci_complete

* don't traceback since we don't validate the contents of module_defaults

ci_complete

Co-authored-by: Matt Davis <mrd@redhat.com>
4 years ago
Felix Fontein a862ff2d43
Deprecation revisited (#69926)
* Allow to specify collection_name separately for deprecation.

* Use new functionality in Ansible.

* Use new functionality in tests.

* Update tagging/untagging functions.

* Update pylint deprecated sanity test.

* Update validate-modules. Missing are basic checks for version_added (validate semantic version format for collections).

* Improve version validation. Re-add version_added validation.

* Make sure collection names are added to return docs before schema validation.

* Extra checks to avoid crashes on bad data.

* Make C# module utils code work, and update/extend tests.

* Add changelog fragment.

* Stop extracting collection name from potentially tagged versions/dates.

* Simplify C# code.

* Update Windows modules docs.

* Forgot semicolons.
4 years ago
Matt Clay 7bff3d312f
Split out and install sanity test requirements. (#69971)
* Split out sanity test requirements.

* Run each --venv test separately.

This provides verification that the requirements for each test are properly specified.

* Use a separate requirements file per sanity test.

* Skip setuptools/cryptography setup for sanity.

* Eliminate pyyaml missing warning.

* Eliminate more pip noise.

* Fix conflicting generate_pip_install commands.

* Add changelog fragment.
4 years ago
Sam Doran c41a160951
Update test images to version 1.16.0 (#66771) 4 years ago
Felix Fontein 3e566768c1 Fix broken validate-modules. 4 years ago
Matt Clay 06efc41fb0
Reduce pip output noise in ansible-test. (#69925) 4 years ago
Matt Clay f733517e6e Support dates in metadata in import sanity test.
No changelog entry since this feature and the associated bug have not been included in a release.
4 years ago
Jordan Borean 112251c7f4
Bump fallaxy version (#69917) 4 years ago
Matt Davis d79b23910a
fix sys.modules cleanup and blacklist behavior (#69898)
* fix sys.modules cleanup and blacklist behavior

* fix map-as-generator py2/py3 issue
* clear path_importer_cache between runs

* sanity fix

* don't be stupid with moving target generators
4 years ago
Brian Coca 062e780a68
starting metadata sunset (#69454)
* starting metadata sunset

 - purged metadata from any requirements
 - fix indent in generic handler for yaml content (whey metadata display was off)
 - make more resilient against bad formed docs
 - removed all metadata from docs template
 - remove metadata from schemas
 - removed mdata tests and from unrelated tests

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Rick Elrod <rick@elrod.me>
4 years ago
Felix Fontein 2dbd5dc2ae
ansible-test: do not accept empty string as valid version number (#69816)
* Work around strange behavior of StrictVersion and SemanticVersion constructors that they accept an falsy value.

* Do not accept empty strings as versions.
4 years ago
Felix Fontein 0b82d4499e
ansible-test ansible-doc sanity test: also run with --json parameter (#69288) 4 years ago
Felix Fontein 4794b98f2a
Fix version_added test (#69756)
* Fix version_added test for changes in #69680.

* Fix error message.
4 years ago
Felix Fontein 40f21dfd3c
Version source tagging (automatic and manual) for version_added and deprecation versions (#69680)
* Track collection for version_added.
Validate *all* version numbers in validate-modules.
For tagged version numbers (i.e. version_added), consider source collection to chose validation.

* Make tagging/untagging functions more flexible.

* Tag all versions in doc fragments.

* Tag all deprecation versions issued by code.

* Make Display.deprecated() understand tagged versions.

* Extend validation to enforce tagged version numbers.

* Tag versions in tests.

* Lint and fix test.

* Mention collection name in collection loader's deprecation/removal messages.

* Fix error IDs.

* Handle tagged dates in Display.deprecated().

* Also require that removed_at_date and deprecated_aliases.date are tagged.

* Also automatically tag/untag removed_at_date; fix sanity module removal version check.

* Improve error message when invalid version number is used (like '2.14' in collections).
4 years ago
Jordan Borean f5f3ba7ab5
ansible-test - fix up relative util import for powershell validate-modules (#69753)
* ansible-test - fix up relative util import for powershell validate-modules

* Use different tactic for generic group

* Use python 2 and 3
4 years ago
Felix Fontein 31bf3a5622
Deprecate module in collection: allow removal date in documentation, make validate-modules ensure version and date match (#69727)
* Allow to deprecate module by date in documentation.

* Make sure deprecation date/version match between module docs and meta/runtime.yml.

* Unrelated fix: don't compare deprecated module version to Ansible's version in collection.

* Allow documentation's removal version to be something else than fixed list of Ansible versions for collections.

* Linting.

* Allow to deprecate plugin options by date.

* Add changelog fragment for deprecation by date (also covers #68177).
4 years ago
Matt Clay 65c57a7f5b Update default-test-container to version 1.14. 4 years ago
Felix Fontein ea04e0048d
Allow to deprecate options and aliases by date (#68177)
* Allow to deprecate options and aliases by date instead of only by version.

* Update display.deprecate().

* Adjust behavior to conform to tested behavior, extend tests, and improve C# style.

* Parse date and fail on invalid date.

This is mainly to make sure that people start using invalid dates, and we eventually have a mess to clean up.

* C# code: improve validation and update/extend tests.

* Make sure that deprecate() is not called with both date and version.

* Forgot to remove no longer necessary formatting.

* Adjust order of warnings in C# code.

* Adjust unrelated test.

* Fix grammar (and make that test pass).

* Don't parse date, and adjust message to be same as in #67684.

* Sanity tests: disable date in past test.

* Validate-modules: validate ISO 8601 date format.

* Validate-modules: switch schema declaration for deprecated_aliases to improve error messages for invalid dates.

* Use DateTime instead of string for date deprecation.

* Validate that date in deprecated_aliases is actually a DateTime.

* Fix tests.

* Fix rebasing error.

* Adjust error codes for pylint, and add removed_at_date and deprecated_aliases.date checks to validate-modules.

* Make deprecation date in the past error codes optional.

* Make sure not both version and date are specified for AnsibleModule.deprecate() calls.

* Stop using Python 3.7+ API.

* Make sure errors are actually reported. Re-add 'ansible-' prefix.

* Avoid crashing when 'name' isn't there.

* Linting.

* Update lib/ansible/module_utils/csharp/Ansible.Basic.cs

Co-authored-by: Jordan Borean <jborean93@gmail.com>

* Adjust test to latest change.

* Prefer date over version if both end up in Display.deprecated().

Co-authored-by: Jordan Borean <jborean93@gmail.com>
4 years ago
Matt Davis f7dfa817ae
collection routing (#67684)
* `meta/` directory in collections
* runtime metadata for redirection/deprecation/removal of plugin loads
* a compatibility layer to keep existing content working on ansible-base + collections
* a Python import redirection layer to keep collections-hosted (and otherwise moved) content importable by things that don't know better
* supported Ansible version validation on collection loads
4 years ago
Matt Martz b748edea45
Add multipart/form-data functionality (#69376)
* Add multipart/form-data functionality

* Fix some linting issues

* Fix error message

* Allow filename to be provided with content

* Add integration test

* Update examples

* General improvements to multipart handling

* Use prepare_multipart for galaxy collection publish

* Properly account for py2 vs py3, ensuring no max header length

* Address test assumptions

* Add unit tests

* Add changelog

* Ensure to use CRLF instead of NL

* Ignore line-endings in fixture

* Consolidate code, add comment

* Bump fallaxy container version

* ci_complete
4 years ago
Felix Fontein 43acd61901
ansible-test local change detection: use --base-branch if specified (#69508) 4 years ago
Matt Clay c495c92a6e Code cleanup in ansible-test. 4 years ago
Matt Clay 159d79995c Freeze pycodestyle in ansible-test. 4 years ago
Matt Clay e7c2eb519b
Add Shippable request signing to ansible-test. (#69526) 4 years ago
Matt Clay 83381cd912 Update the default-test-container in ansible-test.
The updated container includes fewer requirements now that the collection migration has completed.

Collections which encounter test issues with this new container should update their test requirements files to include the necessary requirements.
4 years ago
Matt Clay d8e0aadc0d Update ansible-test support for CI providers.
Refactored CI provider code to simplify multiple provider support and addition of new providers.
4 years ago
Matt Martz 4c4406b2df
Flatten the directory hierarchy of modules (#68966)
* Flatten the directory hierarchy of modules

* Update ignore.txt, flatten units

* Update imports

* Completely flatten the modules directory

* Update sanity ignore

* Fix some sanity test ignores

* Fix relative import

* Fix docs builds without category

* ci_complete

* Clean up docs. ci_complete

* Adjust needs/file alias

* ci_complete

* fix hardcoded ping module paths

Co-authored-by: Matt Davis <mrd@redhat.com>
4 years ago
Felix Fontein 0e15375ffe
Add deprecated removed_in_version and deprecated_aliases version tests (#66920) 4 years ago
Matt Davis 776f4840fc
fix `ansible-test units` to work(ish) under podman (#69462)
* ignore the missing `Networks` key, issue a warning that network disconnection won't function
4 years ago
Rick Elrod de59b17c7f
Add Fedora 32 to CI (#69222)
Change:
Adds Fedora 32 to shippable and alters tests slightly for new Fedora.

Test Plan:
CI

Tickets:
Fixes #69230

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
John R Barker 084587913a
validate-modules: deprecated modules in collections (#68646)
* validate-modules: deprecated modules in collections

In Collections a module is marked as deprecated via meta/routing.yml

Use this file, rather than the leading `_` as part of the deprecated
test.

* Correct variable

* review comments

* indentation

* Read routing.yml only once

* pep8

* Apply suggestions from code review

Co-authored-by: Matt Clay <matt@mystile.com>

* review: remove duplicated conditional

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Toshio Kuratomi 39b3942048 Remove left hand side slicing
Left hand side slicing is confusing and slower but maybe more memory
efficient in some circumstances.  There is one case where it adds to
code safety: when it's used to substitute a different list in place of a
slice of the original list and the original list could have been bound
to a different variable in some other code.  (The most likely case of
this is when it's a global variable and some other code might import
that variable name).

Because of the confusion factor we think it should only be used for the
safety case or where it's been benchmarked and shown to have some sort
of documentatble improvement.  At the moment, only one piece of code
falls into those categories so this PR removes all the other instances
of left hand side slicing.
4 years ago
Felix Fontein 947fa3bad3
ansible-test validate-modules: don't allow arbitrary lists and dicts for 'default', 'sample' and 'example' (#69287)
* Don't allow arbitrary lists and dicts for 'default', 'sample' and 'example'.

* Add changelog.

* Make compile with Python 2.
4 years ago
Matt Clay 1cf26896c5 Default ansible-test provisioning to us-east-1.
Previously windows instances on Shippable would be automatically directed to us-east-2.
4 years ago
Rick Elrod 1c5c89baa6 Add RHEL 8.2 to CI
Change:
RHEL 8.2 GA was released this week, test it in CI instead of 8.1.

Test Plan:
CI

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Matt Clay a050d892d8 Remove obsolete vcenter setup from ansible-test. 4 years ago
Matt Clay d7da1d9bd0 Fix ansible-test coverage constraints. 4 years ago
Matt Clay 5a3ca0ae5f Fix ansible-test delegation from pip install. 4 years ago
Matt Clay 122743ae30
Update ansible-test handling of delegation paths. (#69056) 4 years ago
Yanis Guenane 46d82179d8
Testing: Add support for CentOS Linux On Power platform (#68130)
* Testing: Add CentOS Linux On Power platform

* Add arch designation to remotes.

This avoids overloading the provider with the arch.

Also add a changelog entry.

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 7d51706278 Revert "Switch network incidental tests to VyOS 1.1.7-R2."
This reverts commit 7d5177d6a0.
4 years ago
Matt Clay 7d5177d6a0 Switch network incidental tests to VyOS 1.1.7-R2.
The previous version being used, VyOS 1.1.8, is currently unavailable in AWS.
4 years ago
Matt Clay a095172130 Fix ansible-test --docker without tests dir. 4 years ago
Felix Fontein bae5f18f5c
ansible-test: don't trigger full CI run for changes to changelogs/ and docs/ in collections (#68550)
* Don't trigger full CI run for changes to changelogs/ and docs/ in collections.

* Add changelog fragment.

* Update changelogs/fragments/68550-ansible-test-docs-changelogs.yml

Co-Authored-By: Matt Clay <matt@mystile.com>

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Rick Elrod 38b7ceb75a
Update docker.txt to use the OpenSUSE 15.1 container image (devel edition) (#68785)
* Update docker.txt to use the OpenSUSE 15.1 container image

Signed-off-by: Rick Elrod <rick@elrod.me>

* handle installing mysql on suse

Signed-off-by: Rick Elrod <rick@elrod.me>

* add changelog fragment

Signed-off-by: Rick Elrod <rick@elrod.me>

* Update changelogs/fragments/ansible-test-opensuse-15.1.yml

Co-Authored-By: Matt Clay <matt@mystile.com>

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 04edd77c42
Update tests to use RHEL 7.8. (#68787)
* Update tests to use RHEL 7.8.

Keeping support for RHEL 7.6 since collections are still using it.

* Fix tests for RHEL 7.7+ due to extras repo name change.
4 years ago
Matt Clay 148e83f832
Fix ansible-test submodule handling. (#68759)
* Refactor ansible-test integration test.
* Add env --list-files option.
* Add tests for collection files tracked by git.
* Fix ansible-test submodule usage on older git.
* Fix submodule directory detection as files.
* Improve handling of nested source control.
4 years ago
Rick Elrod 13aef3c2e5
Add --docker-terminate flag to ansible-test (#68688)
* Add --docker-terminate flag to ansible-test

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Jordan Borean 6db66bcadd
Add relative module_util support for powershell (#68321)
* Add relative module_util support for powershell

* Added ansible-test classification support
4 years ago
Matt Clay 7323d5dd0d Fix references to old egg-info directory. 4 years ago
Matt Clay 735885d57c Fix ansible-test requirements installation. 4 years ago
Matt Clay c888035e02
Update Ubuntu 18.04 test container to 1.13. (#68534) 4 years ago
Matt Clay 53a3d1ffdb Fix ansible-test change detection traceback. 4 years ago
Matt Clay d8b5c11a63 Report error for coverage 5+ in ansible-test. 4 years ago
Matt Clay 27fc049993
Fix ansible-test code coverage collection. (#68502)
The last task in a play should now properly report code coverage.

This change should also eliminate empty coverage files, as well as incomplete coverage files resulting from early worker termination.
4 years ago
Jordan Borean e12cea2c7c
ansible-test - fix up powershell module_util analysis for collections (#68422) 4 years ago
Yanis Guenane fb2a7ce923 Testing: Move from ibmcloud to ibmps 4 years ago
Matt Clay f1b3e8364e Fix ansible-test PATH handling. 4 years ago
Matt Clay 9765a80bd4
Fix ansible-test coverage analysis option usage. (#68406)
* Fix ansible-test coverage analysis option usage.

The `--input-dir` option for `coverage analyze targets generate` was being ignored.

No changelog entry since this feature has not yet been released.

* Move coverage config to fix type annotations.

Declaring the types before referencing them makes sure they're recognized by tools such as PyCharm.
4 years ago
Jordan Borean 7c9889a72b validate-modules - fix ps module delegate type inspection 4 years ago
Matt Clay 70827c7923 Fix ansible-test import analysis warning.
Fix overlooked in https://github.com/ansible/ansible/pull/68372/
4 years ago
Matt Clay 10fe54de58 Fix ansible-test module_utils import analysis.
Now empty `*.py` files are ignored during module_utils import analysis for change detection.
This eliminates "No imports found" warnings for files which should have no imports.
4 years ago
Matt Clay cf75e3f526 Fix ansible-test import analysis for collections. (#68352)
* Fix ansible-test import analysis for collections.

* Ignore plugins/module_utils/__init__.py
4 years ago
Matt Clay 6fde9b3a23 Fix shebang sanity test module identification. 4 years ago
Jordan Borean aaf575f0b2 Internally redirect win modules to collection name (#68317)
* Internally redirect win modules to collection name

* Added comment for how this should be fixed in a subsystem plugin

* add collection plugins for base tests
4 years ago
Matt Clay 2c7f8bf586 Fix ansible-test windows-integration module refs. 4 years ago
Matt Clay 41f6c73be0 Update ansible-test network test provisioning. (#68220)
* Update network provisioning defaults.

* Update network test requirements.
4 years ago
Matt Clay 5159457ba1 Fix ansible-test unit test requirements.
Requirements were incorrectly added to ansible-test in https://github.com/ansible/ansible/pull/61813

These requirements should have been placed into `test/units/requirements.txt` instead.
Now that the relevant content has been migrated out of the repository, the requirements are no longer necessary there either.

No changelog entry for this change since the original changes were not included in any release and also lacked a changelog entry.
4 years ago
Matt Clay 8715bc400a Add coverage filtering to ansible-test. (#68158)
* Relocate expand_indexes so it can be reused.

* Add generate_indexes function.

* Simplify type annotations.

* Add `coverage analyze targets filter` command.

* Add changelog entry.
4 years ago
Matt Clay 27ce6dbc1f Remove test support option from ansible-test.
This option was added to facilitate migration and is no longer needed.
4 years ago
Matt Clay 50442f9fdd Fix ansible-test handling of no Python coverage. 4 years ago
Matt Clay 99e136e153 Remove out-of-date test constraint on paramiko.
ci_complete
4 years ago
Matt Clay 1a8fdaadc7 Fix powershell coverage path rewriting.
This applies the same rewrite logic to PowerShell coverage as is used for Python coverage.
4 years ago
Matt Clay 29978d027b Update default test container to version 1.12. 4 years ago
Matt Clay ebb255f0d3 Add Python 3.9 to ansible-test.
ci_complete
ci_coverage
4 years ago
Matt Clay 64a2864158 Fix ansible-test constraints for AWS. 4 years ago
Matt Clay c06f442409 Fix ansible-test import sanity test venv setup. 4 years ago
Matt Clay 99e657162f Fix ansible-test module_utils analysis. 4 years ago
Matt Clay 70fc69c852 Fix vcenter requirements. 4 years ago
Matt Clay 7c8b046b5f
Fourth batch of incidental integration tests. (#67873)
* Copy in incidental posix tests.

* Update incidental test aliases.

* Update target names.

* Add support plugins.

* Fix paths.

* Update ignores.

* Update integration-aliases sanity test.

* Add incidental tests to CI.
4 years ago
Jordan Borean 26129fcb80
ansible-galaxy - optimise some paths and use fake galaxy int tests (#67685)
* ansible-galaxy - optimise some paths and use fake galaxy int tests

* Added init, built, and publish tests

* Test against both mocked Galaxy and AH server

* Finish off writing the install tests

* Fix up broken tests

* Rename test target and add migrated tests

* Use cloud provider for Galaxy implementation

* Added blank static config

* Use correct alias group

* Set release version and fix copy typo

* Remove reset step as it is no longer needed

* Use sane env var names for test container name
4 years ago
Sam Doran 7a42354021
Switch to using FreeBSD 12.1 (#67659) 4 years ago
Abhijeet Kasurde b6c2056ea2
mongodb_user: fix doc formatting (#67763)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
4 years ago
Matt Clay f735fd672a
Third batch of incidental integration tests. (#67830)
* Copy in incidental windows tests.

* Update incidental test aliases.

* Add support plugins.

* Update target references.

* Update sanity ignores.

* Update integration-aliases test.

* Add to CI.
4 years ago
Matt Clay b68e55da26
Remove `test/legacy/` directory. (#67786)
* Remove `test/legacy/` directory.

* Remove references to `test/legacy/` directory.

* Update the remaining valid legacy reference.

* Remove outdated legacy references.
4 years ago
Matt Clay e3591223a0
Second batch of incidental integration tests. (#67765)
* Update incidental test aliases.

* Rewrite target references for renamed targets.

* Add incidental tests to CI.

* Update sanity tests for incidental cloud tests.

* Initial copy of incidental tests.

* Copy contrib files into test.

* Update paths in test.

* Add support plugins.

* Update plugin to work around missing deps.

* Update sanity ignores.

* Fix matrix entries.

* Remove debug echo.
4 years ago
Jill R 96244c4cde
Make AWS test plugin to refer to the aws-permissions-for-integration-tests (#67665)
Make AWS test plugin to refer to the aws-permissions-for-integration-tests section of the AWS devel docs now that we have them, rather than suggesting to flag down specific users.
4 years ago
Matt Clay a64b562071
Fix up network testing on Shippable. (#67678)
This prepares for code coverage collection for initial setup of incidental test coverage.
4 years ago
Matt Clay 482885e0c8 Fix network setup for collections in ansible-test. 4 years ago
Matt Clay 542d1b98ff
Support private test plugins in ansible-test. (#67660)
* Support private test plugins in ansible-test.

This feature is exclusively used for testing Ansible itself and is not available to collections.

Content in the newly supported directories will be added in follow-up PRs.

* Add new directory to path classification.

* Support new paths in shebang test.

* Add new directory to manifest.
4 years ago
Yanis Guenane 34800fe027 Test: Bump Tower version to latest release 4 years ago
Jordan Borean 36def8bf03
Use Ansible to load ps module utils in arg spec checker (#67596)
* Use Ansible to load ps module utils in arg spec checker

* Added changelog and note
4 years ago
Matt Martz c61c0f7ad5
Add warning when running devel (#67502)
* Add warning when running devel. Addresses #67362

* Add config entry to disable devel warning, so it doesn't impact CI

* Update warning about using devel
4 years ago
Matt Clay 19f6fc68d4
Relocate Shippable tools. (#67556)
* Move Shippable tools to hacking directory.

These limits the `test/utils/shippable/` directory to scripts required for CI.

* Fix `test/utils/shippable/` file classification.

* Update package-data sanity test.
4 years ago
Felix Fontein 4373863f25
Module validation: sanity check mutually_exclusive, required_if, required_xxx ... (#66961)
* required_if checks should have three or four parts.

* Validate mutually_exclusive, required_together, required_one_of, required_if and required_by.

* Simplify code.

* Improve messages.

* Add changelog.

* Sanity check.

* Update docs.

* Update ignore.txt.

* Don't continue with tests when terms are not strings.

* Remove ignore.txt entry.

* Make sure validate-modules doesn't choke on things already flagged by schema test.

* Check required_if requirements list for strings.
4 years ago
Abhijeet Kasurde b6753b46a9
Replace 'message' in module parameters (#60051)
* 'message' parameter is replaced by 'commit_message' in grafana_dashboard
* 'message' parameter is replaced by 'notification_message' in datadog_monitor

This change is required since 'message' as parameter name is used internally by
Ansible core engine.

Fixes: #39295 #45362 #47132 #59617

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
4 years ago
Yanis Guenane b9bd2c25ca
Test: Bump TOWER_VERSION to supported version (#67378)
* Revert "Remove Tower module tests from CI. (#67368)"

This reverts commit b041d96762.

* Test: Bump TOWER_VERSION to 3.6.2
4 years ago
Felix Fontein f6815040fd
add_file_common_arguments: fix defaults and tpyes, improve sanity checking (#67243)
* Make validate-modules stop ignore FILE_COMMON_ARGUMENTS.

* Add types to FILE_COMMON_ARGUMENTS and update document fragment to match it.

* Update ignore.txt.

* Add changelog.
4 years ago
Sam Doran 8f296a6533
ansible-test - add constraint for virtualenv (#67289)
* ansible-test - add constraint for virtualenv

* Limit virtualenv only on macOS.

Co-authored-by: Matt Clay <matt@mystile.com>
4 years ago
Matt Clay 1110e9d80d Test AIX with smaller volumes. 4 years ago
Matt Clay 5e68bb3d93
Add code coverage target analysis to ansible-test. (#67141)
* Refactor coverage file enumeration.
* Relocate sanitize_filename function.
* Support sets when writing JSON files.
* Generalize setting of info_stderr mode.
* Split out coverage path checking.
* Split out collection regex logic.
* Improve sanitize_filename type hints and docs.
* Clean up coverage erase command.
* Fix docs and type hints for initialize_coverage.
* Update type hints on CoverageConfig.
* Split out logic for finding modules.
* Split out arc enumeration.
* Split out powershell coverage enumeration.
* Raise verbosity level of empty coverage warnings.
* Add code coverage target analysis to ansible-test.
4 years ago
Matt Clay f4a80bb600
Code cleanup and refactoring in ansible-test. (#67063)
* Code cleanup in ansible-test.
* Split out encoding functions.
* Consoldate loading of JSON files.
* Split out disk IO functions.
* Simplify file access.
* Add functions for opening files.
* Replace open calls with appropriate functions.
* Expose more types from typing module.
* Support writing compact JSON.
* Add verbosity argument to display.warning.
* Add changelog entry.
* Update files overlooked during rebase.
* Use `io.open` instead of `open`.
* Fix file opening for imp.load_module.
* Remove use of `r+` mode to access files.
* Add missing import.
* Fix httptester on Python 2.x.
* Clarify changelog fragment.
* Consolidate imports. Remove extra newlines.
* Fix indirect imports.
4 years ago
Matt Clay d584584474 Reorganize ansible-test coverage code.
This change moves all code for the `ansible-test coverage` command into the `coverage` directory.

Each subcommand is split into a separate file.

Only minor spelling changes were made aside from code relocation.
4 years ago
Mark Chappell 5d4d9d40af
ansible-test - Add 'get' to the list of bad choices for state (#66921)
* ansible-test - Add 'get' to the list of bad choices for state

* Changelog fragment
4 years ago
Jordan Borean 811c54a7a4
validate-modules - support deprecated_aliases (#66965)
* validate-modules - support deprecated_aliases

* Removed changelog fragment
4 years ago
Matt Clay 49d8d5ae33 Fix ansible-test tar format handling. 4 years ago
Yanis Guenane 4fd2dce7f3
Testing: Add support for AIX platform (#65802) 4 years ago
Sviatoslav Sydorenko eec6afd116 Explicitly set junit_family=xunit1 @ pytest config
This change hides the deprecation warning and protects from
failures in pytest==6.0.0

Ref:
* https://github.com/ansible/ansible/pull/66445#discussion_r372530176

Co-Authored-By: Matt Clay <matt@mystile.com>
4 years ago
Mark Chappell 1156962cde
Forbid `state=(list|info)` in modules via ansible-test sanity check
PR #66898

This change introduces a new sanity check with code
`parameter-state-invalid-choice` in the `ansible-test sanity`
validator. It enforces modules not to support `list` or `info`
as their `state`.

Co-Authored-By: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-Authored-By: Felix Fontein <felix@fontein.de>
4 years ago
Matt Clay 3c3cf50e7a Fix ansible-test coverage of ansible-connection. 4 years ago
Matt Clay 21069c84d9 Fix ansible-test color `ls` logic. 4 years ago
Matt Clay 428aaf7e65 Keep SSH authorized keys in ansible-test setup. 4 years ago
Matt Clay efd2dd8929 Add more ansible-test args to delegation config. 4 years ago
Matt Clay ee50792416 Add a `--no-pip-check` option to ansible-test. 4 years ago
Mark Chappell 35652ca788 Add tests to make sure that the documented 'elements' matches that defined in argument_spec (#66385)
* Add tests to make sure that the documented 'elements' matches that defined in argument_spec

* Mass-add test/sanity/ignore.txt
4 years ago
Mark Chappell 5ff899662d Add sanity test to require elements entry when argument type=list (#66386)
* Require elements entry for lists

* Bulk add initial test/sanity/ignore.txt
4 years ago
Matt Clay 965854fbd2
Add constraints for Jinja2 on Python 2.6. (#66826)
* Add constraint for Jinja2 on Python 2.6.

* Fix constraint in inventory_aws_conformance test.

* Add constrraints for template_jinja2_latest test.
4 years ago
Felix Fontein 8cff585891
Schema validation for argument_spec (#65747)
* Start of schema for argument_spec

* Add changelog.

* Remove superfluous import.

* Update ignore.txt

Co-authored-by: Matt Martz <matt@sivel.net>
4 years ago
Matt Clay 8b63da7b43 Fix ansible-test egg-info directory detection. 4 years ago
Matt Clay ebf21bb48d Fix ansible-test inventory delegation. 5 years ago
Matt Clay 934d6b235b Add `--venv-system-site-packages` to ansible-test. 5 years ago
Felix Fontein c58d8ed1f5 Improve deprecate sanity check; remove deprecated features which should have been removed for 2.9 (#65745)
* Update deprecation check.

* Remove support for check_invalid_arguments.
5 years ago
haiyuan_zhang bc37ea96d5 Vmss scale in policy (#66512)
* azure_rm_virtualmachinescaleset: add scale_in_policy and terminate_event_notification

* azure_rm_virtualmachinescalesetinstance: add vmss instance protection policy support
5 years ago
Gonéri Le Bouder 68a8cc2b1f vcenter: don't bind container on <1024 port
Bind the govcsim service on port 1443, this way we don't need root privilege
to start the container. This allow us to use ansible-test with podman
seamlessly.
The commit also avoid the mapping of port 80. We don't need it.
5 years ago
Matt Clay 3db1ac4f56 Ignore warnings in ansible-test environment check. 5 years ago
Matt Clay 51e5b714e0
Add test constraint for setuptools. (#66426)
* Add test constraint for setuptools.

* Update pip test to work on centos6 container.
5 years ago
Gonéri Le Bouder 16d3f6bcbb vcenter provider: do not set env var
Some secrets are exposed because of the environment variables. The
Ansible variables are now enough, we don't need to expose the envvar
anymore.
5 years ago
Sam Doran 92677d43b6 Account for argument spec of None in validate modules sanity test 5 years ago
Matt Clay 9ea5b539b6 Add ansible-test constraint to avoid coverage 5.0+ 5 years ago
Toshio Kuratomi 2b6d94c4c8 Change the check_pyyaml() function to return the features of pyyaml that we check 5 years ago
Toshio Kuratomi ece306b201 Add a sanity test for yaml to make sure we can parse all yaml
Check that all yaml we ship is parsable by the pyyaml c backend.  Since
Ansible uses Pyyaml for docs and playbooks, if the yaml files aren't
parsable, they will error out if they were used.

Warn and skip yamllint if libyaml backend is not present

Ignore new errors in examples until someone can fix them
5 years ago
Felix Fontein a0f26b40cb Sanity checks: test for print statement (#65219)
* Add test for print() call in module_utils and modules.

* Add changelog fragment.

* Add ignore.txt entries.

* Use blacklist plugin instead of adding a new.

* Update ignore.txt
5 years ago
Matt Clay fb69d68821
Fix plugin paths for ansible-test pylint test. (#65526)
* Fix plugin paths for ansible-test pylint test.
5 years ago
Sam Doran 2a7623dd5c
Add CentOS 8 to the test matrix (#63649) 5 years ago
Felix Fontein 4be8b2134f Sanity checks: make sure that `required` in argument spec coincides with documentation (#65437)
* Add sanity test for required parameters, update ignore.txt, and add changelog.
5 years ago
Sam Doran 0e5a83a1cc
Add Fedora 31 to the test matrix (#64848)
* Add Fedora 31 to the test matrix

* Remove Fedora 29 from the test matrix
5 years ago
Felix Fontein 784e507671 module sanity checks: improve alias handling (#59060)
* add_file_common_args is only of interest on top-level.
* Handle undocumented arguments in one place.
* Update ignore.txt
* Add changelog
5 years ago
Matt Clay ba273c72d8
Fix ansible-test handling of git submodules. (#65027)
* Revert most of PR #61605 commit e218c9814c

This removes the git error handling that converted all git errors into warnings.

* Fix ansible-test handling of git submodules.
5 years ago
Matt Clay 4f51b7d323 Remove ansible-test --tox delegation option.
Use the --venv option instead.

This option was only available when running from source to test the ansible/ansible repository.

This will have no effect on testing collections or running from an installed version of Ansible.

Also update docs to reference the --venv option instead of the --tox option.
5 years ago
Matt Martz b93d92ef9a
Set alter_sys=True instead of False to address backwards incompat (#64670)
* Set alter_sys=True instead of False to address backwards incompat

* ci_complete

* Add integration test

* ci_complete

* sanity

* ci_complete

* Changelog fragment

* Update import test and validate-modules to match
5 years ago
Matt Clay 75646037dc Switch from RHEL 8.0 & 8.1b to 8.1 in CI. 5 years ago
Matt Clay adcf9458f1
Fix ansible-test collections sanity import test. (#64467)
* Fix ansible-test collections sanity import test.

Resolves https://github.com/ansible/ansible/issues/64466

* Fix get_source implementation also.

* Fix is_package function.
5 years ago
Felix Fontein f4ff45dcd4 ansible-test: bumping ACME test container version (#64424)
* Bumping ACME test container version.

* Add changelog.
5 years ago
Matt Clay e9f8a34dce
Fixes for validate-modules import handling. (#63932)
* Fix validate-modules support for collections.

- Relative imports now work correctly.
- The collection loader is now used.
- Modules are invoked as `__main__`.

* Remove obsolete validate-modules code ignores.

* Handle sys.exit in validate-modules.

* Add check for AnsibleModule initialization.

* Remove `missing-module-utils-import` check.

This check does not support relative imports or collections.

Instead of trying to overhaul the test, we can rely on the `ansible-module-not-initialized` test instead.

* Fix badly named error codes with `c#` in the name.

The `#` conflicts with comments in the sanity test ignore files.

* Add changelog entries.
5 years ago
Matt Clay 92ccdeac31 Fix various import sanity test issues.
- Relative imports are now properly recognized.
- Correct script invocation of Ansible modules is used.
- Warnings are now consistently reported as errors.
- Errors are now consistently reported with the file tested.

Resolves https://github.com/ansible/ansible/issues/62723
Resolves https://github.com/ansible/ansible/issues/61884
5 years ago
Felix Fontein 04252cf90d Improve validation of module return values (#63411)
* Add contains: validation for return values.

* Only require returned: on top level.

* Fix various return value problems.

* Update ignore.txt.

* Two more.
5 years ago
Matt Clay 92b387aa27 Fix hcloud requirements.
Avoid installing hcloud on Python 3.9 since it is not supported.
5 years ago
Matt Clay 6be4741f72 Fix ansible-test env var mixing running commands. 5 years ago
Matt Clay 437e9b7063 Fix ansible-test sanity requirements install.
This fixes ansible-test so it no longer tries to install sanity test dependencies on unsupported Python versions.
5 years ago
Matt Clay 7448084858 Update default-test-container to 1.10.1.
This brings in the final Python 3.8.0 release instead of a release candidate.
5 years ago
Matt Clay 32b57d57a0 Add constraint for pathspec.
This fixes installation of pathspec on Python 2.6.
5 years ago
Felix Fontein 054285c34c crypto modules: improve return value list documentation (#62929)
* Improve return value documentation by allowing entry for return values.
* Add docs formatting, adjust styling.
* Fix sample return value. (Taken from https://tools.ietf.org/html/rfc7517#appendix-A.1.)
* Work around abuse of .
5 years ago
Gonéri Le Bouder 73febd4ea6 prepare_vmware_tests: use module_defaults (#63209) 5 years ago
Matt Martz 03b98f6351 Fix plain format output functionality (#63107) 5 years ago
Matt Davis 6d52bdf4db
fix default collection resolution in adhoc (#63298)
* fix default collection resolution in adhoc

* if an adhoc command is run with a playbook-dir under a configured collection, default collection resolution is used to resolve unqualified module/action names

* Set ANSIBLE_PLAYBOOK_DIR in integration tests.

* Fix config conflict in ansible integration test.

* add adhoc default collection test

* text-ify warning string
5 years ago
Matt Clay 811127d64d Add RHEL 8.1b to the Shippable test matrix. 5 years ago
Pedro Magalhães 67d9cc45bd maven_artifact.py - add support for version ranges by using spec (#54309) (#61813) 5 years ago
Matt Clay 022335669c
Work around ssh-keygen issue in ansible-test. (#63211)
Newer versions of ssh-keygen create PEM keys that are not recognized by Paramiko.

Now ansible-test compensates for this by updating they keys it generates so Paramiko will recognize them.
5 years ago
Matt Clay 4c79f1ec4d Fix ansible-test integration temp dir location.
Previously the temporary directory used to run integration tests resided under the user's home directory. This prevented ansible-playbook from detecting the default collection when running tests.

Now the temporary directory is created within the collection to facilitate default collection detection.
5 years ago
Matt Clay 32979430d0 Add missing var for format string in ansible-test. 5 years ago
Matt Clay b91f452f4f Fix ansible-test virtualenv real python search.
ansible-test now properly searches for `pythonX.Y` instead of `python` when looking for the real python that created a `virtualenv`.
5 years ago
Gonéri Le Bouder 2f5886f4ef vmware/test: add vsphere-automation-sdk dep
The following modules depend on `vSphere Automation SDK`:

- `vmware_rest_client`
- `vmware_guest_info`
- `vmware_tag_manager`
- `vmware_vm_inventory`

The associated test cannot be run with `govcsim`. But the situation is
changing since we will soon run them on a regular lab, and so, we
need to install the dependency.

Bumping the default-test-container version to 1.9.3 to get a fresh version
of pip and requests.

Depends-On: https://github.com/ansible/ansible/pull/62412
5 years ago
Matt Clay 3f2380ccce Exclude tmp dir from ansible-test results copy.
This fixes test errors related to failures copying temporary test results files from a remote system back to the local system.

It also speeds up processing of test results and reduces network utilization by avoiding the temporary files.
5 years ago
Matt Clay 831e1bf2e0 Fix ansible-test PYTHONPATH handling.
Running from an installed version of ansible-test now results in tests using a dedicated directory for PYTHONPATH instead of using the site-packages directory where ansible is installed.

This provides consistency with tests running from source, which already used a dedicated directory.

Resolves https://github.com/ansible/ansible/issues/62716
5 years ago
Gonéri Le Bouder 5ecbe9cbbb vcenter provider: Only rely on VMWARE_TEST_PLATFORM
Until now, the vcenter provider was switching between `static` and
`govcsim` depending on the presence of the following configuration file:
`test/integration/cloud-config-vcenter.ini`.

This was not consistent with Worldstream, which we enable with the
`VMWARE_TEST_PLATFORM` environment variable.

We now only rely on `VMWARE_TEST_PLATFORM` to know which platform should be
used. `govcsim` is still the default, this to preserve the original
behaviour.

This commit also rename the following variables to be consistent with the rest
of the code base. It also ensures they are alway defined, even with `govcsim`:

- `VCENTER_HOSTNAME`
- `VCENTER_USERNAME`
- `VCENTER_PASSWORD`
5 years ago
Lukas Kämmerling fd7e156ccd Add hcloud_floating_ip module (#62409) 5 years ago
Gonéri Le Bouder b68f5b406a test: bump default-test-container
VMware VSphere SDK needs an up to date version of `pip` for the
installation step. With the current image, we face the following error:

```
(...)
02:27 Collecting git+https://github.com/vmware/vsphere-automation-sdk-python.git (from -r /root/ansible/test/lib/ansible_test/_data/requirements/integration.cloud.vcenter.txt (line 2))
02:27   Cloning https://github.com/vmware/vsphere-automation-sdk-python.git to /tmp/pip-req-build-pm27t16b
02:33 Requirement already satisfied: pyvmomi in /usr/local/lib/python3.6/dist-packages (from -r /root/ansible/test/lib/ansible_test/_data/requirements/integration.cloud.vcenter.txt (line 1)) (6.7.1.2018.12)
02:33 Requirement already satisfied: lxml>=4.3.0 in /usr/local/lib/python3.6/dist-packages (from vSphere-Automation-SDK==1.4.0->-r /root/ansible/test/lib/ansible_test/_data/requirements/integration.cloud.vcenter.txt (line 2)) (4.4.0)
02:33 Processing ./\\localhost/tmp/pip-req-build-pm27t16b/lib/vapi-runtime/vapi_runtime-2.12.0-py2.py3-none-any.whl
02:33 Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/root/ansible/\\\\localhost/tmp/pip-req-build-pm27t16b/lib/vapi-runtime/vapi_runtime-2.12.0-py2.py3-none-any.whl'
```

Bump default-test-container to 1.9.3 to get an up to date release of
`pip` (was 19.0.2, is now 19.2.3).
5 years ago
Matt Clay 9f7b124a6f Mark ansible-test cloud credentials as sensitive. 5 years ago
Matt Clay 0631e057e9 Redact sensitive values by default in ansible-test 5 years ago
Felix Fontein d8d3790d6a Bump acme-test-container version. (#62381) 5 years ago
Matt Clay b73e7721df Mark AWS credentials in ansible-test as sensitive.
This avoids displaying the credentials in CI when retrying tests at maximum verbosity.
5 years ago
Matt Clay 32d965e2c6 Fix display of sanity test doc links.
The documentation links are now displayed when running from an install.

Previously the links were only displayed when running from source.
This was due to ansible-test checking for the presence of documentation files locally, which are only present when running from source.
The check is no longer necessary since there is a sanity test in place to enforce the presence of documentation for all sanity tests.
5 years ago
flowerysong d933278f3d Add version 2.14 to the removed_in list (#62298)
devel is now 2.10, so this needs to be bumped as well.
5 years ago
Sam Doran 08279c7d54
Update default test container with Python 3.8b4 (#62100) 5 years ago
Evgeni Golov 48a39f5616 typo: missing-subption-docs → missing-suboption-docs (#62180)
updates the name of the test and all ignore.txt entries
5 years ago
Matt Clay cd4882e229 Fix ansible-test vcenter test filtering.
The default behavior of the ansible-test vcenter plugin is to use the govcsim container to run tests.

However, unless the govcsim mode was specified using the VMWARE_TEST_PLATFORM environment variable, the filter code would skip the tests unless the tests ran on Shippable or the user had an ansible-core-ci key.

Now the filter correctly recognizes that govcsim is the default.
5 years ago
Matt Clay cdc4926340
Fix ansible-test collections requirements installation. (#62181)
* Fix location of unit test requirements.

* Preserve ansible-test unit test requirements.

* Remove redundant unit test requirements.

* Fix location of network test requirements.

* Preserve ansible-test network test requirements.

* Remove redundant network test requirements.

* Add missing ordereddict requirements.

* Load collection requirements correctly.

* Add changelog fragment.
5 years ago
Matt Clay aaa6d2ecb0
Fix ansible-test pytest plugin loading. (#62119)
* Avoid assertion rewriting in pytest plugins.

Adding PYTEST_DONT_REWRITE to the ansible-test pytest plugin docstrings disables assertion rewriting in pytest for those plugins.

This avoids warnings during test execution if the plugins are loaded multiple times (such as being imported within tests).

* Run ansible-test pytest plugins early.

The ansible-test pytest plugins need to load and run earlier than conftest modules.

To facilitate this, the pytest_configure function is run during loading, which works since they are loaded (but not always run) before conftest modules are loaded.

A check has also been added to the pytest_configure functions to prevent them from running multiple times in the same process.

* Load pytest plugins using an env var.

The -p command line option loads plugins before conftest, but only during collection.
The PYTEST_PLUGINS environment variable loads plugins before confest, both during collection and test execution.
5 years ago
Jordan Borean 6fb1d56fdc
Fix ansible-test coverage --all (#62115) 5 years ago
Matt Clay a7bc11ce67
Work around virtualenv/venv issue in ansible-test. (#62111)
Creating a virtual environment using `venv` when running in a virtual environment created by `virtualenv` results in a copy of the original virtual environment instead of creation of a new one.

To work around this, `ansible-test` now identifies when it is running in a `virtualenv` created virtual environment and uses the real Python interpreter to create the `venv` virtual environment.
5 years ago
Matt Clay 983f0ad5a0 Properly exclude tests/output/ from code coverage. 5 years ago
Matt Clay f110abb806
Fix ansible-test to ignore `tests/output/`. (#62084)
The `test/results/` directory for Ansible test output was already ignored when not using git.

When Ansible Collections were switched to `tests/output/` the ignore entry was previously overlooked.
5 years ago
Gonéri Le Bouder 0f52b18f3f
bump hcloud version to 1.4.1 (#62097)
* bump hcloud version to 1.4.1

`hcloud`<=1.4.0 has requirement `requests==2.20.0`. This prevents the
installation of the Vcenter Automation SDK which depends on `requests>=2.22.0`.

`hcloud` 1.4.1 does not have the problem: 8bff356efb
Bumping the dependency will resolve the issue.
5 years ago
Matt Clay 064e8e1ef4
Fix ansible-doc traceback and sanity test. (#62040)
* Fix ansible-doc traceback for removed modules.

This avoids tracebacks with errors like the following when a module has been removed:

module module_name missing documentation (or could not parse documentation): 'NoneType' object does not support item assignment

* Fix ansible-doc sanity test warning handling.

Warnings about removed modules/plugins on stderr are now properly ignored.

Previously an ansible-doc error could result in unrelated errors going undetected because tests were stopped early and the underlying error was ignored.
5 years ago
Matt Clay c77ab11051
Fix issues with ansible-test --venv option. (#62033)
* Fix ansible-test venv activation.

When using the ansible-test --venv option, an execv wrapper for each python interpreter is now used instead of a symbolic link.

* Fix ansible-test execv wrapper generation.

Use the currently running Python interpreter for the shebang in the execv wrapper instead of the selected interpreter.

This allows the wrapper to work when the selected interpreter is a script instead of a binary.

* Fix ansible-test sanity requirements install.

When running sanity tests on multiple Python versions, install requirements for all versions used instead of only the default version.

* Fix ansible-test --venv when installed.

When running ansible-test from an install, the --venv delegation option needs to make sure the ansible-test code is available in the created virtual environment.

Exposing system site packages does not work because the virtual environment may be for a different Python version than the one on which ansible-test is installed.
5 years ago
Gonéri Le Bouder 8e22a60f97 ansible-test: vcenter+Worldstream: hide password
Hide the temporary password when `ansible-test` is called with the
`--redact` parameter.
5 years ago
Sam Doran 3d78dad84b Update Fedora 29 test image 5 years ago
Sam Doran e218c9814c ansible-test - Continue if the git command returns an error (#61605)
* ansible-test - Contiune if the git command returns an error

* Just return stdout

* Use to_text() when displaying exception

* Add a message property to SubprocessError
5 years ago
Matt Clay e4e5005640
Fix ansible-test coverage path handling. (#61528)
* Fix ansible-test coverage path handling.
* Split CI unit tests into two groups.
5 years ago
Matt Clay 4063d58339 Use relative submodule status in ansible-test.
The `git submodule status` command is relative to the current git repository by default.
When running from a repository subdirectory paths can be returned above the current directory.
Specifying the current directory with `git submodule status` avoids listing submodules above that directory.

This will fix issues when testing a collection that is rooted below the repository root when that repository uses submodules.
5 years ago
Matt Clay 2215a62057 Fix ansible-test handling of submodules.
Resolves https://github.com/ansible/ansible/issues/61550
5 years ago
Toshio Kuratomi 68fa03138c Revert "New Module: NetApp Account (#59939)"
This reverts commit 6a8dcb8fcb.

Reverting this as it breaks CI for azure (more permissions would be
needed for our account)
5 years ago
Chris Archibald 6a8dcb8fcb New Module: NetApp Account (#59939)
* netapp account module for azure

* netapp account module for azure

* fixes

* fixes

* add requirements

* add requirements

* fix issues

* add units

* add units

* updates

* updates

* fixes

* fixes

* fies

* fixes
5 years ago
Matt Clay f90587069c
Update collections integration targets path. (#61523)
* Update collections integration targets path.

* Fix integration path handling.

* Add collections test target fallback.

Also add warnings and errors for common path mistakes.

* Improve role target detection.
5 years ago
Matt Clay 032bd3a030 Move the ansible-test output_dir.
This directory is currently a fixed location to make troubleshooting easier.
It is cleared before each test target runs, but is preserved when a test target finishes.
This allows the contents to be inspected when a test fails.

The previous location was `~/ansible_testing/`.
The new location is within the content root:

- `test/results/.tmp/output_dir` for Ansible
- `tests/output/.tmp/output_dir` for Ansible Collections

Moving the directory reduces the number of places on the filesystem where tests create output.
It also enables the results to be returned from delegated systems.
5 years ago
Matt Clay d92e2a6b0e
Simplify ansible-test target processing. (#61506)
* Clean up layout paths for integration tests.

* Remove "special" integration test target type.

* Remove unnecessary role detection logic.

* Remove support for non-sh runme scripts.

* Simplify reading of aliases.
5 years ago
Matt Clay ed46f83905 Fix paths in sanity tests. 5 years ago
Matt Clay 81ca44b7e5 Change location of collections tests.
The directories used for collections tests are changing as follows:

`test/` -> `tests/`
`test/results/` -> `tests/output/`

This is a breaking change for collections tests executed by ansible-test.
All collections will need to be updated to use the new directory.

The `tests/output/` directory should be added to the `.gitignore` or equivalent in each collection.

This change is being made before the first pre-release of Ansible 2.9 since ansible-test has not yet been shipped.
Using the `tests/` directory matches the other collections directories `plugins/` and `roles/`.

This resolves https://github.com/ansible/ansible/issues/60218
5 years ago
Matt Clay 460b583dff Improve ansible-test --venv error handling.
This allows it to fall back to virtualenv when venv is broken.
5 years ago
Sam Doran 8dd79fbbd2 Show doc URL for sanity test failures 5 years ago
Matt Clay 4afe757f93
More ansible-test path handling updates. (#61484)
* Move test results vars into layout.

* Add test_path to layout.

* Add sanity_path to layout.

* Clean up layout.

* Update change classification.

* Improve classification layout.

* Relocate common classification code.

* Use is_subdir for relocated code.

* Relocate ansible test/units/compat/ hack.

* Fix variable shadowing.

* Remove unused code.

* Fix ordering of path tests.

* Clean up ansible classification.

* Fix hard-coded plugin paths in classification.

* Relocate more common classification.

* Fix logic.

* Fix pylint issue.

* Add missing licenses classification.
5 years ago
Matt Clay 8521474f06 Revert "maven_artifact.py - add support for version ranges by using spec (#54309)"
This reverts commit 145a6a8756.
5 years ago
Sam Doran 73248bf27d validate-modules - Use error codes instead of numbers (#60711) 5 years ago
Matt Clay 1db78d4ba4 Attempt quick fix for CI failures. 5 years ago
Matt Clay 830f995ed4
Add a --venv option to ansible-test. (#61422)
* Add --venv delegation to ansible-test.

* Update import sanity test venv creation.

* Fix import test when using --venv on Python 2.x.

* Improve virtualenv setup overhead.

* Hide pip noise for import sanity test.

* Raise verbosity on venv info messages.

* Get rid of base branch noise for collections.

* Add missing --requirements check.
5 years ago