From ca0810da85d729a526b8ae97204b9da5c5c2ea25 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 12 Nov 2024 07:09:39 -0800 Subject: Add tests for deprecations (#84284) * Check for module deprecation * Check for module option deprecation * Check for plugin deprecation Signed-off-by: Abhijeet Kasurde --- .../targets/deprecations/cache_plugins/notjsonfile.py | 4 ++++ test/integration/targets/deprecations/runme.sh | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/integration/targets/deprecations/cache_plugins/notjsonfile.py b/test/integration/targets/deprecations/cache_plugins/notjsonfile.py index 800fe3bb36..3af587abb7 100644 --- a/test/integration/targets/deprecations/cache_plugins/notjsonfile.py +++ b/test/integration/targets/deprecations/cache_plugins/notjsonfile.py @@ -9,6 +9,10 @@ DOCUMENTATION = """ description: This cache uses is NOT JSON author: Ansible Core (@ansible-core) version_added: 0.7.0 + deprecated: + alternative: cause I need to test it + why: Test deprecation + version: '2.0.0' options: _uri: required: True diff --git a/test/integration/targets/deprecations/runme.sh b/test/integration/targets/deprecations/runme.sh index 48a02760ad..bd52ef8ff4 100755 --- a/test/integration/targets/deprecations/runme.sh +++ b/test/integration/targets/deprecations/runme.sh @@ -34,6 +34,11 @@ export ANSIBLE_CACHE_PLUGIN=notjsonfile # check for plugin(s) config option deprecation [ "$(ANSIBLE_NOTJSON_CACHE_PLUGIN_REMOVEME=1 ansible -m meta -a 'noop' localhost --playbook-dir ./ 2>&1 | grep -c 'DEPRECATION')" -eq "1" ] -# TODO: check for module deprecation -# TODO: check for module option deprecation -# TODO: check for plugin deprecation +# check for the module deprecation +[ "$(ansible-doc willremove --playbook-dir ./ | grep -c 'DEPRECATED')" -eq "1" ] + +# check for the module option deprecation +[ "$(ansible-doc removeoption --playbook-dir ./ | grep -c 'deprecated:')" -eq "1" ] + +# check for plugin deprecation +[ "$(ansible-doc -t cache notjsonfile --playbook-dir ./ | grep -c 'DEPRECATED:')" -eq "1" ] -- cgit v1.2.3