• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ansible / awx-plugins / 20221261454

20 Nov 2025 03:23PM UTC coverage: 71.764% (+0.2%) from 71.523%
20221261454

push

github

web-flow
Merge pull request #140 from shvenkat-rh/add-tfec-credential-type

Add a managed credential type for HCP Terraform

37 of 37 branches covered (100.0%)

Branch coverage included in aggregate %.

56 of 67 new or added lines in 4 files covered. (83.58%)

2286 of 3200 relevant lines covered (71.44%)

2.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.36
/tests/importable_test.py
1
"""Smoke tests related to loading entry points."""
2

3
from dataclasses import dataclass
3✔
4
from importlib.metadata import entry_points as _discover_entry_points
3✔
5

6
import pytest
3✔
7

8
from awx_plugins.inventory.plugins import PluginFileInjector
3✔
9

10

11
@dataclass(frozen=True)
3✔
12
class EntryPointParam:
3✔
13
    """Data structure representing a single exposed plugin."""
14

15
    group: str
3✔
16
    name: str
3✔
17
    spec: str
3✔
18

19
    def __str__(self) -> str:
3✔
20
        """Render an entry-point parameter as a string.
21

22
        To be used as a part of parametrized test ID.
23
        """  # noqa: DAR201; FIXME
24
        return f'{self.name}={self.spec}@{self.group}'
3✔
25

26

27
credential_plugins = (
3✔
28
    EntryPointParam(
3✔
29
        'awx_plugins.credentials',
3✔
30
        'aim',
3✔
31
        'awx_plugins.credentials.aim:aim_plugin',
3✔
32
    ),
33
    EntryPointParam(
3✔
34
        'awx_plugins.credentials',
3✔
35
        'conjur',
3✔
36
        'awx_plugins.credentials.conjur:conjur_plugin',
3✔
37
    ),
38
    EntryPointParam(
3✔
39
        'awx_plugins.credentials',
3✔
40
        'hashivault_kv',
3✔
41
        'awx_plugins.credentials.hashivault:hashivault_kv_plugin',
3✔
42
    ),
43
    EntryPointParam(
3✔
44
        'awx_plugins.credentials',
3✔
45
        'hashivault_ssh',
3✔
46
        'awx_plugins.credentials.hashivault:hashivault_ssh_plugin',
3✔
47
    ),
48
    EntryPointParam(
3✔
49
        'awx_plugins.credentials',
3✔
50
        'azure_kv',
3✔
51
        'awx_plugins.credentials.azure_kv:azure_keyvault_plugin',
3✔
52
    ),
53
    EntryPointParam(
3✔
54
        'awx_plugins.credentials',
3✔
55
        'centrify_vault_kv',
3✔
56
        'awx_plugins.credentials.centrify_vault:centrify_plugin',
3✔
57
    ),
58
    EntryPointParam(
3✔
59
        'awx_plugins.credentials',
3✔
60
        'thycotic_dsv',
3✔
61
        'awx_plugins.credentials.dsv:dsv_plugin',
3✔
62
    ),
63
    EntryPointParam(
3✔
64
        'awx_plugins.credentials',
3✔
65
        'thycotic_tss',
3✔
66
        'awx_plugins.credentials.tss:tss_plugin',
3✔
67
    ),
68
    EntryPointParam(
3✔
69
        'awx_plugins.credentials',
3✔
70
        'aws_secretsmanager_credential',
3✔
71
        'awx_plugins.credentials.aws_secretsmanager:aws_secretmanager_plugin',
3✔
72
    ),
73
)
74

75

76
managed_credential_plugins = (
3✔
77
    EntryPointParam(
3✔
78
        'awx_plugins.managed_credentials.supported',
3✔
79
        'hcp_terraform',
3✔
80
        'awx_plugins.credentials._managed_types.terraform:hcp_terraform',
3✔
81
    ),
82
)
83

84

85
inventory_plugins = (
3✔
86
    EntryPointParam(
3✔
87
        'awx_plugins.inventory',
3✔
88
        'azure_rm',
3✔
89
        'awx_plugins.inventory.plugins:azure_rm',
3✔
90
    ),
91
    EntryPointParam(
3✔
92
        'awx_plugins.inventory',
3✔
93
        'ec2',
3✔
94
        'awx_plugins.inventory.plugins:ec2',
3✔
95
    ),
96
    EntryPointParam(
3✔
97
        'awx_plugins.inventory',
3✔
98
        'gce',
3✔
99
        'awx_plugins.inventory.plugins:gce',
3✔
100
    ),
101
    EntryPointParam(
3✔
102
        'awx_plugins.inventory',
3✔
103
        'vmware',
3✔
104
        'awx_plugins.inventory.plugins:vmware',
3✔
105
    ),
106
    EntryPointParam(
3✔
107
        'awx_plugins.inventory',
3✔
108
        'openstack',
3✔
109
        'awx_plugins.inventory.plugins:openstack',
3✔
110
    ),
111
    EntryPointParam(
3✔
112
        'awx_plugins.inventory',
3✔
113
        'rhv',
3✔
114
        'awx_plugins.inventory.plugins:rhv',
3✔
115
    ),
116
    EntryPointParam(
3✔
117
        'awx_plugins.inventory',
3✔
118
        'satellite6',
3✔
119
        'awx_plugins.inventory.plugins:satellite6',
3✔
120
    ),
121
    EntryPointParam(
3✔
122
        'awx_plugins.inventory',
3✔
123
        'terraform',
3✔
124
        'awx_plugins.inventory.plugins:terraform',
3✔
125
    ),
126
    EntryPointParam(
3✔
127
        'awx_plugins.inventory',
3✔
128
        'controller',
3✔
129
        'awx_plugins.inventory.plugins:controller',
3✔
130
    ),
131
    EntryPointParam(
3✔
132
        'awx_plugins.inventory',
3✔
133
        'insights',
3✔
134
        'awx_plugins.inventory.plugins:insights',
3✔
135
    ),
136
    EntryPointParam(
3✔
137
        'awx_plugins.inventory',
3✔
138
        'openshift_virtualization',
3✔
139
        'awx_plugins.inventory.plugins:openshift_virtualization',
3✔
140
    ),
141
    EntryPointParam(
3✔
142
        'awx_plugins.inventory',
3✔
143
        'constructed',
3✔
144
        'awx_plugins.inventory.plugins:constructed',
3✔
145
    ),
146
    EntryPointParam(
3✔
147
        'awx_plugins.inventory.supported',
3✔
148
        'rhv',
3✔
149
        'awx_plugins.inventory.plugins:rhv_supported',
3✔
150
    ),
151
    EntryPointParam(
3✔
152
        'awx_plugins.inventory.supported',
3✔
153
        'satellite6',
3✔
154
        'awx_plugins.inventory.plugins:satellite6_supported',
3✔
155
    ),
156
    EntryPointParam(
3✔
157
        'awx_plugins.inventory.supported',
3✔
158
        'controller',
3✔
159
        'awx_plugins.inventory.plugins:controller_supported',
3✔
160
    ),
161
    EntryPointParam(
3✔
162
        'awx_plugins.inventory.supported',
3✔
163
        'insights',
3✔
164
        'awx_plugins.inventory.plugins:insights_supported',
3✔
165
    ),
166
    EntryPointParam(
3✔
167
        'awx_plugins.inventory.supported',
3✔
168
        'openshift_virtualization',
3✔
169
        'awx_plugins.inventory.plugins:openshift_virtualization_supported',
3✔
170
    ),
171
    EntryPointParam(
3✔
172
        'awx_plugins.inventory.supported',
3✔
173
        'vmware_esxi',
3✔
174
        'awx_plugins.inventory.plugins:vmware_esxi_supported',
3✔
175
    ),
176
)
177

178

179
with_credential_plugins = pytest.mark.parametrize(
3✔
180
    'entry_point',
3✔
181
    credential_plugins,
3✔
182
    ids=str,
3✔
183
)
184

185

186
with_managed_credential_plugins = pytest.mark.parametrize(
3✔
187
    'entry_point',
3✔
188
    managed_credential_plugins,
3✔
189
    ids=str,
3✔
190
)
191

192

193
with_inventory_plugins = pytest.mark.parametrize(
3✔
194
    'entry_point',
3✔
195
    inventory_plugins,
3✔
196
    ids=str,
3✔
197
)
198

199

200
with_all_plugins = pytest.mark.parametrize(
3✔
201
    'entry_point',
3✔
202
    credential_plugins + managed_credential_plugins + inventory_plugins,
3✔
203
    ids=str,
3✔
204
)
205

206

207
@with_all_plugins
3✔
208
def test_entry_points_exposed(entry_point: EntryPointParam) -> None:
3✔
209
    """Verify the plugin entry points are discoverable.
210

211
    This check relies on the plugin-declaring distribution package to be
212
    pre-installed.
213
    """  # noqa: DAR101; FIXME
214
    entry_points = _discover_entry_points(group=entry_point.group)
3✔
215

216
    assert entry_point.name in entry_points.names
3✔
217
    assert entry_points[entry_point.name].value == entry_point.spec
3✔
218

219

220
@with_credential_plugins
3✔
221
def test_entry_points_are_credential_plugin(
3✔
222
    entry_point: EntryPointParam,
223
) -> None:
224
    """Ensure all exposed credential plugins are of the same class."""  # noqa: D200, DAR101; FIXME
225
    entry_points = _discover_entry_points(group=entry_point.group)
3✔
226
    loaded_plugin_class = entry_points[entry_point.name].load()
×
227

228
    loaded_plugin_class_name = type(loaded_plugin_class).__name__
×
229
    assert loaded_plugin_class_name == 'CredentialPlugin'
3✔
230

231

232
@with_managed_credential_plugins
3✔
233
def test_entry_points_are_managed_credential_type(
3✔
234
    entry_point: EntryPointParam,
235
) -> None:
236
    """Ensure all exposed managed credential plugins are of the same class."""  # noqa: D200, DAR101; FIXME
237
    entry_points = _discover_entry_points(group=entry_point.group)
3✔
NEW
238
    loaded_plugin_class = entry_points[entry_point.name].load()
×
239

NEW
240
    loaded_plugin_class_name = type(loaded_plugin_class).__name__
×
241
    assert loaded_plugin_class_name == 'ManagedCredentialType'
3✔
242

243

244
@with_inventory_plugins
3✔
245
def test_entry_points_are_inventory_plugin(
3✔
246
    entry_point: EntryPointParam,
247
) -> None:
248
    """Ensure all exposed inventory plugins are of the same class."""  # noqa: D200, DAR101; FIXME
249
    entry_points = _discover_entry_points(group=entry_point.group)
3✔
250
    loaded_plugin_class = entry_points[entry_point.name].load()
×
251

252
    assert issubclass(loaded_plugin_class, PluginFileInjector)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc