Debian Codegraph @

ansible_collections/community/general/docs/docsite/rst/test_guide.rst

raw
1 ..
2 Copyright (c) Ansible Project
3 GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 SPDX-License-Identifier: GPL-3.0-or-later
5
6 .. _ansible_collections.community.general.docsite.test_guide:
7
8 community.general Test (Plugin) Guide
9 =====================================
10
11 The :anscollection:`community.general collection <community.general#collection>` offers currently one test plugin.
12
13 .. contents:: Topics
14
15 Feature Tests
16 -------------
17
18 The :ansplugin:`community.general.a_module test <community.general.a_module#test>` allows to check whether a given string refers to an existing module or action plugin. This can be useful in roles, which can use this to ensure that required modules are present ahead of time.
19
20 .. code-block:: yaml+jinja
21
22 - name: Make sure that community.aws.route53 is available
23 assert:
24 that:
25 - >
26 'community.aws.route53' is community.general.a_module
27
28 - name: Make sure that community.general.does_not_exist is not a module or action plugin
29 assert:
30 that:
31 - "'community.general.does_not_exist' is not community.general.a_module"
32
33 .. versionadded:: 4.0.0