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:
Seth Foster
2023-11-15 12:34:19 -05:00
committed by Seth Foster
parent d1cacf64de
commit 04cbbbccfa
10 changed files with 236 additions and 52 deletions

View File

@@ -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,
)