@@ -73,7 +73,10 @@ func BenchmarkKubeStateMetrics(b *testing.B) {
7373
7474 builder := store .NewBuilder ()
7575 builder .WithMetrics (reg )
76- builder .WithEnabledResources (options .DefaultResources .AsSlice ())
76+ err := builder .WithEnabledResources (options .DefaultResources .AsSlice ())
77+ if err != nil {
78+ b .Fatal (err )
79+ }
7780 builder .WithKubeClient (kubeClient )
7881 builder .WithSharding (0 , 1 )
7982 builder .WithContext (ctx )
@@ -118,7 +121,10 @@ func BenchmarkKubeStateMetrics(b *testing.B) {
118121
119122 b .StopTimer ()
120123 buf := bytes.Buffer {}
121- buf .ReadFrom (resp .Body )
124+ _ , err := buf .ReadFrom (resp .Body )
125+ if err != nil {
126+ b .Fatal (err )
127+ }
122128 accumulatedContentLength += buf .Len ()
123129 b .StartTimer ()
124130 }
@@ -144,7 +150,10 @@ func TestFullScrapeCycle(t *testing.T) {
144150 reg := prometheus .NewRegistry ()
145151 builder := store .NewBuilder ()
146152 builder .WithMetrics (reg )
147- builder .WithEnabledResources (options .DefaultResources .AsSlice ())
153+ err = builder .WithEnabledResources (options .DefaultResources .AsSlice ())
154+ if err != nil {
155+ t .Fatal (err )
156+ }
148157 builder .WithKubeClient (kubeClient )
149158 builder .WithNamespaces (options .DefaultNamespaces , "" )
150159 builder .WithGenerateStoresFunc (builder .DefaultGenerateStoresFunc ())
@@ -428,7 +437,10 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
428437 reg := prometheus .NewRegistry ()
429438 unshardedBuilder := store .NewBuilder ()
430439 unshardedBuilder .WithMetrics (reg )
431- unshardedBuilder .WithEnabledResources (options .DefaultResources .AsSlice ())
440+ err = unshardedBuilder .WithEnabledResources (options .DefaultResources .AsSlice ())
441+ if err != nil {
442+ t .Fatal (err )
443+ }
432444 unshardedBuilder .WithKubeClient (kubeClient )
433445 unshardedBuilder .WithNamespaces (options .DefaultNamespaces , "" )
434446 unshardedBuilder .WithFamilyGeneratorFilter (l )
@@ -441,7 +453,10 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
441453 regShard1 := prometheus .NewRegistry ()
442454 shardedBuilder1 := store .NewBuilder ()
443455 shardedBuilder1 .WithMetrics (regShard1 )
444- shardedBuilder1 .WithEnabledResources (options .DefaultResources .AsSlice ())
456+ err = shardedBuilder1 .WithEnabledResources (options .DefaultResources .AsSlice ())
457+ if err != nil {
458+ t .Fatal (err )
459+ }
445460 shardedBuilder1 .WithKubeClient (kubeClient )
446461 shardedBuilder1 .WithNamespaces (options .DefaultNamespaces , "" )
447462 shardedBuilder1 .WithFamilyGeneratorFilter (l )
@@ -454,7 +469,10 @@ func TestShardingEquivalenceScrapeCycle(t *testing.T) {
454469 regShard2 := prometheus .NewRegistry ()
455470 shardedBuilder2 := store .NewBuilder ()
456471 shardedBuilder2 .WithMetrics (regShard2 )
457- shardedBuilder2 .WithEnabledResources (options .DefaultResources .AsSlice ())
472+ err = shardedBuilder2 .WithEnabledResources (options .DefaultResources .AsSlice ())
473+ if err != nil {
474+ t .Fatal (err )
475+ }
458476 shardedBuilder2 .WithKubeClient (kubeClient )
459477 shardedBuilder2 .WithNamespaces (options .DefaultNamespaces , "" )
460478 shardedBuilder2 .WithFamilyGeneratorFilter (l )
@@ -591,7 +609,11 @@ func TestCustomResourceExtension(t *testing.T) {
591609 builder := store .NewBuilder ()
592610 builder .WithCustomResourceStoreFactories (factories ... )
593611 builder .WithMetrics (reg )
594- builder .WithEnabledResources (resources )
612+ err := builder .WithEnabledResources (resources )
613+ if err != nil {
614+ t .Fatal (err )
615+ }
616+
595617 builder .WithKubeClient (kubeClient )
596618 builder .WithCustomResourceClients (customResourceClients )
597619 builder .WithNamespaces (options .DefaultNamespaces , "" )
0 commit comments