Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all linter warnings #15684

Merged
merged 35 commits into from
Jan 14, 2025
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
44db34c
add updated linter config
dprotaso Jan 11, 2025
4bd06eb
fix whitespace linting
dprotaso Jan 11, 2025
3844255
fix usestdlibvars linter
dprotaso Jan 11, 2025
cc2fd64
fix lint wastedassign
dprotaso Jan 11, 2025
8cc3257
address unparam linter - container concurrency wasn't being used when…
dprotaso Jan 11, 2025
e0cc35f
fix tenv linter
dprotaso Jan 11, 2025
3cb7a71
fix stylecheck linter
dprotaso Jan 11, 2025
65009c6
fix staticheck linter
dprotaso Jan 11, 2025
b0ce4af
fix perfsprint linter
dprotaso Jan 11, 2025
c716660
fix nosprintfhostport
dprotaso Jan 11, 2025
9afcee8
f perfsprint
dprotaso Jan 11, 2025
8d648ec
fix nolintlint - remove nolint directives that had no effect
dprotaso Jan 11, 2025
ca7f5e3
fix noctx linter
dprotaso Jan 11, 2025
153a53b
fix gomodguard linter - drop uber atomic package
dprotaso Jan 11, 2025
0d7e578
fix nilerr linter
dprotaso Jan 11, 2025
b26986f
fix mirror linter
dprotaso Jan 11, 2025
a22fa3b
fix loggercheck linter
dprotaso Jan 11, 2025
7cdf82a
fix govet linter
dprotaso Jan 11, 2025
74d8600
fix gosimple linter
dprotaso Jan 11, 2025
a06abbc
fix gosec linter
dprotaso Jan 12, 2025
a72a657
fix unconvert linter
dprotaso Jan 12, 2025
d2f37ed
fix perfsprint linter
dprotaso Jan 12, 2025
ff89cc0
fix errname linter
dprotaso Jan 12, 2025
3900cd3
fix errlint linter
dprotaso Jan 12, 2025
85df3e0
fix bodyclose linter
dprotaso Jan 12, 2025
129b481
fix canonicalheader linter
dprotaso Jan 12, 2025
73166ef
fix durationcheck linter
dprotaso Jan 12, 2025
f052fba
fix copyloopvar linter
dprotaso Jan 12, 2025
663dd2e
fix fatcontext linter
dprotaso Jan 12, 2025
c6b9012
fix gocritic-commentFormatting
dprotaso Jan 12, 2025
16d836d
fix gocritic linter
dprotaso Jan 13, 2025
18ea7bd
fix intrange linter
dprotaso Jan 13, 2025
f8e8ba7
fix prealloc linter
dprotaso Jan 13, 2025
b6a3c38
fix flakey kpa test
dprotaso Jan 13, 2025
86b4390
fix gofumpt linter
dprotaso Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions pkg/reconciler/autoscaling/kpa/kpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ func TestMetricsReporter(t *testing.T) {
metricstest.IntMetric("pending_pods", 1996, nil).WithResource(wantResource),
metricstest.IntMetric("terminating_pods", 1983, nil).WithResource(wantResource),
}
metricstest.AssertMetric(t, wantMetrics...)
assertMetric(t, wantMetrics)

// Verify `want` is ignored, when it is equal to -1.
pc.want = -1
Expand All @@ -1888,7 +1888,26 @@ func TestMetricsReporter(t *testing.T) {
metricstest.IntMetric("pending_pods", 1996, nil).WithResource(wantResource),
metricstest.IntMetric("terminating_pods", 1955, nil).WithResource(wantResource),
}
metricstest.AssertMetric(t, wantMetrics...)
assertMetric(t, wantMetrics)
}

// We don't use metricstest.AssertMetrics because it doesn't filter resources properly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we open an issue to fix metricstest.AssertMetrics?

func assertMetric(t *testing.T, values []metricstest.Metric) {
t.Helper()
metricstest.EnsureRecorded()
outer:
for _, v := range values {
metrics := metricstest.GetMetric(v.Name)
for _, m := range metrics {
if cmp.Equal(m.Resource, v.Resource) {
if diff := cmp.Diff(v, m); diff != "" {
t.Error("Wrong metric (-want +got):", diff)
}
continue outer
}
}
t.Fatal("unable to find metrics with name and resource", v.Name, v.Resource)
}
}

func TestResolveScrapeTarget(t *testing.T) {
Expand Down