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
from unittest import mock
import pytest
from kubernetes.client import models as k8s
from urllib3 import HTTPResponse
from airflow.utils import timezone
from tests.test_utils.config import conf_vars
try:
    from kubernetes.client.rest import ApiException
    from airflow.executors.kubernetes_executor import (
        AirflowKubernetesScheduler,
        KubernetesExecutor,
        KubernetesJobWatcher,
        create_pod_id,
        get_base_pod_from_template,
    )
    from airflow.kubernetes import pod_generator
    from airflow.kubernetes.kubernetes_helper_functions import annotations_to_key
    from airflow.kubernetes.pod_generator import PodGenerator, datetime_to_label_safe_datestring
    from airflow.utils.state import State
except ImportError:
    AirflowKubernetesScheduler = None  
class TestAirflowKubernetesScheduler(unittest.TestCase):
    @staticmethod
    def _gen_random_string(seed, str_len):
        char_list = []
        for char_seed in range(str_len):
            random.seed(str(seed) * char_seed)
            char_list.append(random.choice(string.printable))
        return ''.join(char_list)
    def _cases(self):