From 7a643daa7ed629cd904cfb5fd5eec4260f0f1582 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Tue, 13 Jun 2017 19:09:19 +0200 Subject: Refactor DiskAvailability for arbitrary paths Prepare the check to support verifying multiple paths, not only /var. --- roles/openshift_health_checker/test/disk_availability_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/openshift_health_checker/test') diff --git a/roles/openshift_health_checker/test/disk_availability_test.py b/roles/openshift_health_checker/test/disk_availability_test.py index b353fa610..de09c51da 100644 --- a/roles/openshift_health_checker/test/disk_availability_test.py +++ b/roles/openshift_health_checker/test/disk_availability_test.py @@ -38,7 +38,7 @@ def test_cannot_determine_available_disk(ansible_mounts, extra_words): with pytest.raises(OpenShiftCheckException) as excinfo: check.run(tmp=None, task_vars=task_vars) - for word in 'determine available disk'.split() + extra_words: + for word in 'determine disk availability'.split() + extra_words: assert word in str(excinfo.value) -- cgit v1.2.3 From 75082afc3a2cc9fed1966479dc31946962101488 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Tue, 13 Jun 2017 19:11:43 +0200 Subject: Require at least 1GB in /usr/bin/local and tempdir During install, those paths are used and require some free space. --- roles/openshift_health_checker/test/disk_availability_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/openshift_health_checker/test') diff --git a/roles/openshift_health_checker/test/disk_availability_test.py b/roles/openshift_health_checker/test/disk_availability_test.py index de09c51da..0c111a46d 100644 --- a/roles/openshift_health_checker/test/disk_availability_test.py +++ b/roles/openshift_health_checker/test/disk_availability_test.py @@ -81,7 +81,7 @@ def test_cannot_determine_available_disk(ansible_mounts, extra_words): [{ # not enough space on / ... 'mount': '/', - 'size_available': 0, + 'size_available': 2 * 10**9, }, { # ... but enough on /var 'mount': '/var', -- cgit v1.2.3 From 11762c063f52d46709db560479234b1d49e602b8 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Tue, 13 Jun 2017 20:18:04 +0200 Subject: Enable disk check on containerized installs According to the docs the disk requirements should be similar to non-containerized installs. https://docs.openshift.org/latest/install_config/install/rpm_vs_containerized.html#containerized-storage-requirements --- .../test/disk_availability_test.py | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'roles/openshift_health_checker/test') diff --git a/roles/openshift_health_checker/test/disk_availability_test.py b/roles/openshift_health_checker/test/disk_availability_test.py index 0c111a46d..945b9eafc 100644 --- a/roles/openshift_health_checker/test/disk_availability_test.py +++ b/roles/openshift_health_checker/test/disk_availability_test.py @@ -3,22 +3,19 @@ import pytest from openshift_checks.disk_availability import DiskAvailability, OpenShiftCheckException -@pytest.mark.parametrize('group_names,is_containerized,is_active', [ - (['masters'], False, True), - # ensure check is skipped on containerized installs - (['masters'], True, False), - (['nodes'], False, True), - (['etcd'], False, True), - (['masters', 'nodes'], False, True), - (['masters', 'etcd'], False, True), - ([], False, False), - (['lb'], False, False), - (['nfs'], False, False), +@pytest.mark.parametrize('group_names,is_active', [ + (['masters'], True), + (['nodes'], True), + (['etcd'], True), + (['masters', 'nodes'], True), + (['masters', 'etcd'], True), + ([], False), + (['lb'], False), + (['nfs'], False), ]) -def test_is_active(group_names, is_containerized, is_active): +def test_is_active(group_names, is_active): task_vars = dict( group_names=group_names, - openshift=dict(common=dict(is_containerized=is_containerized)), ) assert DiskAvailability.is_active(task_vars=task_vars) == is_active -- cgit v1.2.3 From 11040f1b76981c22d62d17d1d22a3741e50a27fd Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Fri, 9 Jun 2017 17:04:19 +0200 Subject: Capture exceptions when resolving available checks Calling the action plugin (e.g. when running a playbook) with an incorrect check name was raising an unhandled exception, leading to poor output in Ansible (requiring a higher verbosity level to see what is going wrong). --- roles/openshift_health_checker/test/action_plugin_test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'roles/openshift_health_checker/test') diff --git a/roles/openshift_health_checker/test/action_plugin_test.py b/roles/openshift_health_checker/test/action_plugin_test.py index 6ebf0ebb2..9383b233c 100644 --- a/roles/openshift_health_checker/test/action_plugin_test.py +++ b/roles/openshift_health_checker/test/action_plugin_test.py @@ -59,7 +59,7 @@ def failed(result, msg_has=None): if msg_has is not None: assert 'msg' in result for term in msg_has: - assert term in result['msg'] + assert term.lower() in result['msg'].lower() return result.get('failed', False) @@ -178,6 +178,16 @@ def test_action_plugin_run_check_exception(plugin, task_vars, monkeypatch): assert not skipped(result) +def test_action_plugin_resolve_checks_exception(plugin, task_vars, monkeypatch): + monkeypatch.setattr(plugin, 'load_known_checks', lambda: {}) + + result = plugin.run(tmp=None, task_vars=task_vars) + + assert failed(result, msg_has=['unknown', 'name']) + assert not changed(result) + assert not skipped(result) + + @pytest.mark.parametrize('names,all_checks,expected', [ ([], [], set()), ( -- cgit v1.2.3 From 4d3574957508c257e12d9ba8ec8de48ed9789eb9 Mon Sep 17 00:00:00 2001 From: Luke Meyer Date: Fri, 30 Jun 2017 10:19:50 -0400 Subject: docker_image_availability: fix containerized etcd fixes bug 1466622 - docker_image_availability check on etcd host failed for 'openshift_image_tag' is undefined --- .../test/docker_image_availability_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'roles/openshift_health_checker/test') diff --git a/roles/openshift_health_checker/test/docker_image_availability_test.py b/roles/openshift_health_checker/test/docker_image_availability_test.py index 0a7c0f8d3..3b9e097fb 100644 --- a/roles/openshift_health_checker/test/docker_image_availability_test.py +++ b/roles/openshift_health_checker/test/docker_image_availability_test.py @@ -259,3 +259,17 @@ def test_required_images(deployment_type, is_containerized, groups, oreg_url, ex ) assert expected == DockerImageAvailability("DUMMY").required_images(task_vars) + + +def test_containerized_etcd(): + task_vars = dict( + openshift=dict( + common=dict( + is_containerized=True, + ), + ), + openshift_deployment_type="origin", + group_names=['etcd'], + ) + expected = set(['registry.access.redhat.com/rhel7/etcd']) + assert expected == DockerImageAvailability("DUMMY").required_images(task_vars) -- cgit v1.2.3