Browse Source

etc_traffic check: factor away short_version

Luke Meyer 7 years ago
parent
commit
0094265fbf

+ 2 - 2
roles/openshift_health_checker/openshift_checks/etcd_traffic.py

@@ -14,8 +14,8 @@ class EtcdTraffic(OpenShiftCheck):
         group_names = self.get_var("group_names", default=[])
         valid_group_names = "etcd" in group_names
 
-        version = self.get_var("openshift", "common", "short_version")
-        valid_version = version in ("3.4", "3.5", "1.4", "1.5")
+        version = self.get_major_minor_version(self.get_var("openshift_image_tag"))
+        valid_version = version in ((3, 4), (3, 5))
 
         return super(EtcdTraffic, self).is_active() and valid_group_names and valid_version
 

+ 2 - 4
roles/openshift_health_checker/test/etcd_traffic_test.py

@@ -8,7 +8,7 @@ from openshift_checks.etcd_traffic import EtcdTraffic
     (['masters'], "3.6", False),
     (['nodes'], "3.4", False),
     (['etcd'], "3.4", True),
-    (['etcd'], "3.5", True),
+    (['etcd'], "1.5", True),
     (['etcd'], "3.1", False),
     (['masters', 'nodes'], "3.5", False),
     (['masters', 'etcd'], "3.5", True),
@@ -17,9 +17,7 @@ from openshift_checks.etcd_traffic import EtcdTraffic
 def test_is_active(group_names, version, is_active):
     task_vars = dict(
         group_names=group_names,
-        openshift=dict(
-            common=dict(short_version=version),
-        ),
+        openshift_image_tag=version,
     )
     assert EtcdTraffic(task_vars=task_vars).is_active() == is_active