summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/test/etcd_volume_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/etcd_volume_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/etcd_volume_test.py')
-rw-r--r--roles/openshift_health_checker/test/etcd_volume_test.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/roles/openshift_health_checker/test/etcd_volume_test.py b/roles/openshift_health_checker/test/etcd_volume_test.py
index 917045526..0b255136e 100644
--- a/roles/openshift_health_checker/test/etcd_volume_test.py
+++ b/roles/openshift_health_checker/test/etcd_volume_test.py
@@ -11,10 +11,9 @@ def test_cannot_determine_available_disk(ansible_mounts, extra_words):
task_vars = dict(
ansible_mounts=ansible_mounts,
)
- check = EtcdVolume(execute_module=fake_execute_module)
with pytest.raises(OpenShiftCheckException) as excinfo:
- check.run(tmp=None, task_vars=task_vars)
+ EtcdVolume(fake_execute_module, task_vars).run()
for word in 'Unable to find etcd storage mount point'.split() + extra_words:
assert word in str(excinfo.value)
@@ -76,8 +75,7 @@ def test_succeeds_with_recommended_disk_space(size_limit, ansible_mounts):
if task_vars["etcd_device_usage_threshold_percent"] is None:
task_vars.pop("etcd_device_usage_threshold_percent")
- check = EtcdVolume(execute_module=fake_execute_module)
- result = check.run(tmp=None, task_vars=task_vars)
+ result = EtcdVolume(fake_execute_module, task_vars).run()
assert not result.get('failed', False)
@@ -137,8 +135,7 @@ def test_fails_with_insufficient_disk_space(size_limit_percent, ansible_mounts,
if task_vars["etcd_device_usage_threshold_percent"] is None:
task_vars.pop("etcd_device_usage_threshold_percent")
- check = EtcdVolume(execute_module=fake_execute_module)
- result = check.run(tmp=None, task_vars=task_vars)
+ result = EtcdVolume(fake_execute_module, task_vars).run()
assert result['failed']
for word in extra_words: