def test_pod_conditions_pod_without_node(self) -> None:
     last_transition_time = datetime.datetime(2021,
                                              10,
                                              29,
                                              9,
                                              5,
                                              52,
                                              tzinfo=tzutc())
     pod_condition_list = [
         client.V1PodCondition(
             last_probe_time=None,
             last_transition_time=last_transition_time,
             message="0/1 nodes are available: 1 Too many pods.",
             reason="Unschedulable",
             status="False",
             type="PodScheduled",
         )
     ]
     self.assertEqual(
         pod_conditions(pod_condition_list),
         [
             api.PodCondition(
                 status=False,
                 type=api.ConditionType.PODSCHEDULED,
                 custom_type=None,
                 reason="Unschedulable",
                 detail="0/1 nodes are available: 1 Too many pods.",
                 last_transition_time=convert_to_timestamp(
                     last_transition_time),
             )
         ],
     )
Esempio n. 2
0
 def test_parse_conditions(self, core_client, dummy_host):
     node_with_conditions = {
         "items": [
             {
                 "status": {
                     "conditions": [
                         {
                             "type": "Ready",
                             "status": "False",
                             "reason": None,
                             "message": None,
                             "lastTransitionTime": "2021-10-08T07:39:10Z",
                         },
                     ],
                 },
             },
         ],
     }
     Entry.single_register(
         Entry.GET,
         f"{dummy_host}/api/v1/pods",
         body=json.dumps(node_with_conditions),
         headers={"content-type": "application/json"},
     )
     with Mocketizer():
         pod = list(core_client.list_pod_for_all_namespaces().items)[0]
     condition = pod_conditions(pod.status.conditions)[0]
     assert condition.detail is None
     assert condition.status is False
     assert condition.detail is None
     assert condition.type == api.ConditionType.READY