mirror of https://github.com/ansible/ansible.git
sanity tests - ignore pre-release versions for deprecation comparisons (#79185)
parent
39fd899d83
commit
f64e79be41
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- sanity tests - updates the collection-deprecated-version tests to ignore the ``prerelease`` component of the collection version ().
|
@ -0,0 +1,4 @@
|
||||
shippable/posix/group3 # runs in the distro test containers
|
||||
shippable/generic/group1 # runs in the default test container
|
||||
context/controller
|
||||
needs/target/collection
|
@ -0,0 +1,6 @@
|
||||
namespace: ns
|
||||
name: col
|
||||
version:
|
||||
readme: README.rst
|
||||
authors:
|
||||
- Ansible
|
@ -0,0 +1,22 @@
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
name: deprecated
|
||||
short_description: lookup
|
||||
description: Lookup.
|
||||
author:
|
||||
- Ansible Core Team
|
||||
'''
|
||||
|
||||
EXAMPLES = '''#'''
|
||||
RETURN = '''#'''
|
||||
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
def run(self, **kwargs):
|
||||
return []
|
@ -0,0 +1 @@
|
||||
plugins/lookup/deprecated.py:27:0: collection-deprecated-version: Deprecated version ('2.0.0') found in call to Display.deprecated or AnsibleModule.deprecate
|
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
source ../collection/setup.sh
|
||||
|
||||
# Create test scenarios at runtime that do not pass sanity tests.
|
||||
# This avoids the need to create ignore entries for the tests.
|
||||
|
||||
echo "
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
display.deprecated('', version='2.0.0', collection_name='ns.col')" >> plugins/lookup/deprecated.py
|
||||
|
||||
# Verify deprecation checking works for normal releases and pre-releases.
|
||||
|
||||
for version in 2.0.0 2.0.0-dev0; do
|
||||
echo "Checking version: ${version}"
|
||||
sed "s/^version:.*\$/version: ${version}/" < galaxy.yml > galaxy.yml.tmp
|
||||
mv galaxy.yml.tmp galaxy.yml
|
||||
ansible-test sanity --test pylint --color --failure-ok --lint "${@}" 1> actual-stdout.txt 2> actual-stderr.txt
|
||||
diff -u "${TEST_DIR}/expected.txt" actual-stdout.txt
|
||||
grep -f "${TEST_DIR}/expected.txt" actual-stderr.txt
|
||||
done
|
Loading…
Reference in New Issue