summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/test
diff options
context:
space:
mode:
authorLuke Meyer <lmeyer@redhat.com>2017-05-23 14:16:12 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-05-23 14:56:20 -0400
commit323301a45b1adc20ea41b0633b53185a1a9d77e9 (patch)
tree10aa6ae0244963ec66b9192c4fc8cf5d79e88947 /roles/openshift_health_checker/test
parent1d5d13308bd79051b0bf3311240ef0e6cb286392 (diff)
downloadopenshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.gz
openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.bz2
openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.tar.xz
openshift-323301a45b1adc20ea41b0633b53185a1a9d77e9.zip
health checks: specify check skip reason
Added indicator to check result for why that check was skipped. Note that currently the user will only see it with ansible-playbook -vv
Diffstat (limited to 'roles/openshift_health_checker/test')
-rw-r--r--roles/openshift_health_checker/test/action_plugin_test.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/roles/openshift_health_checker/test/action_plugin_test.py b/roles/openshift_health_checker/test/action_plugin_test.py
index 2693ae37b..6ebf0ebb2 100644
--- a/roles/openshift_health_checker/test/action_plugin_test.py
+++ b/roles/openshift_health_checker/test/action_plugin_test.py
@@ -67,6 +67,7 @@ def changed(result):
return result.get('changed', False)
+# tests whether task is skipped, not individual checks
def skipped(result):
return result.get('skipped', False)
@@ -101,7 +102,20 @@ def test_action_plugin_skip_non_active_checks(plugin, task_vars, monkeypatch):
result = plugin.run(tmp=None, task_vars=task_vars)
- assert result['checks']['fake_check'] == {'skipped': True}
+ assert result['checks']['fake_check'] == dict(skipped=True, skipped_reason="Not active for this host")
+ assert not failed(result)
+ assert not changed(result)
+ assert not skipped(result)
+
+
+def test_action_plugin_skip_disabled_checks(plugin, task_vars, monkeypatch):
+ checks = [fake_check('fake_check', is_active=True)]
+ monkeypatch.setattr('openshift_checks.OpenShiftCheck.subclasses', classmethod(lambda cls: checks))
+
+ task_vars['openshift_disable_check'] = 'fake_check'
+ result = plugin.run(tmp=None, task_vars=task_vars)
+
+ assert result['checks']['fake_check'] == dict(skipped=True, skipped_reason="Disabled by user request")
assert not failed(result)
assert not changed(result)
assert not skipped(result)