From e6a0f4acba750c2d975b596eaec2ae0f048ed5ab Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Fri, 24 Jul 2020 11:13:07 -0400 Subject: [PATCH] Fix int->string casts Kubernetes-commit: 124a5ddf725c4862520d8619017cac9db7a03522 --- plugin/pkg/client/auth/azure/azure_test.go | 4 ++-- tools/record/event_test.go | 4 ++-- tools/record/events_cache_test.go | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugin/pkg/client/auth/azure/azure_test.go b/plugin/pkg/client/auth/azure/azure_test.go index eb186d88..5f9aab76 100644 --- a/plugin/pkg/client/auth/azure/azure_test.go +++ b/plugin/pkg/client/auth/azure/azure_test.go @@ -185,7 +185,7 @@ func TestAzureTokenSource(t *testing.T) { expiresOn = "foo" ) cfg := map[string]string{ - cfgConfigMode: string(configMode), + cfgConfigMode: strconv.Itoa(int(configMode)), cfgApiserverID: serverID, cfgClientID: clientID, cfgTenantID: tenantID, @@ -365,7 +365,7 @@ func TestAzureTokenSourceScenarios(t *testing.T) { persister := newFakePersister() cfg := map[string]string{ - cfgConfigMode: string(configMode), + cfgConfigMode: strconv.Itoa(int(configMode)), } if tc.configToken != nil { cfg = token2Cfg(tc.configToken) diff --git a/tools/record/event_test.go b/tools/record/event_test.go index eadb1331..67b033d5 100644 --- a/tools/record/event_test.go +++ b/tools/record/event_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" @@ -509,7 +509,7 @@ func TestLotsOfEvents(t *testing.T) { APIVersion: "version", } // we need to vary the reason to prevent aggregation - go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+string(i), strconv.Itoa(i)) + go recorder.Eventf(ref, v1.EventTypeNormal, "Reason-"+strconv.Itoa(i), strconv.Itoa(i)) } // Make sure no events were dropped by either of the listeners. for i := 0; i < maxQueuedEvents; i++ { diff --git a/tools/record/events_cache_test.go b/tools/record/events_cache_test.go index 8cb4a39e..7eb4d34a 100644 --- a/tools/record/events_cache_test.go +++ b/tools/record/events_cache_test.go @@ -18,6 +18,7 @@ package record import ( "reflect" + "strconv" "strings" "testing" "time" @@ -69,10 +70,10 @@ func makeUniqueEvents(num int) []v1.Event { events := []v1.Event{} kind := "Pod" for i := 0; i < num; i++ { - reason := strings.Join([]string{"reason", string(i)}, "-") - message := strings.Join([]string{"message", string(i)}, "-") - name := strings.Join([]string{"pod", string(i)}, "-") - namespace := strings.Join([]string{"ns", string(i)}, "-") + reason := strings.Join([]string{"reason", strconv.Itoa(i)}, "-") + message := strings.Join([]string{"message", strconv.Itoa(i)}, "-") + name := strings.Join([]string{"pod", strconv.Itoa(i)}, "-") + namespace := strings.Join([]string{"ns", strconv.Itoa(i)}, "-") involvedObject := makeObjectReference(kind, name, namespace) events = append(events, makeEvent(reason, message, involvedObject)) } @@ -82,7 +83,7 @@ func makeUniqueEvents(num int) []v1.Event { func makeSimilarEvents(num int, template v1.Event, messagePrefix string) []v1.Event { events := makeEvents(num, template) for i := range events { - events[i].Message = strings.Join([]string{messagePrefix, string(i), events[i].Message}, "-") + events[i].Message = strings.Join([]string{messagePrefix, strconv.Itoa(i), events[i].Message}, "-") } return events }