K8sReplicationController: adding another test for probe period seconds
@@ -1667,7 +1667,6 @@ class K8sReplicationControllerTest(unittest.TestCase):
def test_probe_period_seconds(self):
data = utils.frontend()
-
rc = ReplicationController(data)
k8s_rc = utils.create_rc(name=rc.metadata.name)
k8s_rc.model = rc
@@ -1682,3 +1681,19 @@ class K8sReplicationControllerTest(unittest.TestCase):
k8s_rc.update()
rc = k8s_rc.get()
self.assertEqual(60, rc.liveness_probes['frontend'].period_seconds)
+
+ def test_probe_period_seconds_with_model(self):
+ data = utils.frontend()
+ rc = ReplicationController(data)
+ k8s_rc = utils.create_rc(name=rc.metadata.name)
+ k8s_rc.model = rc
+ self.assertEqual(1, len(k8s_rc.liveness_probes))
+ self.assertEqual(1, len(k8s_rc.readiness_probes))
+
+ if utils.is_reachable(k8s_rc.config.api_host):
+ k8s_rc.create()
+ liveness = k8s_rc.liveness_probes['frontend']
+ liveness.period_seconds = 60
+ dict = liveness.serialize()
+ container = k8s_rc.containers[0]
+ container.add_liveness_probe(**dict)
