Add support for summary metrics for stablity checks

Also add entrypoints for verifying and updating a test file for easier
debugging. This is considerably faster than running the stablity checks
against the entire Kubernetes codebase.

Change-Id: I5d5e5b3abf396ebf1317a44130f20771a09afb7f
This commit is contained in:
Han Kang
2022-07-25 17:00:28 -07:00
parent 3ffdfbe286
commit e452850ec3
10 changed files with 340 additions and 52 deletions

View File

@@ -539,18 +539,6 @@ func TestIncorrectStableMetricDeclarations(t *testing.T) {
src string
err error
}{
{
testName: "Fail on stable summary metric (Summary is DEPRECATED)",
err: fmt.Errorf("testdata/metric.go:4:9: Stable summary metric is not supported"),
src: `
package test
import "k8s.io/component-base/metrics"
var _ = metrics.NewSummary(
&metrics.SummaryOpts{
StabilityLevel: metrics.STABLE,
},
)
`},
{
testName: "Fail on stable metric with attribute set to unknown variable",
err: fmt.Errorf("testdata/metric.go:6:4: Metric attribute was not correctly set. Please use only global consts in same file"),