The Kubernetes executor has surprisingly low test coverage: 64% 

https://codecov.io/gh/apache/airflow/src/master/airflow/executors/kubernetes_executor.py - looks like some of the "flush/end" code is not tested.

We might want to improve it.
tests/executors/test_kubernetes_executor.py
"""We try to find pods only once per scheduler id"""
        executor = self.kubernetes_executor
        mock_kube_client = mock.MagicMock()
        executor.kube_client = mock_kube_client
        mock_tis = [
            mock.MagicMock(queued_by_job_id="10", external_executor_id="1", dag_id="dag", task_id="task"),
            mock.MagicMock(queued_by_job_id="40", external_executor_id="1", dag_id="dag", task_id="task2"),
            mock.MagicMock(queued_by_job_id="40", external_executor_id="1", dag_id="dag", task_id="task3"),
        ]
        executor.try_adopt_task_instances(mock_tis)
        assert mock_kube_client.list_namespaced_pod.call_count == 2
        mock_kube_client.list_namespaced_pod.assert_has_calls(
            [
                mock.call(namespace='default', label_selector='airflow-worker=10'),
                mock.call(namespace='default', label_selector='airflow-worker=40'),
            ],
            any_order=True,
        )
    @mock.patch('airflow.executors.kubernetes_executor.KubernetesExecutor.adopt_launched_task')
    @mock.patch('airflow.executors.kubernetes_executor.KubernetesExecutor._adopt_completed_pods')
    def test_try_adopt_task_instances_no_matching_pods(