summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/test/fluentd_config_test.py
diff options
context:
space:
mode:
authorLuke Meyer <lmeyer@redhat.com>2017-07-20 23:39:47 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-08-02 15:03:50 -0400
commit06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2 (patch)
tree4631e75c28017e238ff84756f6cfdeb72563259a /roles/openshift_health_checker/test/fluentd_config_test.py
parentbf0828bc0f2e3088df20abc77e30a162595e1c22 (diff)
downloadopenshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.gz
openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.bz2
openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.tar.xz
openshift-06a6fb9642a2cc70b1ca65f403b853fe8ce9d4b2.zip
openshift_checks: refactor logging checks
Turn failure messages into exceptions that tests can look for without depending on text meant for humans. Turn logging_namespace property into a method. Get rid of _exec_oc and just use logging.exec_oc.
Diffstat (limited to 'roles/openshift_health_checker/test/fluentd_config_test.py')
-rw-r--r--roles/openshift_health_checker/test/fluentd_config_test.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/roles/openshift_health_checker/test/fluentd_config_test.py b/roles/openshift_health_checker/test/fluentd_config_test.py
index 8a2d8b72b..10db253bc 100644
--- a/roles/openshift_health_checker/test/fluentd_config_test.py
+++ b/roles/openshift_health_checker/test/fluentd_config_test.py
@@ -198,12 +198,9 @@ def test_check_logging_config_master(name, pods, logging_driver, extra_words):
),
)
- def get_pods(namespace, logging_component):
- return pods, None
-
check = FluentdConfig(execute_module, task_vars)
check.execute_module = execute_module
- check.get_pods_for_component = get_pods
+ check.get_pods_for_component = lambda _: pods
error = check.check_logging_config()
assert error is None
@@ -283,12 +280,9 @@ def test_check_logging_config_master_failed(name, pods, logging_driver, words):
),
)
- def get_pods(namespace, logging_component):
- return pods, None
-
check = FluentdConfig(execute_module, task_vars)
check.execute_module = execute_module
- check.get_pods_for_component = get_pods
+ check.get_pods_for_component = lambda _: pods
error = check.check_logging_config()
assert error is not None
@@ -343,11 +337,8 @@ def test_check_logging_config_master_fails_on_unscheduled_deployment(name, pods,
),
)
- def get_pods(namespace, logging_component):
- return pods, None
-
check = FluentdConfig(execute_module, task_vars)
- check.get_pods_for_component = get_pods
+ check.get_pods_for_component = lambda _: pods
with pytest.raises(OpenShiftCheckException) as error:
check.check_logging_config()