mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 09:18:48 -03:30
Update awx_collection to support ReceptorAddress
- Add receptor_address module which allows users to create addresses for instances - Update awx_collection functional and integration tests to support new peering design Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
@@ -54,7 +54,7 @@ extra_endpoints = {
|
||||
}
|
||||
|
||||
# Global module parameters we can ignore
|
||||
ignore_parameters = ['state', 'new_name', 'update_secrets', 'copy_from']
|
||||
ignore_parameters = ['state', 'new_name', 'update_secrets', 'copy_from', 'is_internal']
|
||||
|
||||
# Some modules take additional parameters that do not appear in the API
|
||||
# Add the module name as the key with the value being the list of params to ignore
|
||||
@@ -248,7 +248,9 @@ def test_completeness(collection_import, request, admin_user, job_template, exec
|
||||
singular_endpoint = '{0}'.format(endpoint)
|
||||
if singular_endpoint.endswith('ies'):
|
||||
singular_endpoint = singular_endpoint[:-3]
|
||||
if singular_endpoint != 'settings' and singular_endpoint.endswith('s'):
|
||||
elif singular_endpoint.endswith('ses'): # receptor_addresses
|
||||
singular_endpoint = singular_endpoint[:-2]
|
||||
elif singular_endpoint != 'settings' and singular_endpoint.endswith('s'):
|
||||
singular_endpoint = singular_endpoint[:-1]
|
||||
module_name = '{0}'.format(singular_endpoint)
|
||||
|
||||
|
||||
@@ -13,39 +13,39 @@ def test_peers_adding_and_removing(run_module, admin_user):
|
||||
with override_settings(IS_K8S=True):
|
||||
result = run_module(
|
||||
'instance',
|
||||
{'hostname': 'hopnode1', 'node_type': 'hop', 'peers_from_control_nodes': True, 'node_state': 'installed', 'listener_port': 27199},
|
||||
{'hostname': 'hopnode', 'node_type': 'hop', 'node_state': 'installed'},
|
||||
admin_user,
|
||||
)
|
||||
assert result['changed']
|
||||
|
||||
hop_node_1 = Instance.objects.get(pk=result.get('id'))
|
||||
hop_node = Instance.objects.get(pk=result.get('id'))
|
||||
|
||||
assert hop_node_1.peers_from_control_nodes is True
|
||||
assert hop_node_1.node_type == 'hop'
|
||||
assert hop_node.node_type == 'hop'
|
||||
|
||||
result = run_module(
|
||||
'instance',
|
||||
{'hostname': 'hopnode2', 'node_type': 'hop', 'peers_from_control_nodes': True, 'node_state': 'installed', 'listener_port': 27199},
|
||||
'receptor_address',
|
||||
{'address': 'hopnodeaddr', 'instance': 'hopnode', 'port': 6789},
|
||||
admin_user,
|
||||
)
|
||||
assert result['changed']
|
||||
|
||||
hop_node_2 = Instance.objects.get(pk=result.get('id'))
|
||||
address = hop_node.receptor_addresses.get(pk=result.get('id'))
|
||||
assert address.port == 6789
|
||||
|
||||
result = run_module(
|
||||
'instance',
|
||||
{'hostname': 'executionnode', 'node_type': 'execution', 'node_state': 'installed', 'listener_port': 27199, 'peers': ['hopnode1', 'hopnode2']},
|
||||
{'hostname': 'executionnode', 'node_type': 'execution', 'node_state': 'installed', 'peers': ['hopnodeaddr']},
|
||||
admin_user,
|
||||
)
|
||||
assert result['changed']
|
||||
|
||||
execution_node = Instance.objects.get(pk=result.get('id'))
|
||||
|
||||
assert set(execution_node.peers.all()) == {hop_node_1, hop_node_2}
|
||||
assert set(execution_node.peers.all()) == {address}
|
||||
|
||||
result = run_module(
|
||||
'instance',
|
||||
{'hostname': 'executionnode', 'node_type': 'execution', 'node_state': 'installed', 'listener_port': 27199, 'peers': []},
|
||||
{'hostname': 'executionnode', 'node_type': 'execution', 'node_state': 'installed', 'peers': []},
|
||||
admin_user,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user