summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/test/ovs_version_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_health_checker/test/ovs_version_test.py')
-rw-r--r--roles/openshift_health_checker/test/ovs_version_test.py37
1 files changed, 12 insertions, 25 deletions
diff --git a/roles/openshift_health_checker/test/ovs_version_test.py b/roles/openshift_health_checker/test/ovs_version_test.py
index dd98ff4d8..14fc6a4ec 100644
--- a/roles/openshift_health_checker/test/ovs_version_test.py
+++ b/roles/openshift_health_checker/test/ovs_version_test.py
@@ -1,26 +1,7 @@
import pytest
-from openshift_checks.ovs_version import OvsVersion, OpenShiftCheckException
-
-
-def test_openshift_version_not_supported():
- def execute_module(*_):
- return {}
-
- openshift_release = '111.7.0'
-
- task_vars = dict(
- openshift=dict(common=dict()),
- openshift_release=openshift_release,
- openshift_image_tag='v' + openshift_release,
- openshift_deployment_type='origin',
- openshift_service_type='origin'
- )
-
- with pytest.raises(OpenShiftCheckException) as excinfo:
- OvsVersion(execute_module, task_vars).run()
-
- assert "no recommended version of Open vSwitch" in str(excinfo.value)
+from openshift_checks.ovs_version import OvsVersion
+from openshift_checks import OpenShiftCheckException
def test_invalid_openshift_release_format():
@@ -66,11 +47,17 @@ def test_ovs_package_version(openshift_release, expected_ovs_version):
return return_value
- result = OvsVersion(execute_module, task_vars).run()
+ check = OvsVersion(execute_module, task_vars)
+ check.openshift_to_ovs_version = {
+ (3, 4): "2.4",
+ (3, 5): ["2.6", "2.7"],
+ (3, 6): ["2.6", "2.7", "2.8"],
+ }
+ result = check.run()
assert result is return_value
-@pytest.mark.parametrize('group_names,is_containerized,is_active', [
+@pytest.mark.parametrize('group_names,openshift_is_containerized,is_active', [
(['oo_masters_to_config'], False, True),
# ensure check is skipped on containerized installs
(['oo_masters_to_config'], True, False),
@@ -82,9 +69,9 @@ def test_ovs_package_version(openshift_release, expected_ovs_version):
(['lb'], False, False),
(['nfs'], False, False),
])
-def test_ovs_version_skip_when_not_master_nor_node(group_names, is_containerized, is_active):
+def test_ovs_version_skip_when_not_master_nor_node(group_names, openshift_is_containerized, is_active):
task_vars = dict(
group_names=group_names,
- openshift=dict(common=dict(is_containerized=is_containerized)),
+ openshift_is_containerized=openshift_is_containerized,
)
assert OvsVersion(None, task_vars).is_active() == is_active