NPD needs significant unit test coverage
维护者通常 1 天内回复
@DigitalVeer 已经在做这个了。
开始于 2026年7月27日。
评估
这个 Issue 还没有评估数据。
描述
We should improve the overall test coverage present in NPD.
Currently, NPD's unit test coverage is 46.0% of 2299 statements. There are important packages, such as the custom plugin monitor, that have close to no test coverage at all.
Recent PRs such as #1322 and #1323 showed real headroom to make NPD faster and memory effecient, and more optimization work like that is worth pursuing. NPD also stands to benefit from agent-assisted development which can help us unlock more performance and reliability improvements over time. This type of work is only safe on top of reliable test infrastructure.
The table below are packages worth targeting in a first round of unit test improvement due to their importance in NPD workloads:
| Package | Coverage | Planned work |
|---|---|---|
pkg/exporters/k8sexporter |
0.0% | export test with the fake problem client |
pkg/exporters/prometheusexporter |
0.0% | export test |
pkg/custompluginmonitor |
0.8% | table test for generateStatus |
pkg/healthchecker |
20.6% | tests for getRepairFunc, getUptimeFunc, checkForPattern |
pkg/systemlogmonitor/logwatchers/journald |
23.2% | tests for the watch loop |
pkg/systemstatsmonitor |
45.2% | fixture test for the OS feature collector |
Every other measured package is in the collapsed table. A lot of the remaining 0% rows are thin wrappers, build-time metadata, or type declarations where a unit test would not help us much immediately.
Full package test coverage
| Package | Coverage |
|---|---|
pkg/exporters/stackdriver/gce |
0.0% |
pkg/systemlogmonitor/logwatchers |
0.0% |
pkg/systemlogmonitor/logwatchers/testing |
0.0% |
pkg/version |
0.0% |
cmd/healthchecker |
0.0% |
cmd/logcounter |
0.0% |
cmd/logcounter/options |
0.0% |
pkg/exporters/stackdriver |
3.3% |
pkg/exporters/k8sexporter/problemclient |
5.4% |
pkg/problemdetector |
23.3% |
cmd/healthchecker/options |
26.5% |
cmd/nodeproblemdetector |
36.4% |
pkg/util/metrics |
44.2% |
pkg/problemdaemon |
45.0% |
pkg/systemlogmonitor |
52.2% |
cmd/options |
55.9% |
pkg/exporters |
56.2% |
pkg/logcounter |
57.9% |
pkg/util |
62.5% |
pkg/systemstatsmonitor/types |
67.6% |
pkg/util/metrics/system |
77.9% |
pkg/systemlogmonitor/logwatchers/filelog |
78.6% |
pkg/exporters/k8sexporter/condition |
78.9% |
pkg/systemlogmonitor/logwatchers/kmsg |
79.7% |
pkg/custompluginmonitor/plugin |
83.5% |
pkg/problemmetrics |
85.3% |
pkg/custompluginmonitor/types |
94.8% |
pkg/healthchecker/types |
95.6% |
pkg/exporters/stackdriver/config |
100.0% |
pkg/util/tomb |
100.0% |
pkg/types |
no tests |
pkg/systemlogmonitor/types |
no tests |
pkg/systemlogmonitor/logwatchers/types |
no tests |
pkg/logcounter/types |
no tests |
cmd/nodeproblemdetector/exporterplugins |
no tests |
cmd/nodeproblemdetector/problemdaemonplugins |
no tests |
The largest gaps exist in the custom plugin monitor, the current exporters, and the health checker, and we should target those first.
/sig node
/kind cleanup
- 主要语言
- Go
- 星标
- 3.5k
- 派生
- 703
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 24
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
kubernetes/node-problem-detector 的其他 Issue
-
难度 4/5 一周以上 新手友好度 15/100
kubernetes/node-problem-detector#1390 ·
维护者通常 1 天内回复
-
Flag --enable-k8s-exporter=false causes loss of /healthz, /conditions, and /debug/pprof endpoints可能已有人在做 @tobiasgiese 于 91 天前认领。 未关闭lifecycle/stale
难度 4/5 3-5 天 新手友好度 56/100
kubernetes/node-problem-detector#1332 · 1 条评论 ·
维护者通常 1 天内回复
-
kind/cleanup lifecycle/stale sig/node
难度 5/5 一周以上 新手友好度 45/100
kubernetes/node-problem-detector#1331 · 1 条评论 ·
维护者通常 1 天内回复
-
kind/bug lifecycle/stale
难度 3/5 1-2 天 新手友好度 58/100
kubernetes/node-problem-detector#1176 · 8 条评论 ·
维护者通常 1 天内回复
-
kind/feature lifecycle/frozen
难度 5/5 一周以上 新手友好度 35/100
kubernetes/node-problem-detector#1112 · 8 条评论 ·
维护者通常 1 天内回复
查看 kubernetes/node-problem-detector 的全部 Issue
相似的 Issue
-
needs-area
难度 2/5 1-3 小时 新手友好度 68/100
Azure/typespec-azure#5936 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 72/100
github/gh-actions-lock#261 ·
维护者通常 1 天内回复
-
bug documentation
难度 2/5 1-3 小时 新手友好度 72/100
labmonkeys-space/nl6#974 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100