Modernize lib/auth and lib/utils (#55976)

This commit is contained in:
Zac Bergquist
2025-06-22 10:53:52 +00:00
committed by GitHub
parent 6e8041453e
commit ff374ff7fd
136 changed files with 599 additions and 731 deletions
+3 -5
View File
@@ -18,7 +18,6 @@
package sortcache
import (
"context"
"slices"
"strconv"
"testing"
@@ -319,7 +318,7 @@ func BenchmarkSortCache(b *testing.B) {
cache.Put(r2)
// seed cache with lots of additional resources to help simulate large reads
for i := 0; i < resourcesPerKind-1; i++ {
for i := range resourcesPerKind - 1 {
cache.Put(resource{
kind: "node",
name: strconv.Itoa(i),
@@ -333,8 +332,7 @@ func BenchmarkSortCache(b *testing.B) {
// set up a background process to inject concurrent writes in a fairly
// tight loop (should roughly simulate the load generated by a background
// event stream injecting updates into a replica).
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := b.Context()
go func() {
for {
if ctx.Err() != nil {
@@ -346,7 +344,7 @@ func BenchmarkSortCache(b *testing.B) {
}()
// set up a bunch of background concurrent read operations to simulate load.
for i := 0; i < concurrency; i++ {
for range concurrency {
go func() {
var n int
buf := make([]resource, 0, resourcesPerKind)