ronantakizawa/codereview-bench huggingface dataset:
Repository: kubernetes/kubernetes
File: test/images/agnhost/porter/porter.go (Go)

Code before:
	sock, err := net.ListenUDP("udp", addr)
	if err != nil {
		log.Fatalf("UDP: failed to listen on port %s: %v", port, err)
	}
	defer func() {
		if err := sock.Close(); err != nil {
			log.Printf("Error closing UDP socket: %v", err)
		}
	}()

	log.Printf("Started UDP server on port %s", port)
	buf := make([]byte, 16)

	for {
		_, cliAddr, err := sock.ReadFrom(buf)
		if err != nil {
			log.Printf("UDP: error from ReadFrom(): %v", err)
			return
		}
		if _, err := sock.WriteTo([]byte(value), cliAddr); err != nil {
			log.Printf("UDP: error from WriteTo(): %v", err)
		}
	}
}

func serveTLSPort(port, value string) {
	s := &http.Server{
		Addr: "0.0.0.0:" + port,
		Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			body := value
			if JSONResponse {
				j, err := json.Marshal(&jsonResponse{
					Method: r.Method,
					Body:   value})
				if err != nil {
					http.Error(w, fmt.Sprintf("Internal Server Error: %v", err), 500)
					return
				}
				w.Header().Set("Content-Type", "application/json")
				body = string(j)
			}
			fmt.Fprint(w, body)
		}),
	}
	certFile := os.Getenv("CERT_FILE")
	if len(certFile) == 0 {
		certFile = "localhost.crt"
	}
	keyFile := os.Getenv("KEY_FILE")
	if len(keyFile) == 0 {
		keyFile = "localhost.key"

Review comment (suggestion):
in all the other code we spawn a goroutine to process each collection and not block on the write, I think it does not matter for udp because is fire and forget but I just want to double check if this is on purpose

Code after:
	sock, err := net.ListenUDP("udp", addr)
	if err != nil {
		log.Fatalf("UDP: failed to listen on port %s: %v", port, err)
	}
	defer func() {
		if err := sock.Close(); err != nil {
			log.Printf("Error closing UDP socket: %v", err)
		}
	}()
	log.Printf("Started UDP server on port %s", port)

	payload := []byte(value)
	buf := make([]byte, 16)

	for {
		_, cliAddr, err := sock.ReadFrom(buf)
		if err != nil {
			log.Printf("UDP: error from ReadFrom(): %v", err)
			return
		}
		go func(targetAddr net.Addr) {
			if _, err := sock.WriteTo(payload, targetAddr); err != nil {
				log.Printf("UDP: error from WriteTo(): %v", err)
			}
		}(cliAddr)
	}
}

func serveTLSPort(port, value string) {
	s := &http.Server{
		Addr: "0.0.0.0:" + port,
		Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			body := value
			if JSONResponse {
				j, err := json.Marshal(&jsonResponse{
					Method: r.Method,
					Body:   value})
				if err != nil {
					http.Error(w, fmt.Sprintf("Internal Server Error: %v", err), 500)
					return
				}
				w.Header().Set("Content-Type", "application/json")
				body = string(j)
			}
			fmt.Fprint(w, body)
		}),
	}
	certFile := os.Getenv("CERT_FILE")
	if len(certFile) == 0 {
		certFile = "localhost.crt"
	}
Repository: kubernetes/kubernetes
File: pkg/registry/batch/cronjob/declarative_validation_test.go (Go)

Code before:
	}
}

func mkCronJob(mutators ...func(*batch.CronJob)) batch.CronJob {
	job := batch.CronJob{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "test-class",
			Namespace: "test-namespace",
		},
		Spec: validCronjobSpec,
	}

	for _, mutate := range mutators {
		mutate(&job)
	}

	return job
}

func tweakSchedule(schedule string) func(*batch.CronJob) {
	return func(job *batch.CronJob) {
		job.Spec.Schedule = schedule
	}
}

func tweakResourceVersion(version string) func(*batch.CronJob) {
	return func(job *batch.CronJob) {
		job.ObjectMeta.ResourceVersion = version
	}
}


Review comment (suggestion):
I'm not sure a resource version tweak is necessary here - I think you can get away with moving the resourceVersion to test like
https://github.com/kubernetes/kubernetes/blob/2a3a6605ac9b184711ef212ecbe26c8af4a8bac8/pkg/registry/resource/resourceclaim/declarative_validation_test.go#L796-L797
Similar to [this](https://github.com/kubernetes/kubernetes/pull/135890#discussion_r2651885721) review


Code after:
			apitesting.VerifyUpdateValidationEquivalence(t, ctx, &tc.update, &tc.old, Strategy.ValidateUpdate, tc.expectedErrs)
		})
	}
}

func mkCronJob(mutators ...func(*batch.CronJob)) batch.CronJob {
	job := batch.CronJob{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "test-class",
			Namespace: "test-namespace",
		},
		Spec: validCronjobSpec,
	}

	for _, mutate := range mutators {
		mutate(&job)
	}

	return job
}

func tweakSchedule(schedule string) func(*batch.CronJob) {
	return func(job *batch.CronJob) {
		job.Spec.Schedule = schedule
	}
}
Repository: kubernetes/kubernetes
File: pkg/scheduler/backend/queue/scheduling_queue_test.go (Go)

Code before:
				{nil},
				{nil},
				{nil},
			},
			expectedMetric: 0,
		},
		{
			name: "Unschedulable pods metric must be 0 after pod is gated and then deleted",
			operations: []operation{
				updatePluginToGateAllPods,
				add,
				moveAllToActiveOrBackoffQ,
				moveAllToActiveOrBackoffQ,
				deletePod,
			},
			operands: [][]*framework.QueuedPodInfo{
				{nil},
				pInfos[:1],
				{nil},
				{nil},
				pInfos[:1],
			},
			expectedMetric: 0,
		},
		{
			name: "Unschedulable pods metric must be 1 after pod is gated multiple time by simillar plugin",
			operations: []operation{
				updatePluginToGateAllPods,
				add,
				moveAllToActiveOrBackoffQ,
				moveAllToActiveOrBackoffQ,
			},
			operands: [][]*framework.QueuedPodInfo{
				{nil},
				pInfos[:1],
				{nil},
				{nil},
			},
			expectedMetric: 1,
		},
		{
			name: "Unshedulable pods metric must be 0 after non gated pods is added and then deleted",
			operations: []operation{
				add,
				deletePod,
			},
			operands: [][]*framework.QueuedPodInfo{
				pInfos[:1],
				pInfos[:1],
			},
			expectedMetric: 0,

Review comment (suggestion):
```suggestion
			name: "Unschedulable pods metric must be 1 after pod is gated multiple time by the same plugin",
```

Code after:

	pluginName1 := "plugin1"
	pluginName2 := "plugin2"
	queueable := "queueable"
	timestamp := time.Now()
	pod := &framework.QueuedPodInfo{
		PodInfo: mustNewPodInfo(
			st.MakePod().Name("podA").Namespace("namespaceA").Label(queueable, "").UID("someUid").Obj()),
		Timestamp:            timestamp,
		UnschedulablePlugins: sets.New[string](),
	}

	resetMetrics := func() {
		metrics.UnschedulableReason(pluginName1, "").Set(0)
		metrics.UnschedulableReason(pluginName2, "").Set(0)
	}

	makeGated := func(pInfo *framework.QueuedPodInfo) *framework.QueuedPodInfo {
		return setQueuedPodInfoGated(pInfo.DeepCopy(), pluginName1, []fwk.ClusterEvent{framework.EventUnschedulableTimeout})
	}

	tests := []struct {
		name            string
		steps           []step
		expectedMetrics []int
	}{
		{
			name: "Unschedulable pods metric must be 0 after a pod is gated, ungated, re-queued, and eventually popped from the scheduling queue",
			steps: []step{
				updatePluginAllowList(pluginName1, []string{}),
				addPod(pod),
				moveAllToActiveOrBackoffQ(),
				updatePluginAllowList(pluginName1, []string{queueable}),
				moveAllToActiveOrBackoffQ(),
				popPod(),
			},
			expectedMetrics: []int{0, 0},
		},
		{
			name: "Unschedulable pods metric must be 0 after pod is gated and then deleted",
			steps: []step{
				updatePluginAllowList(pluginName1, []string{}),
				addPod(pod),
				moveAllToActiveOrBackoffQ(),
				deletePod(pod),
			},
			expectedMetrics: []int{0, 0},
		},
		{
			name: "Unschedulable pods metric must be 1 after pod is gated multiple time by the same plugin",
			steps: []step{
Repository: kubernetes/kubernetes
File: pkg/scheduler/backend/queue/scheduling_queue_test.go (Go)

Code before:
				{nil},
				pInfos[:1],
				{nil},
				{nil},
				pInfos[:1],
			},
			expectedMetric: 0,
		},
		{
			name: "Unschedulable pods metric must be 1 after pod is gated multiple time by simillar plugin",
			operations: []operation{
				updatePluginToGateAllPods,
				add,
				moveAllToActiveOrBackoffQ,
				moveAllToActiveOrBackoffQ,
			},
			operands: [][]*framework.QueuedPodInfo{
				{nil},
				pInfos[:1],
				{nil},
				{nil},
			},
			expectedMetric: 1,
		},
		{
			name: "Unshedulable pods metric must be 0 after non gated pods is added and then deleted",
			operations: []operation{
				add,
				deletePod,
			},
			operands: [][]*framework.QueuedPodInfo{
				pInfos[:1],
				pInfos[:1],
			},
			expectedMetric: 0,
		},
		{
			name: "Unschedulable pods metric should not be duplicate if gated pods added and then gated with the same plugin again",
			operations: []operation{
				updatePluginToGateAllPods,
				add,
				moveAllToActiveOrBackoffQ,
			},
			operands: [][]*framework.QueuedPodInfo{
				{nil},
				makeGated(pInfos[:10]),
				{nil},
			},
			expectedMetric: 10,
		},
	}

Review comment (suggestion):
```suggestion
			name: "Unschedulable pods metric must be 0 after non gated pods is added and then deleted",
```

Code after:

	makeGated := func(pInfo *framework.QueuedPodInfo) *framework.QueuedPodInfo {
		return setQueuedPodInfoGated(pInfo.DeepCopy(), pluginName1, []fwk.ClusterEvent{framework.EventUnschedulableTimeout})
	}

	tests := []struct {
		name            string
		steps           []step
		expectedMetrics []int
	}{
		{
			name: "Unschedulable pods metric must be 0 after a pod is gated, ungated, re-queued, and eventually popped from the scheduling queue",
			steps: []step{
				updatePluginAllowList(pluginName1, []string{}),
				addPod(pod),
				moveAllToActiveOrBackoffQ(),
				updatePluginAllowList(pluginName1, []string{queueable}),
				moveAllToActiveOrBackoffQ(),
				popPod(),
			},
			expectedMetrics: []int{0, 0},
		},
		{
			name: "Unschedulable pods metric must be 0 after pod is gated and then deleted",
			steps: []step{
				updatePluginAllowList(pluginName1, []string{}),
				addPod(pod),
				moveAllToActiveOrBackoffQ(),
				deletePod(pod),
			},
			expectedMetrics: []int{0, 0},
		},
		{
			name: "Unschedulable pods metric must be 1 after pod is gated multiple time by the same plugin",
			steps: []step{
				updatePluginAllowList(pluginName1, []string{}),
				addPod(pod),
				moveAllToActiveOrBackoffQ(),
			},
			expectedMetrics: []int{1, 0},
		},
		{
			name: "Unschedulable pods metric must be 0 after non gated pods is added and then deleted",
			steps: []step{
				addPod(pod),
				deletePod(pod),
			},
			expectedMetrics: []int{0, 0},
		},
		{
			name: "Unschedulable pods metric should not be duplicate if gated pods added and then gated with the same plugin again",
Repository: kubernetes/kubernetes
File: staging/src/k8s.io/client-go/tools/cache/controller.go (Go)

Code before:

// Multiplexes updates in the form of a list of Deltas into a Store, and informs
// a given handler of events OnUpdate, OnAdd, OnDelete
func processDeltas(
	// Object which receives event notifications from the given deltas
	handler ResourceEventHandler,
	clientState Store,
	deltas Deltas,
	isInInitialList bool,
	keyFunc KeyFunc,
) error {
	// from oldest to newest
	for _, d := range deltas {
		obj := d.Object

		switch d.Type {
		case ReplacedList:
			info, ok := obj.(ReplacedListInfo)
			if !ok {
				return fmt.Errorf("ReplacedList did not contain ReplacedListInfo: %T", obj)
			}
			if err := processReplacedListInfo(handler, info, clientState, keyFunc); err != nil {
				return err
			}
		case ResyncAtomic:
			if err := processAtomicSync(handler, clientState); err != nil {
				return err
			}
		case Sync, Replaced, Added, Updated:
			if old, exists, err := clientState.Get(obj); err == nil && exists {
				if err := clientState.Update(obj); err != nil {
					return err
				}
				handler.OnUpdate(old, obj)
			} else {
				if err := clientState.Add(obj); err != nil {
					return err
				}
				handler.OnAdd(obj, isInInitialList)
			}
		case Deleted:
			if err := clientState.Delete(obj); err != nil {
				return err
			}
			handler.OnDelete(obj)
		}
	}
	return nil
}

// processDeltasInBatch applies a batch of Delta objects to the given Store and

Review comment (suggestion):
`processAtomicSync` is only called from here ... inlining this would only take one additional line and would make this simpler to read

Code after:

// Multiplexes updates in the form of a list of Deltas into a Store, and informs
// a given handler of events OnUpdate, OnAdd, OnDelete
func processDeltas(
	// Object which receives event notifications from the given deltas
	handler ResourceEventHandler,
	clientState Store,
	deltas Deltas,
	isInInitialList bool,
	keyFunc KeyFunc,
) error {
	// from oldest to newest
	for _, d := range deltas {
		obj := d.Object

		switch d.Type {
		case ReplacedAll:
			info, ok := obj.(ReplacedAllInfo)
			if !ok {
				return fmt.Errorf("ReplacedAll did not contain ReplacedAllInfo: %T", obj)
			}
			if err := processReplacedAllInfo(handler, info, clientState, isInInitialList, keyFunc); err != nil {
				return err
			}
		case SyncAll:
			_, ok := obj.(SyncAllInfo)
			if !ok {
				return fmt.Errorf("SyncAll did not contain SyncAllInfo: %T", obj)
			}
			objs := clientState.List()
			for _, obj := range objs {
				handler.OnUpdate(obj, obj)
			}
			return nil
		case Sync, Replaced, Added, Updated:
			if old, exists, err := clientState.Get(obj); err == nil && exists {
				if err := clientState.Update(obj); err != nil {
					return err
				}
				handler.OnUpdate(old, obj)
			} else {
				if err := clientState.Add(obj); err != nil {
					return err
				}
				handler.OnAdd(obj, isInInitialList)
			}
		case Deleted:
			if err := clientState.Delete(obj); err != nil {
				return err
			}
			handler.OnDelete(obj)
Repository: kubernetes/kubernetes
File: test/e2e/common/node/image_volume.go (Go)

Code before:
/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package node

import (
	"context"
	"fmt"
	"path/filepath"

	"github.com/onsi/ginkgo/v2"
	"github.com/onsi/gomega"
	"github.com/opencontainers/selinux/go-selinux"
	v1 "k8s.io/api/core/v1"

Review comment (security):
nit: remove year from here

```suggestion
Copyright The Kubernetes Authors.
```

Code after:
/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package node

import (
	"context"
	"fmt"
	"path/filepath"

	"github.com/onsi/ginkgo/v2"
	"github.com/onsi/gomega"
	"github.com/opencontainers/selinux/go-selinux"
	v1 "k8s.io/api/core/v1"
Repository: kubernetes/kubernetes
File: cmd/kubelet/app/server_test.go (Go)

Code before:
				APIVersion: "kubelet.config.k8s.io/v1beta1",
			},
			Port: int32(9090),
		}

		kubeletConfDir := filepath.Join(tempDir, "kubelet.conf.d")
		err := os.Mkdir(kubeletConfDir, 0755)
		require.NoError(t, err, "Failed to create kubelet.conf.d directory")

		// Create a .conf file with malformed YAML (invalid indentation and syntax)
		malformedYAML := `
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
port: [this is not valid
  indentation is wrong
    more indentation
`
		err = os.WriteFile(filepath.Join(kubeletConfDir, "10-malformed.conf"), []byte(malformedYAML), 0644)
		require.NoError(t, err, "failed to create malformed conf file")

		// Merge the kubelet configurations - should fail
		ctx := context.Background()
		err = mergeKubeletConfigurations(ctx, kubeletConfig, kubeletConfDir)
		require.Error(t, err, "merge should fail with malformed YAML")
		require.Contains(t, err.Error(), "10-malformed.conf", "error should mention the problematic file")
	})
}


Review comment (suggestion):
Would it make sense to use multiple test cases and one test run to avoid code duplication, for example https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_getters_test.go#L137-L287


Code after:
				// Verify skipped files if expected
				if len(test.expectedSkippedFiles) > 0 {
					// Extract just the filenames from the full paths
					var skippedFilenames []string
					for _, path := range skippedFiles {
						skippedFilenames = append(skippedFilenames, filepath.Base(path))
					}
					require.ElementsMatch(t, test.expectedSkippedFiles, skippedFilenames,
						"skipped files do not match expected")
				}
			}

			// Use kubelet config flag precedence
			err := kubeletConfigFlagPrecedence(kubeletConfig, test.cliArgs)
			require.NoError(t, err, "failed to set the kubelet config flag precedence")

			// Verify the merged configuration fields
			for fieldName, expectedValue := range test.overwrittenConfigFields {
				value := reflect.ValueOf(kubeletConfig).Elem()
				field := value.FieldByName(fieldName)
				require.Equal(t, expectedValue, field.Interface(), "Field mismatch: "+fieldName)
			}
		})
	}
}
Repository: kubernetes/kubernetes
File: staging/src/k8s.io/component-base/metrics/version_test.go (Go)

Code before:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package metrics

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestRegisterBuildInfo(t *testing.T) {
	registry := NewKubeRegistry()

	RegisterBuildInfo(registry)

	mfs, err := registry.Gather()
	require.NoError(t, err, "Gather failed")

	// Find the kubernetes_build_info metric
	var found bool
	for _, mf := range mfs {
		if *mf.Name == "kubernetes_build_info" {
			found = true

			// Verify help text includes [BETA]
			assert.Contains(t, mf.GetHelp(), "[BETA]", "Help text should contain [BETA]")
			assert.Contains(t, mf.GetHelp(), "A metric with a constant '1' value labeled by major, minor, git version", "Help text should describe the metric")

			// Verify metric type is gauge
			assert.Equal(t, "GAUGE", mf.GetType().String(), "Metric type should be GAUGE")

			// Verify we have exactly one metric
			metrics := mf.GetMetric()
			require.Len(t, metrics, 1, "Should have exactly one metric")

			metric := metrics[0]

			// Verify the value is 1
			assert.Equal(t, 1.0, metric.GetGauge().GetValue(), "Metric value should be 1")

			// Verify all expected labels are present
			expectedLabels := map[string]bool{
				"major":          false,
				"minor":          false,
				"git_version":    false,
				"git_commit":     false,
				"git_tree_state": false,

Review comment (suggestion):
```suggestion
		if *mf.Name != "kubernetes_build_info" {
			continue
		}
```

Code after:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package metrics_test

import (
	"fmt"
	"strings"
	"testing"

	"k8s.io/component-base/metrics"
	"k8s.io/component-base/metrics/testutil"
	"k8s.io/component-base/version"
)

func TestRegisterBuildInfo(t *testing.T) {
	registry := metrics.NewKubeRegistry()

	metrics.RegisterBuildInfo(registry)

	info := version.Get()

	want := fmt.Sprintf(`
		# HELP kubernetes_build_info [BETA] A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.
		# TYPE kubernetes_build_info gauge
		kubernetes_build_info{build_date=%q,compiler=%q,git_commit=%q,git_tree_state=%q,git_version=%q,go_version=%q,major=%q,minor=%q,platform=%q} 1
	`,
		info.BuildDate,
		info.Compiler,
		info.GitCommit,
		info.GitTreeState,
		info.GitVersion,
		info.GoVersion,
		info.Major,
		info.Minor,
		info.Platform,
	)

	if err := testutil.GatherAndCompare(registry, strings.NewReader(want), "kubernetes_build_info"); err != nil {
		t.Fatal(err)
	}
}
Repository: kubernetes/kubernetes
File: staging/src/k8s.io/component-base/metrics/version_test.go (Go)

Code before:

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestRegisterBuildInfo(t *testing.T) {
	registry := NewKubeRegistry()

	RegisterBuildInfo(registry)

	mfs, err := registry.Gather()
	require.NoError(t, err, "Gather failed")

	// Find the kubernetes_build_info metric
	var found bool
	for _, mf := range mfs {
		if *mf.Name != "kubernetes_build_info" {
			continue
		}
		found = true

		// Verify help text includes [BETA]
		assert.Contains(t, mf.GetHelp(), "[BETA]", "Help text should contain [BETA]")
		assert.Contains(t, mf.GetHelp(), "A metric with a constant '1' value labeled by major, minor, git version", "Help text should describe the metric")

		// Verify metric type is gauge
		assert.Equal(t, "GAUGE", mf.GetType().String(), "Metric type should be GAUGE")

		// Verify we have exactly one metric
		metrics := mf.GetMetric()
		require.Len(t, metrics, 1, "Should have exactly one metric")

		metric := metrics[0]

		// Verify the value is 1
		assert.InDelta(t, 1.0, metric.GetGauge().GetValue(), 1e-9, "Metric value should be 1")

		// Verify all expected labels are present
		expectedLabels := map[string]bool{
			"major":          false,
			"minor":          false,
			"git_version":    false,
			"git_commit":     false,
			"git_tree_state": false,
			"build_date":     false,
			"go_version":     false,
			"compiler":       false,
			"platform":       false,

Review comment (suggestion):
Would prefer the `GatherAndCompare` instead of breaking down the checks in different `assert.Contains` calls

Code after:

import (
	"fmt"
	"strings"
	"testing"

	"k8s.io/component-base/metrics"
	"k8s.io/component-base/metrics/testutil"
	"k8s.io/component-base/version"
)

func TestRegisterBuildInfo(t *testing.T) {
	registry := metrics.NewKubeRegistry()

	metrics.RegisterBuildInfo(registry)

	info := version.Get()

	want := fmt.Sprintf(`
		# HELP kubernetes_build_info [BETA] A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.
		# TYPE kubernetes_build_info gauge
		kubernetes_build_info{build_date=%q,compiler=%q,git_commit=%q,git_tree_state=%q,git_version=%q,go_version=%q,major=%q,minor=%q,platform=%q} 1
	`,
		info.BuildDate,
		info.Compiler,
		info.GitCommit,
		info.GitTreeState,
		info.GitVersion,
		info.GoVersion,
		info.Major,
		info.Minor,
		info.Platform,
	)

	if err := testutil.GatherAndCompare(registry, strings.NewReader(want), "kubernetes_build_info"); err != nil {
		t.Fatal(err)
	}
}