nagios-charmers team mailing list archive
-
nagios-charmers team
-
Mailing list archive
-
Message #00364
Re: [Merge] ~aieri/hw-health-charm:oo-rewrite-functest-removal into hw-health-charm:oo-rewrite-integration
Review: Approve
lgtm. I added a minor comment about the use of timeouts in block_until.
Diff comments:
> diff --git a/src/tests/functional/test_hwhealth.py b/src/tests/functional/test_hwhealth.py
> index bf905c1..dc31368 100644
> --- a/src/tests/functional/test_hwhealth.py
> +++ b/src/tests/functional/test_hwhealth.py
> @@ -181,3 +181,58 @@ async def test_stats(tools, deployed_unit, file_stat):
> assert test_stat['gid'] == tool.TOOLS_GID
> assert test_stat['uid'] == tool.TOOLS_UID
> assert test_stat['mode'] == oct(tool.TOOLS_MODE)
> +
> +
> +async def test_removal(tools, model, deploy_app, file_stat):
> + '''Remove the unit, test that all files have been cleaned up'''
> + hw_health_app_name = deploy_app.name
> + await deploy_app.remove()
> + await model.block_until(
> + lambda: hw_health_app_name not in model.applications
set timeout
> + )
> + # Since we've removed the hw-health app, we can't target it anymore, we
> + # need to find the principal unit
> + for unit in model.units.values():
> + if unit.entity_id.startswith('ubuntu'):
> + ubuntu_unit = unit
> + for tool in tools:
> + # Have we removed the nrpe check cfg?
> + nrpecfg_path = os.path.join(nrpecfg_dir,
> + 'check_{}.cfg'.format(tool._shortname))
> + print('Checking {}'.format(nrpecfg_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(nrpecfg_path, ubuntu_unit)
> +
> + # Have we removed the nrpe check script?
> + nrpescript_path = os.path.join(tool.NRPE_PLUGINS_DIR,
> + tool._nrpe_script)
> + print('Checking {}'.format(nrpescript_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(nrpescript_path, ubuntu_unit)
> + if isinstance(tool, classes.IpmiTool):
> + # Have we removed sudo rights for running freeipmi commands?
> + sudoer_path = os.path.join(tool.SUDOERS_DIR, tool._sudoer_file)
> + print('Checking {}'.format(sudoer_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(sudoer_path, ubuntu_unit)
> + elif isinstance(tool, classes.VendorTool):
> + # Have we removed the cronjob script helper?
> + cronjob_path = os.path.join(tool.NRPE_PLUGINS_DIR,
> + tool._cronjob_script)
> + print('Checking {}'.format(cronjob_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(cronjob_path, ubuntu_unit)
> +
> + # Have we removed the cronjob itself?
> + cronjob_path = os.path.join(tool.CROND_DIR, tool._shortname)
> + print('Checking {}'.format(cronjob_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(cronjob_path, ubuntu_unit)
> +
> + if not isinstance(tool, classes.MdadmTool):
> + # /sbin/mdadm will not be removed, but the vendor binaries
> + # should have been
> + bin_path = os.path.join(tool.TOOLS_DIR, tool._shortname)
> + print('Checking {}'.format(bin_path))
> + with pytest.raises(RuntimeError):
> + await file_stat(bin_path, ubuntu_unit)
--
https://code.launchpad.net/~aieri/hw-health-charm/+git/hw-health-charm/+merge/364761
Your team Nagios Charm developers is subscribed to branch hw-health-charm:oo-rewrite-integration.
References