Skip to content

Commit

Permalink
Remove '%s' and %s with %q (#6038)
Browse files Browse the repository at this point in the history
Subj,

/assign @markusthoemmes
  • Loading branch information
vagababov authored and knative-prow-robot committed Nov 15, 2019
1 parent c64bbbc commit 5617874
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions pkg/activator/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,17 @@ func TestActivationHandlerProxyHeader(t *testing.T) {
req.Header.Set(activator.RevisionHeaderNamespace, testNamespace)
req.Header.Set(activator.RevisionHeaderName, testRevName)

// set up config store to populate context
// Set up config store to populate context.
configStore := setupConfigStore(t, logging.FromContext(ctx))
ctx = configStore.ToContext(req.Context())
handler.ServeHTTP(writer, req.WithContext(ctx))

select {
case httpReq := <-interceptCh:
if got := httpReq.Header.Get(network.ProxyHeaderName); got != activator.Name {
t.Errorf("Header '%s' does not have the expected value. Want = '%s', got = '%s'.", network.ProxyHeaderName, activator.Name, got)
t.Errorf("Header %q = %q, want: %q", network.ProxyHeaderName, got, activator.Name)
}
case <-time.After(5 * time.Second):
case <-time.After(1 * time.Second):
t.Fatal("Timed out waiting for a request to be intercepted")
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/autoscaling/annotation_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestValidateScaleBoundAnnotations(t *testing.T) {
}, {
name: "annotation /window is invalid for class HPA and metric CPU",
annotations: map[string]string{WindowAnnotationKey: "7s", ClassAnnotationKey: HPA, MetricAnnotationKey: CPU},
expectErr: fmt.Sprintf(`invalid key name "%s": %s for %s %s`, WindowAnnotationKey, HPA, MetricAnnotationKey, CPU),
expectErr: fmt.Sprintf(`invalid key name %q: %s for %s %s`, WindowAnnotationKey, HPA, MetricAnnotationKey, CPU),
}, {
name: "annotation /window is valid for class KPA",
annotations: map[string]string{WindowAnnotationKey: "7s", ClassAnnotationKey: KPA},
Expand All @@ -182,7 +182,7 @@ func TestValidateScaleBoundAnnotations(t *testing.T) {
}, {
name: "value too short and invalid class for /window annotation",
annotations: map[string]string{WindowAnnotationKey: "1s", ClassAnnotationKey: HPA, MetricAnnotationKey: CPU},
expectErr: fmt.Sprintf(`invalid key name "%s": %s for %s %s`, WindowAnnotationKey, HPA, MetricAnnotationKey, CPU),
expectErr: fmt.Sprintf(`invalid key name %q: %s for %s %s`, WindowAnnotationKey, HPA, MetricAnnotationKey, CPU),
}, {
name: "value too long and valid class for /window annotation",
annotations: map[string]string{WindowAnnotationKey: "365h", ClassAnnotationKey: KPA},
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/ingress/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ func patchAddFinalizerAction(ingressName, finalizer string) clientgotesting.Patc
action := clientgotesting.PatchActionImpl{
Name: ingressName,
}
patch := fmt.Sprintf(`{"metadata":{"finalizers":["%s"],"resourceVersion":"v1"}}`, finalizer)
patch := fmt.Sprintf(`{"metadata":{"finalizers":[%q],"resourceVersion":"v1"}}`, finalizer)
action.Patch = []byte(patch)
return action
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/labeler/labeler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func patchRemoveLabel(namespace, name, key, version string) clientgotesting.Patc
action.Name = name
action.Namespace = namespace

patch := fmt.Sprintf(`{"metadata":{"labels":{"%s":null},"resourceVersion":"%s"}}`, key, version)
patch := fmt.Sprintf(`{"metadata":{"labels":{%q:null},"resourceVersion":%q}}`, key, version)

action.Patch = []byte(patch)
return action
Expand All @@ -271,7 +271,7 @@ func patchAddLabel(namespace, name, key, value, version string) clientgotesting.
action.Name = name
action.Namespace = namespace

patch := fmt.Sprintf(`{"metadata":{"labels":{"%s":"%s"},"resourceVersion":"%s"}}`, key, value, version)
patch := fmt.Sprintf(`{"metadata":{"labels":{%q:%q},"resourceVersion":%q}}`, key, value, version)

action.Patch = []byte(patch)
return action
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/autoscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func assertAutoscaleUpToNumPods(ctx *testContext, curPods, targetPods float64, d
if err != nil {
return err
}
mes := fmt.Sprintf("revision '%s' #replicas: %v, want at least: %v", ctx.resources.Revision.Name, got, minPods)
mes := fmt.Sprintf("revision %q #replicas: %v, want at least: %v", ctx.resources.Revision.Name, got, minPods)
ctx.t.Log(mes)
if got < minPods {
return errors.New(mes)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/service_to_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func testProxyToHelloworld(t *testing.T, clients *test.Clients, helloworldURL *u
}
// We expect the response from httpproxy is equal to the response from helloworld
if helloworldResponse != strings.TrimSpace(string(response.Body)) {
t.Fatalf("The httpproxy response '%s' is not equal to helloworld response '%s'.", string(response.Body), helloworldResponse)
t.Fatalf("The httpproxy response = %q, want: %q.", string(response.Body), helloworldResponse)
}

// As a final check (since we know they are both up), check that if we can access the helloworld app externally.
Expand Down

0 comments on commit 5617874

Please sign in to comment.