diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-06-16 17:24:01 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-07-25 13:23:58 -0400 |
commit | 210fc2d3849a1baf9c1d8535044d92df23424274 (patch) | |
tree | 20b6998ca0696257eb816e4ace464ee95b926816 /roles/openshift_health_checker/test/memory_availability_test.py | |
parent | 2a0936b291992ba1b7343680aec915df0c29892c (diff) | |
download | openshift-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/memory_availability_test.py')
-rw-r--r-- | roles/openshift_health_checker/test/memory_availability_test.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/roles/openshift_health_checker/test/memory_availability_test.py b/roles/openshift_health_checker/test/memory_availability_test.py index 4fbaea0a9..aee2f0416 100644 --- a/roles/openshift_health_checker/test/memory_availability_test.py +++ b/roles/openshift_health_checker/test/memory_availability_test.py @@ -17,7 +17,7 @@ def test_is_active(group_names, is_active): task_vars = dict( group_names=group_names, ) - assert MemoryAvailability.is_active(task_vars=task_vars) == is_active + assert MemoryAvailability(None, task_vars).is_active() == is_active @pytest.mark.parametrize('group_names,configured_min,ansible_memtotal_mb', [ @@ -59,8 +59,7 @@ def test_succeeds_with_recommended_memory(group_names, configured_min, ansible_m ansible_memtotal_mb=ansible_memtotal_mb, ) - check = MemoryAvailability(execute_module=fake_execute_module) - result = check.run(tmp=None, task_vars=task_vars) + result = MemoryAvailability(fake_execute_module, task_vars).run() assert not result.get('failed', False) @@ -117,8 +116,7 @@ def test_fails_with_insufficient_memory(group_names, configured_min, ansible_mem ansible_memtotal_mb=ansible_memtotal_mb, ) - check = MemoryAvailability(execute_module=fake_execute_module) - result = check.run(tmp=None, task_vars=task_vars) + result = MemoryAvailability(fake_execute_module, task_vars).run() assert result.get('failed', False) for word in 'below recommended'.split() + extra_words: |