mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Adds aggregate functionality to the module (#51640)
This commit is contained in:
committed by
Tim Rupp
parent
48704d45fd
commit
a5c630a81f
@@ -151,14 +151,19 @@ class TestManager(unittest.TestCase):
|
||||
monitor='tcp',
|
||||
member_order=2,
|
||||
partition='Common',
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=self.spec.argument_spec,
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
supports_check_mode=self.spec.supports_check_mode,
|
||||
mutually_exclusive=self.spec.mutually_exclusive,
|
||||
required_one_of=self.spec.required_one_of,
|
||||
required_together=self.spec.required_together,
|
||||
)
|
||||
|
||||
# Override methods in the specific type of manager
|
||||
@@ -170,3 +175,45 @@ class TestManager(unittest.TestCase):
|
||||
results = mm.exec_module()
|
||||
|
||||
assert results['changed'] is True
|
||||
|
||||
def test_create_aggregate_pool_members(self, *args):
|
||||
set_module_args(dict(
|
||||
pool='fake_pool',
|
||||
type='a',
|
||||
aggregate=[
|
||||
dict(
|
||||
server_name='my-name1',
|
||||
virtual_server='some-vs2',
|
||||
state='present',
|
||||
partition='Common',
|
||||
|
||||
),
|
||||
dict(
|
||||
server_name='my-name1',
|
||||
virtual_server='some-vs1',
|
||||
state='present',
|
||||
partition='Common'
|
||||
)
|
||||
],
|
||||
provider=dict(
|
||||
server='localhost',
|
||||
password='password',
|
||||
user='admin'
|
||||
)
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=self.spec.argument_spec,
|
||||
supports_check_mode=self.spec.supports_check_mode,
|
||||
mutually_exclusive=self.spec.mutually_exclusive,
|
||||
required_one_of=self.spec.required_one_of,
|
||||
required_together=self.spec.required_together,
|
||||
)
|
||||
|
||||
mm = ModuleManager(module=module)
|
||||
mm.create_on_device = Mock(return_value=True)
|
||||
mm.exists = Mock(return_value=False)
|
||||
|
||||
results = mm.exec_module()
|
||||
|
||||
assert results['changed'] is True
|
||||
|
||||
Reference in New Issue
Block a user