'Test get_check_tpls for kubernetes annotations'

@mock.patch('config.get_auto_confd_path', return_value=os.path.join(os.path.dirname(__file__), 'fixtures/auto_conf/'))
@mock.patch.object(AbstractConfigStore, 'client_read', side_effect=client_read)
def test_get_check_tpls_kube(self, *args):

    valid_config = ['image_0', 'image_1', 'image_2', 'image_3', 'image_4']
    invalid_config = ['bad_image_0']
    config_store = get_config_store(self.auto_conf_agentConfig)
    for image in (valid_config + invalid_config):
        tpl = self.mock_raw_templates.get(image)[1]
        tpl = [(CONFIG_FROM_KUBE, t[1]) for t in tpl]
        if tpl:
            self.assertNotEquals(tpl, config_store.get_check_tpls(('k8s-' + image), auto_conf=True))
        self.assertEquals(tpl, config_store.get_check_tpls(('k8s-' + image), auto_conf=True, kube_pod_name=image, kube_container_name='foo', kube_annotations=dict(zip(['service-discovery.datadoghq.com/foo.check_names', 'service-discovery.datadoghq.com/foo.init_configs', 'service-discovery.datadoghq.com/foo.instances'], self.mock_raw_templates[image][0]))))
