Skip to content

Commit 17d67ee

Browse files
committed
bump(k8s): fix verify
1 parent 8b883f8 commit 17d67ee

File tree

14 files changed

+34
-27
lines changed

14 files changed

+34
-27
lines changed

pkg/manifestclient/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestFilterByLabelSelector(t *testing.T) {
7171
}
7272

7373
if !equality.Semantic.DeepEqual(result, tc.expectedOutput) {
74-
t.Errorf(diff.ObjectDiff(tc.expectedOutput, result))
74+
t.Errorf("%s", diff.ObjectDiff(tc.expectedOutput, result))
7575
}
7676
})
7777
}

pkg/markdown/markdown.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ func (m *Markdown) Bytes() []byte {
3232
fmt.Fprint(ret, m.tableOfContents.String())
3333
fmt.Fprintln(ret, "")
3434
fmt.Fprintln(ret, "")
35-
fmt.Fprintf(ret, m.body.String())
35+
fmt.Fprintf(ret, "%s", m.body.String())
3636
return ret.Bytes()
3737
}
3838

3939
// ExactBytes returns markdown with table of contents or title. Useful for embedding.
4040
func (m *Markdown) ExactBytes() []byte {
4141
ret := &bytes.Buffer{}
42-
fmt.Fprintf(ret, m.body.String())
42+
fmt.Fprintf(ret, "%s", m.body.String())
4343
return ret.Bytes()
4444
}
4545

pkg/operator/apiserver/controller/apiservice/apiservice_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (c *APIServiceController) syncEnabledAPIServices(ctx context.Context, enabl
246246
}
247247
if len(availableConditionMessages) > 0 {
248248
sort.Sort(sort.StringSlice(availableConditionMessages))
249-
return fmt.Errorf(strings.Join(availableConditionMessages, "\n"))
249+
return fmt.Errorf("%s", strings.Join(availableConditionMessages, "\n"))
250250
}
251251

252252
// if the apiservices themselves check out ok, try to actually hit the discovery endpoints. We have a history in clusterup
@@ -258,7 +258,7 @@ func (c *APIServiceController) syncEnabledAPIServices(ctx context.Context, enabl
258258

259259
if len(availableConditionMessages) > 0 {
260260
sort.Sort(sort.StringSlice(availableConditionMessages))
261-
return fmt.Errorf(strings.Join(availableConditionMessages, "\n"))
261+
return fmt.Errorf("%s", strings.Join(availableConditionMessages, "\n"))
262262
}
263263

264264
return nil

pkg/operator/encryption/controllers/key_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func TestKeyController(t *testing.T) {
114114
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecret(targetNamespace, []schema.GroupResource{}, 1, actualSecret)
115115
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-key-does-not-exist" // TODO: Fix this
116116
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
117-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
117+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
118118
}
119119
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
120120
ts.Error(err)
@@ -192,7 +192,7 @@ func TestKeyController(t *testing.T) {
192192
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecret(targetNamespace, []schema.GroupResource{}, 6, actualSecret)
193193
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-rotation-interval-has-passed"
194194
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
195-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
195+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
196196
}
197197
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
198198
ts.Error(err)
@@ -309,7 +309,7 @@ func TestKeyController(t *testing.T) {
309309
expectedSecret := encryptiontesting.CreateEncryptionKeySecretWithKeyFromExistingSecretWithMode(targetNamespace, []schema.GroupResource{}, 6, actualSecret, "aesgcm")
310310
expectedSecret.Annotations["encryption.apiserver.operator.openshift.io/internal-reason"] = "secrets-encryption-mode-changed"
311311
if !equality.Semantic.DeepEqual(actualSecret, expectedSecret) {
312-
ts.Errorf(diff.ObjectDiff(expectedSecret, actualSecret))
312+
ts.Errorf("%s", diff.ObjectDiff(expectedSecret, actualSecret))
313313
}
314314
if err := encryptiontesting.ValidateEncryptionKey(actualSecret); err != nil {
315315
ts.Error(err)

pkg/operator/encryption/statemachine/transition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func getDesiredEncryptionState(oldEncryptionConfig *apiserverconfigv1.Encryption
196196
// Note: because read-keys are consistent, currentlyEncryptedGRs equals toBeEncryptedGRs
197197
allMigrated, _, reason := state.MigratedFor(currentlyEncryptedGRs, writeKey)
198198
if !allMigrated {
199-
klog.V(4).Infof(reason)
199+
klog.V(4).Infof("%s", reason)
200200
return desiredEncryptionState
201201
}
202202
for gr := range desiredEncryptionState {

pkg/operator/genericoperatorclient/dynamic_operator_client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestSetOperatorSpecFromUnstructured(t *testing.T) {
104104
t.Fatal(err)
105105
}
106106
if !reflect.DeepEqual(test.in, test.expected) {
107-
t.Errorf(diff.ObjectDiff(test.in, test.expected))
107+
t.Errorf("%s", diff.ObjectDiff(test.in, test.expected))
108108
}
109109
})
110110
}
@@ -208,7 +208,7 @@ func TestSetOperatorStatusFromUnstructured(t *testing.T) {
208208
t.Fatal(err)
209209
}
210210
if !reflect.DeepEqual(test.in, test.expected) {
211-
t.Errorf(diff.ObjectGoPrintDiff(test.in, test.expected))
211+
t.Errorf("%s", diff.ObjectGoPrintDiff(test.in, test.expected))
212212
}
213213
})
214214
}

pkg/operator/latencyprofilecontroller/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (c *LatencyProfileController) sync(ctx context.Context, syncCtx factory.Syn
147147
if err != nil {
148148
return err
149149
}
150-
return fmt.Errorf(rejectMsg)
150+
return fmt.Errorf("%s", rejectMsg)
151151
}
152152
}
153153

pkg/operator/staticpod/controller/guard/guard_controller_test.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,21 @@ func (i FakeInfrastructureSharedInformer) AddEventHandler(handler cache.Resource
7777
func (i FakeInfrastructureSharedInformer) AddEventHandlerWithResyncPeriod(handler cache.ResourceEventHandler, resyncPeriod time.Duration) (cache.ResourceEventHandlerRegistration, error) {
7878
return nil, nil
7979
}
80-
func (i FakeInfrastructureSharedInformer) GetStore() cache.Store { return nil }
81-
func (i FakeInfrastructureSharedInformer) GetController() cache.Controller { return nil }
82-
func (i FakeInfrastructureSharedInformer) Run(stopCh <-chan struct{}) {}
83-
func (i FakeInfrastructureSharedInformer) HasSynced() bool { return i.HasSynced_ }
84-
func (i FakeInfrastructureSharedInformer) LastSyncResourceVersion() string { return "" }
80+
func (i FakeInfrastructureSharedInformer) AddEventHandlerWithOptions(handler cache.ResourceEventHandler, options cache.HandlerOptions) (cache.ResourceEventHandlerRegistration, error) {
81+
return nil, nil
82+
}
83+
func (i FakeInfrastructureSharedInformer) GetStore() cache.Store { return nil }
84+
func (i FakeInfrastructureSharedInformer) GetController() cache.Controller { return nil }
85+
func (i FakeInfrastructureSharedInformer) Run(stopCh <-chan struct{}) {}
86+
func (i FakeInfrastructureSharedInformer) RunWithContext(ctx context.Context) {}
87+
func (i FakeInfrastructureSharedInformer) HasSynced() bool { return i.HasSynced_ }
88+
func (i FakeInfrastructureSharedInformer) LastSyncResourceVersion() string { return "" }
8589
func (i FakeInfrastructureSharedInformer) SetWatchErrorHandler(handler cache.WatchErrorHandler) error {
8690
return nil
8791
}
92+
func (i FakeInfrastructureSharedInformer) SetWatchErrorHandlerWithContext(handler cache.WatchErrorHandlerWithContext) error {
93+
return nil
94+
}
8895
func (i FakeInfrastructureSharedInformer) SetTransform(f cache.TransformFunc) error {
8996
return nil
9097
}

pkg/operator/staticpod/controller/missingstaticpod/missing_static_pod_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (c *missingStaticPodController) sync(ctx context.Context, syncCtx factory.S
178178
}
179179

180180
if len(errors) > 0 {
181-
return fmt.Errorf(strings.Join(errors, "\n"))
181+
return fmt.Errorf("%s", strings.Join(errors, "\n"))
182182
}
183183

184184
return nil

pkg/operator/v1helpers/args_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestFlagsFromUnstructured(t *testing.T) {
6161
}
6262

6363
if !equality.Semantic.DeepEqual(actualOutput, scenario.expectedOutput) {
64-
t.Errorf(diff.ObjectDiff(actualOutput, scenario.expectedOutput))
64+
t.Errorf("%s", diff.ObjectDiff(actualOutput, scenario.expectedOutput))
6565
}
6666
})
6767
}
@@ -97,7 +97,7 @@ func TestToFlagSlice(t *testing.T) {
9797

9898
// validate
9999
if !equality.Semantic.DeepEqual(actualOutput, scenario.expectedOutput) {
100-
t.Errorf(diff.ObjectDiff(actualOutput, scenario.expectedOutput))
100+
t.Errorf("%s", diff.ObjectDiff(actualOutput, scenario.expectedOutput))
101101
}
102102
})
103103
}

pkg/operator/v1helpers/helper_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestSetOperatorCondition(t *testing.T) {
9696
actual.LastTransitionTime = metav1.Time{}
9797
}
9898
if !equality.Semantic.DeepEqual(expected, actual) {
99-
t.Errorf(diff.ObjectDiff(expected, actual))
99+
t.Errorf("%s", diff.ObjectDiff(expected, actual))
100100
}
101101
}
102102
})
@@ -143,7 +143,7 @@ func TestRemoveOperatorCondition(t *testing.T) {
143143
actual.LastTransitionTime = metav1.Time{}
144144
}
145145
if !equality.Semantic.DeepEqual(expected, actual) {
146-
t.Errorf(diff.ObjectDiff(expected, actual))
146+
t.Errorf("%s", diff.ObjectDiff(expected, actual))
147147
}
148148
}
149149
})
@@ -234,7 +234,7 @@ func TestSetCondition(t *testing.T) {
234234
actual.LastTransitionTime = metav1.Time{}
235235
}
236236
if !equality.Semantic.DeepEqual(expected, actual) {
237-
t.Errorf(diff.ObjectDiff(expected, actual))
237+
t.Errorf("%s", diff.ObjectDiff(expected, actual))
238238
}
239239
}
240240
})
@@ -281,7 +281,7 @@ func TestRemoveCondition(t *testing.T) {
281281
actual.LastTransitionTime = metav1.Time{}
282282
}
283283
if !equality.Semantic.DeepEqual(expected, actual) {
284-
t.Errorf(diff.ObjectDiff(expected, actual))
284+
t.Errorf("%s", diff.ObjectDiff(expected, actual))
285285
}
286286
}
287287
})

pkg/serviceability/profiler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func StartProfiler() {
1818
runtime.SetBlockProfileRate(1)
1919
profilePort := env("OPENSHIFT_PROFILE_PORT", "6060")
2020
profileHost := env("OPENSHIFT_PROFILE_HOST", "127.0.0.1")
21-
klog.Infof(fmt.Sprintf("Starting profiling endpoint at http://%s:%s/debug/pprof/", profileHost, profilePort))
21+
klog.Infof("%s", fmt.Sprintf("Starting profiling endpoint at http://%s:%s/debug/pprof/", profileHost, profilePort))
2222
klog.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%s", profileHost, profilePort), nil))
2323
}()
2424
}

pkg/template/generator/examples/remotevalue_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestFakeRemoteValueGenerator(t *testing.T) {
2828

2929
value, err := generator.GenerateValue("[GET:http://127.0.0.1:12345/v1/value/generate]")
3030
if err != nil {
31-
t.Errorf(err.Error())
31+
t.Errorf("%s", err.Error())
3232
}
3333
if value != "NewRandomString" {
3434
t.Errorf("Failed to fetch remote value using GET.")

pkg/verify/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (v *releaseVerifier) String() string {
137137
fmt.Fprint(&builder, ", ")
138138
}
139139
if entity.PrimaryKey != nil {
140-
fmt.Fprintf(&builder, strings.ToUpper(fmt.Sprintf("%x", entity.PrimaryKey.Fingerprint)))
140+
fmt.Fprintf(&builder, "%s", strings.ToUpper(fmt.Sprintf("%x", entity.PrimaryKey.Fingerprint)))
141141
fmt.Fprint(&builder, ": ")
142142
}
143143
count := 0

0 commit comments

Comments
 (0)