You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Helm Unittest时出现“no template associated with gotpl”错误求助

问题排查与解决

问题原因

helm-unittest插件默认只会加载测试文件templates字段中明确指定的模板文件,未被列出的模板不会被预加载。你的测试仅指定了xyz-deployment.yaml,但该模板通过include引用了xyz-configmap.yaml,插件找不到这个未被加载的依赖模板,因此触发报错。

解决方案

在测试文件的templates列表中添加被依赖的xyz-configmap.yaml,确保插件加载该模板:

suite: test xyz deployment
templates:
  - xyz-deployment.yaml
  - xyz-configmap.yaml  # 新增该行,加入被引用的模板文件
tests:
  - it: will not do much yet
    set:
      image.tag: latest
    asserts:
      - isKind:
        of: Deployment

验证

修改完成后重新运行测试命令:

helm unittest xyz

此时插件会同时加载部署模板和配置映射模板,include语句能正常找到目标模板,测试即可正常执行。

内容的提问来源于stack exchange,提问作者Steve H

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 05:52:42