summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/test/kibana_test.py
diff options
context:
space:
mode:
authorLuke Meyer <lmeyer@redhat.com>2017-06-16 17:24:01 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-07-25 13:23:58 -0400
commit210fc2d3849a1baf9c1d8535044d92df23424274 (patch)
tree20b6998ca0696257eb816e4ace464ee95b926816 /roles/openshift_health_checker/test/kibana_test.py
parent2a0936b291992ba1b7343680aec915df0c29892c (diff)
downloadopenshift-210fc2d3849a1baf9c1d8535044d92df23424274.tar.gz
openshift-210fc2d3849a1baf9c1d8535044d92df23424274.tar.bz2
openshift-210fc2d3849a1baf9c1d8535044d92df23424274.tar.xz
openshift-210fc2d3849a1baf9c1d8535044d92df23424274.zip
openshift_checks: refactor to internalize task_vars
Move task_vars into instance variable so we don't have to pass it around everywhere. Also store tmp. Make sure both are filled in on execute_module. In the process, is_active became an instance method, and task_vars is basically never used directly outside of test code.
Diffstat (limited to 'roles/openshift_health_checker/test/kibana_test.py')
-rw-r--r--roles/openshift_health_checker/test/kibana_test.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/roles/openshift_health_checker/test/kibana_test.py b/roles/openshift_health_checker/test/kibana_test.py
index 40a5d19d8..3a880d300 100644
--- a/roles/openshift_health_checker/test/kibana_test.py
+++ b/roles/openshift_health_checker/test/kibana_test.py
@@ -13,7 +13,7 @@ from openshift_checks.logging.kibana import Kibana
def canned_kibana(exec_oc=None):
"""Create a Kibana check object with canned exec_oc method"""
- check = Kibana("dummy") # fails if a module is actually invoked
+ check = Kibana() # fails if a module is actually invoked
if exec_oc:
check._exec_oc = exec_oc
return check
@@ -137,9 +137,9 @@ def test_check_kibana(pods, expect_error):
),
])
def test_get_kibana_url(route, expect_url, expect_error):
- check = canned_kibana(lambda cmd, args, task_vars: json.dumps(route) if route else "")
+ check = canned_kibana(exec_oc=lambda cmd, args: json.dumps(route) if route else "")
- url, error = check._get_kibana_url({})
+ url, error = check._get_kibana_url()
if expect_url:
assert url == expect_url
else:
@@ -169,10 +169,10 @@ def test_get_kibana_url(route, expect_url, expect_error):
),
])
def test_verify_url_internal_failure(exec_result, expect):
- check = Kibana(execute_module=lambda module_name, args, tmp, task_vars: dict(failed=True, msg=exec_result))
- check._get_kibana_url = lambda task_vars: ('url', None)
+ check = Kibana(execute_module=lambda *_: dict(failed=True, msg=exec_result))
+ check._get_kibana_url = lambda: ('url', None)
- error = check._check_kibana_route({})
+ error = check._check_kibana_route()
assert_error(error, expect)
@@ -211,8 +211,8 @@ def test_verify_url_external_failure(lib_result, expect, monkeypatch):
monkeypatch.setattr(urllib2, 'urlopen', urlopen)
check = canned_kibana()
- check._get_kibana_url = lambda task_vars: ('url', None)
- check._verify_url_internal = lambda url, task_vars: None
+ check._get_kibana_url = lambda: ('url', None)
+ check._verify_url_internal = lambda url: None
- error = check._check_kibana_route({})
+ error = check._check_kibana_route()
assert_error(error, expect)