Browse code

go vet pkg

kargakis authored on 2015/03/22 01:55:07
Showing 37 changed files
... ...
@@ -109,7 +109,7 @@ func TestWithGzipReal(t *testing.T) {
109 109
 	defer resp.Body.Close()
110 110
 	body, err := ioutil.ReadAll(resp.Body)
111 111
 	if string(body) != raw {
112
-		t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, resp)
112
+		t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, string(body))
113 113
 	}
114 114
 	vary := resp.Header["Vary"]
115 115
 	if !reflect.DeepEqual(vary, []string{"Accept-Encoding"}) {
... ...
@@ -132,7 +132,7 @@ func TestWithGzipRealAndMultipleVaryHeaders(t *testing.T) {
132 132
 	defer resp.Body.Close()
133 133
 	body, err := ioutil.ReadAll(resp.Body)
134 134
 	if string(body) != raw {
135
-		t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, resp)
135
+		t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, string(body))
136 136
 	}
137 137
 	vary := resp.Header["Vary"]
138 138
 	if !reflect.DeepEqual(vary, []string{"Accept-Encoding", "Foo"}) {
... ...
@@ -73,7 +73,7 @@ func TestRequestHeader(t *testing.T) {
73 73
 		}
74 74
 		if testcase.ExpectedUsername != "" {
75 75
 			if err != nil {
76
-				t.Errorf("%s: Expected user, got error: ", k, err)
76
+				t.Errorf("%s: Expected user, got error: %v", k, err)
77 77
 				continue
78 78
 			}
79 79
 			if !ok {
... ...
@@ -634,7 +634,7 @@ func TestX509Verifier(t *testing.T) {
634 634
 
635 635
 		if testCase.ExpectOK {
636 636
 			if !authCall {
637
-				t.Errorf("%s: Expected inner auth called, wasn't")
637
+				t.Errorf("%s: Expected inner auth called, wasn't", k)
638 638
 				continue
639 639
 			}
640 640
 			if "innerauth" != user.GetName() {
... ...
@@ -643,7 +643,7 @@ func TestX509Verifier(t *testing.T) {
643 643
 			}
644 644
 		} else {
645 645
 			if authCall {
646
-				t.Errorf("%s: Expected inner auth not to be called, was")
646
+				t.Errorf("%s: Expected inner auth not to be called, was", k)
647 647
 				continue
648 648
 			}
649 649
 		}
... ...
@@ -37,7 +37,7 @@ func TestAuthenticator(t *testing.T) {
37 37
 			t.Fatalf("%s: Unexpected error: %s", requestType, err)
38 38
 		}
39 39
 		if req.Authorized != testCase.ExpectedAuthorized {
40
-			t.Fatalf("%s: Expected Authorized=%b, got Authorized=%b", requestType, testCase.ExpectedAuthorized, req.Authorized)
40
+			t.Fatalf("%s: Expected Authorized=%t, got Authorized=%t", requestType, testCase.ExpectedAuthorized, req.Authorized)
41 41
 		}
42 42
 	}
43 43
 }
... ...
@@ -258,7 +258,7 @@ func TestAuthenticateTokenNotFound(t *testing.T) {
258 258
 		t.Error("Expected not found error")
259 259
 	}
260 260
 	if userInfo != nil {
261
-		t.Error("Unexpected user: %v", userInfo)
261
+		t.Errorf("Unexpected user: %v", userInfo)
262 262
 	}
263 263
 }
264 264
 func TestAuthenticateTokenOtherGetError(t *testing.T) {
... ...
@@ -273,10 +273,10 @@ func TestAuthenticateTokenOtherGetError(t *testing.T) {
273 273
 		t.Error("Expected error is missing!")
274 274
 	}
275 275
 	if err.Error() != tokenRegistry.Err.Error() {
276
-		t.Error("Expected error %v, but got error %v", tokenRegistry.Err, err)
276
+		t.Errorf("Expected error %v, but got error %v", tokenRegistry.Err, err)
277 277
 	}
278 278
 	if userInfo != nil {
279
-		t.Error("Unexpected user: %v", userInfo)
279
+		t.Errorf("Unexpected user: %v", userInfo)
280 280
 	}
281 281
 }
282 282
 func TestAuthenticateTokenExpired(t *testing.T) {
... ...
@@ -294,10 +294,10 @@ func TestAuthenticateTokenExpired(t *testing.T) {
294 294
 		t.Error("Found token, but it should be missing!")
295 295
 	}
296 296
 	if err != ErrExpired {
297
-		t.Error("Unexpected error: %v", err)
297
+		t.Errorf("Unexpected error: %v", err)
298 298
 	}
299 299
 	if userInfo != nil {
300
-		t.Error("Unexpected user: %v", userInfo)
300
+		t.Errorf("Unexpected user: %v", userInfo)
301 301
 	}
302 302
 }
303 303
 func TestAuthenticateTokenValidated(t *testing.T) {
... ...
@@ -315,7 +315,7 @@ func TestAuthenticateTokenValidated(t *testing.T) {
315 315
 		t.Error("Did not find a token!")
316 316
 	}
317 317
 	if err != nil {
318
-		t.Error("Unexpected error: %v", err)
318
+		t.Errorf("Unexpected error: %v", err)
319 319
 	}
320 320
 	if userInfo == nil {
321 321
 		t.Error("Did not get a user!")
... ...
@@ -75,7 +75,7 @@ func TestCookieGenerate(t *testing.T) {
75 75
 		setCookie := w.Header().Get("Set-Cookie")
76 76
 		if testCase.ExpectSetCookie {
77 77
 			if len(setCookie) == 0 {
78
-				t.Errorf("%s: Expected set-cookie header")
78
+				t.Errorf("%s: Expected set-cookie header", k)
79 79
 				continue
80 80
 			}
81 81
 
... ...
@@ -48,7 +48,7 @@ func TestImplicit(t *testing.T) {
48 48
 		ExpectThen       string
49 49
 	}{
50 50
 		"display confirm form": {
51
-			CSRF:     &csrf.FakeCSRF{"test", nil},
51
+			CSRF:     &csrf.FakeCSRF{Token: "test", Err: nil},
52 52
 			Implicit: &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}},
53 53
 			Path:     "/login",
54 54
 			ExpectContains: []string{
... ...
@@ -57,35 +57,35 @@ func TestImplicit(t *testing.T) {
57 57
 			},
58 58
 		},
59 59
 		"successful POST redirects": {
60
-			CSRF:       &csrf.FakeCSRF{"test", nil},
60
+			CSRF:       &csrf.FakeCSRF{Token: "test", Err: nil},
61 61
 			Implicit:   &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}},
62 62
 			Path:       "/login?then=%2Ffoo",
63 63
 			PostValues: url.Values{"csrf": []string{"test"}},
64 64
 			ExpectThen: "/foo",
65 65
 		},
66 66
 		"redirect when POST fails CSRF": {
67
-			CSRF:           &csrf.FakeCSRF{"test", nil},
67
+			CSRF:           &csrf.FakeCSRF{Token: "test", Err: nil},
68 68
 			Implicit:       &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}},
69 69
 			Path:           "/login",
70 70
 			PostValues:     url.Values{"csrf": []string{"wrong"}},
71 71
 			ExpectRedirect: "/login?reason=token+expired",
72 72
 		},
73 73
 		"redirect when not authenticated": {
74
-			CSRF:           &csrf.FakeCSRF{"test", nil},
74
+			CSRF:           &csrf.FakeCSRF{Token: "test", Err: nil},
75 75
 			Implicit:       &testImplicit{Success: false},
76 76
 			Path:           "/login",
77 77
 			PostValues:     url.Values{"csrf": []string{"test"}},
78 78
 			ExpectRedirect: "/login?reason=access+denied",
79 79
 		},
80 80
 		"redirect on auth failure": {
81
-			CSRF:           &csrf.FakeCSRF{"test", nil},
81
+			CSRF:           &csrf.FakeCSRF{Token: "test", Err: nil},
82 82
 			Implicit:       &testImplicit{Err: errors.New("failed")},
83 83
 			Path:           "/login",
84 84
 			PostValues:     url.Values{"csrf": []string{"test"}},
85 85
 			ExpectRedirect: "/login?reason=access+denied",
86 86
 		},
87 87
 		"expect GET error": {
88
-			CSRF:           &csrf.FakeCSRF{"test", nil},
88
+			CSRF:           &csrf.FakeCSRF{Token: "test", Err: nil},
89 89
 			Implicit:       &testImplicit{Err: errors.New("failed")},
90 90
 			ExpectContains: []string{`"message">An unknown error has occurred. Contact your administrator`},
91 91
 		},
... ...
@@ -81,7 +81,7 @@ func (r *Etcd) GetPolicy(ctx kapi.Context, name string) (policy *authorizationap
81 81
 }
82 82
 
83 83
 func (r *Etcd) ListPolicies(ctx kapi.Context, label labels.Selector, field fields.Selector) (*authorizationapi.PolicyList, error) {
84
-	result, err := r.policyRegistry.ListPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs})
84
+	result, err := r.policyRegistry.ListPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs})
85 85
 	if err != nil {
86 86
 		return nil, err
87 87
 	}
... ...
@@ -107,7 +107,7 @@ func (r *Etcd) DeletePolicy(ctx kapi.Context, name string) error {
107 107
 }
108 108
 
109 109
 func (r *Etcd) WatchPolicies(ctx kapi.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
110
-	return r.policyRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}, resourceVersion)
110
+	return r.policyRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}, resourceVersion)
111 111
 }
112 112
 
113 113
 func makePolicyBindingListKey(ctx kapi.Context) string {
... ...
@@ -132,7 +132,7 @@ func (r *Etcd) GetPolicyBinding(ctx kapi.Context, name string) (policyBinding *a
132 132
 }
133 133
 
134 134
 func (r *Etcd) ListPolicyBindings(ctx kapi.Context, label labels.Selector, field fields.Selector) (*authorizationapi.PolicyBindingList, error) {
135
-	result, err := r.policyBindingRegistry.ListPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs})
135
+	result, err := r.policyBindingRegistry.ListPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs})
136 136
 	if err != nil {
137 137
 		return nil, err
138 138
 	}
... ...
@@ -158,5 +158,5 @@ func (r *Etcd) DeletePolicyBinding(ctx kapi.Context, name string) error {
158 158
 }
159 159
 
160 160
 func (r *Etcd) WatchPolicyBindings(ctx kapi.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
161
-	return r.policyBindingRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}, resourceVersion)
161
+	return r.policyBindingRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}, resourceVersion)
162 162
 }
... ...
@@ -145,6 +145,6 @@ func TestDeleteValid(t *testing.T) {
145 145
 	}
146 146
 
147 147
 	if policy, _ := registry.GetPolicy(ctx, authorizationapi.PolicyName); policy != nil {
148
-		t.Error("Unexpected policy found: %v", policy)
148
+		t.Errorf("Unexpected policy found: %v", policy)
149 149
 	}
150 150
 }
... ...
@@ -212,6 +212,6 @@ func TestDeleteValid(t *testing.T) {
212 212
 	}
213 213
 
214 214
 	if binding, _ := registry.GetPolicyBinding(ctx, "foo"); binding != nil {
215
-		t.Error("Unexpected binding found: %v", binding)
215
+		t.Errorf("Unexpected binding found: %v", binding)
216 216
 	}
217 217
 }
... ...
@@ -78,7 +78,7 @@ func TestImageChangeTriggerFromRename(t *testing.T) {
78 78
 		t.Fatalf("unexpected error: %v", err)
79 79
 	}
80 80
 	if actual.From.Name != "bar" {
81
-		t.Error("expected %#v, actual %#v", old, actual)
81
+		t.Errorf("expected %#v, actual %#v", old, actual)
82 82
 	}
83 83
 
84 84
 	old = current.ImageChangeTrigger{
... ...
@@ -91,7 +91,7 @@ func TestImageChangeTriggerFromRename(t *testing.T) {
91 91
 		t.Fatalf("unexpected error: %v", err)
92 92
 	}
93 93
 	if actual.From.Name != "foo" {
94
-		t.Error("expected %#v, actual %#v", old, actual)
94
+		t.Errorf("expected %#v, actual %#v", old, actual)
95 95
 	}
96 96
 
97 97
 	old = current.ImageChangeTrigger{
... ...
@@ -379,7 +379,7 @@ func TestValidateTrigger(t *testing.T) {
379 379
 		errors := validateTrigger(&test.trigger)
380 380
 		if len(test.expected) == 0 {
381 381
 			if len(errors) != 0 {
382
-				t.Errorf("%s: Got unexpected validation errors: %#v", errors)
382
+				t.Errorf("%s: Got unexpected validation errors: %#v", desc, errors)
383 383
 			}
384 384
 			continue
385 385
 		}
... ...
@@ -77,8 +77,8 @@ func getDockercfgFile(path string) string {
77 77
 // authEntry is a single entry for a given server in a
78 78
 // .dockercfg file
79 79
 type authEntry struct {
80
-	Auth  string `json:auth`
81
-	Email string `json:email`
80
+	Auth  string `json:"auth"`
81
+	Email string `json:"email"`
82 82
 }
83 83
 
84 84
 // dockercfg represents the contents of a .dockercfg file
... ...
@@ -122,7 +122,7 @@ func (bc *BuildController) nextBuildStatus(build *buildapi.Build) error {
122 122
 			glog.V(4).Infof("Build pod already existed: %#v", podSpec)
123 123
 			return nil
124 124
 		}
125
-		return fmt.Errorf("failed to create pod for build %s/%s: s", build.Namespace, build.Name, err)
125
+		return fmt.Errorf("failed to create pod for build %s/%s: %v", build.Namespace, build.Name, err)
126 126
 	}
127 127
 
128 128
 	glog.V(4).Infof("Created pod for build: %#v", podSpec)
... ...
@@ -327,7 +327,7 @@ func TestHandleBuild(t *testing.T) {
327 327
 		}
328 328
 
329 329
 		if err != nil {
330
-			t.Errorf("(%d) Unexpected error %v", err)
330
+			t.Errorf("(%d) Unexpected error %v", i, err)
331 331
 		}
332 332
 		if build.Status != tc.outStatus {
333 333
 			t.Errorf("(%d) Expected %s, got %s!", i, tc.outStatus, build.Status)
... ...
@@ -41,7 +41,7 @@ func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod,
41 41
 
42 42
 	if strategy.ExposeDockerSocket {
43 43
 		glog.V(2).Infof("ExposeDockerSocket is enabled for %s build", build.PodName)
44
-		containerEnv = append(containerEnv, kapi.EnvVar{"DOCKER_SOCKET", dockerSocketPath})
44
+		containerEnv = append(containerEnv, kapi.EnvVar{Name: "DOCKER_SOCKET", Value: dockerSocketPath})
45 45
 	}
46 46
 
47 47
 	pod := &kapi.Pod{
... ...
@@ -71,8 +71,8 @@ func setupBuildEnv(build *buildapi.Build, pod *kapi.Pod) error {
71 71
 
72 72
 	switch build.Parameters.Source.Type {
73 73
 	case buildapi.BuildSourceGit:
74
-		vars = append(vars, kapi.EnvVar{"SOURCE_URI", build.Parameters.Source.Git.URI})
75
-		vars = append(vars, kapi.EnvVar{"SOURCE_REF", build.Parameters.Source.Git.Ref})
74
+		vars = append(vars, kapi.EnvVar{Name: "SOURCE_URI", Value: build.Parameters.Source.Git.URI})
75
+		vars = append(vars, kapi.EnvVar{Name: "SOURCE_REF", Value: build.Parameters.Source.Git.Ref})
76 76
 	default:
77 77
 		// Do nothing for unknown source types
78 78
 	}
... ...
@@ -81,9 +81,9 @@ func setupBuildEnv(build *buildapi.Build, pod *kapi.Pod) error {
81 81
 	if err != nil {
82 82
 		return err
83 83
 	}
84
-	vars = append(vars, kapi.EnvVar{"OUTPUT_REGISTRY", ref.Registry})
84
+	vars = append(vars, kapi.EnvVar{Name: "OUTPUT_REGISTRY", Value: ref.Registry})
85 85
 	ref.Registry = ""
86
-	vars = append(vars, kapi.EnvVar{"OUTPUT_IMAGE", ref.String()})
86
+	vars = append(vars, kapi.EnvVar{Name: "OUTPUT_IMAGE", Value: ref.String()})
87 87
 
88 88
 	if len(pod.Spec.Containers) > 0 {
89 89
 		pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, vars...)
... ...
@@ -32,7 +32,7 @@ func TestVerifyRequestForMethod(t *testing.T) {
32 32
 	req := GivenRequest("GET")
33 33
 	err := verifyRequest(req)
34 34
 	if err == nil || !strings.Contains(err.Error(), "method") {
35
-		t.Errorf("Expected anything but POST to be an invalid method %s")
35
+		t.Errorf("Expected anything but POST to be an invalid method %v", err)
36 36
 	}
37 37
 }
38 38
 
... ...
@@ -40,19 +40,19 @@ func TestVerifyRequestForUserAgent(t *testing.T) {
40 40
 	req := GivenRequest("POST")
41 41
 	err := verifyRequest(req)
42 42
 	if err == nil || !strings.Contains(err.Error(), "User-Agent") {
43
-		t.Errorf("Exp. User-Agent to be required %s", err)
43
+		t.Errorf("Exp. User-Agent to be required %v", err)
44 44
 	}
45 45
 
46 46
 	req.Header.Add("User-Agent", "")
47 47
 	err = verifyRequest(req)
48 48
 	if err == nil || !strings.Contains(err.Error(), "User-Agent") {
49
-		t.Errorf("Exp. User-Agent to not empty %s", err)
49
+		t.Errorf("Exp. User-Agent to not empty %v", err)
50 50
 	}
51 51
 
52 52
 	req.Header.Set("User-Agent", "foobar")
53 53
 	err = verifyRequest(req)
54 54
 	if err != nil && strings.Contains(err.Error(), "User-Agent") {
55
-		t.Errorf("Exp. non-empty User-Agent to be valid %s", err)
55
+		t.Errorf("Exp. non-empty User-Agent to be valid %v", err)
56 56
 	}
57 57
 
58 58
 }
... ...
@@ -70,19 +70,19 @@ func TestVerifyRequestForContentType(t *testing.T) {
70 70
 	req.Header.Add("Content-Length", "1")
71 71
 	err = verifyRequest(req)
72 72
 	if err == nil || !strings.Contains(err.Error(), "Content-Type") {
73
-		t.Errorf("Exp. ContentType to be required if a payload is posted %s", err)
73
+		t.Errorf("Exp. ContentType to be required if a payload is posted %v", err)
74 74
 	}
75 75
 
76 76
 	req.Header.Add("Content-Type", "X-Whatever")
77 77
 	err = verifyRequest(req)
78 78
 	if err == nil || !strings.Contains(err.Error(), "Unsupported Content-Type") {
79
-		t.Errorf("Exp. to only support json payloads %s", err)
79
+		t.Errorf("Exp. to only support json payloads %v", err)
80 80
 	}
81 81
 
82 82
 	req.Header.Set("Content-Type", "application/json")
83 83
 	err = verifyRequest(req)
84 84
 	if err != nil && !strings.Contains(err.Error(), "Unsupported Content-Type") {
85
-		t.Errorf("Exp. to allow json payloads %s", err)
85
+		t.Errorf("Exp. to allow json payloads %v", err)
86 86
 	}
87 87
 }
88 88
 
... ...
@@ -112,7 +112,7 @@ func TestExtractWithEmptyPayload(t *testing.T) {
112 112
 	plugin := New()
113 113
 	revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req)
114 114
 	if err != nil {
115
-		t.Errorf("Expected to be able to trigger a build without a payload error: %s", err)
115
+		t.Errorf("Expected to be able to trigger a build without a payload error: %v", err)
116 116
 	}
117 117
 	if !proceed {
118 118
 		t.Error("Expected 'proceed' return value to be 'true'")
... ...
@@ -147,7 +147,7 @@ func TestExtractWithUnmatchedRefGitPayload(t *testing.T) {
147 147
 	build, proceed, err := plugin.Extract(buildConfig, "secret100", "", req)
148 148
 
149 149
 	if err != nil {
150
-		t.Errorf("Unexpected error when triggering build: %s", err)
150
+		t.Errorf("Unexpected error when triggering build: %v", err)
151 151
 	}
152 152
 	if proceed {
153 153
 		t.Error("Expected 'proceed' return value to be 'false' for unmatched refs")
... ...
@@ -183,7 +183,7 @@ func TestExtractWithGitPayload(t *testing.T) {
183 183
 	revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req)
184 184
 
185 185
 	if err != nil {
186
-		t.Errorf("Expected to be able to trigger a build without a payload error: %s", err)
186
+		t.Errorf("Expected to be able to trigger a build without a payload error: %v", err)
187 187
 	}
188 188
 	if !proceed {
189 189
 		t.Error("Expected 'proceed' return value to be 'true'")
... ...
@@ -217,7 +217,7 @@ func TestExtractWithUnmarshalError(t *testing.T) {
217 217
 	plugin := New()
218 218
 	revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req)
219 219
 	if err != nil {
220
-		t.Errorf("Expected to be able to trigger a build without a payload error: %s", err)
220
+		t.Errorf("Expected to be able to trigger a build without a payload error: %v", err)
221 221
 	}
222 222
 	if !proceed {
223 223
 		t.Error("Expected 'proceed' return value to be 'true'")
... ...
@@ -236,7 +236,7 @@ func TestExtractForAPingEvent(t *testing.T) {
236 236
 		t.Errorf("Error while extracting build info: %s", err)
237 237
 	}
238 238
 	if proceed {
239
-		t.Errorf("The 'proceed' return value should equal 'false' %s", proceed)
239
+		t.Errorf("The 'proceed' return value should equal 'false' %t", proceed)
240 240
 	}
241 241
 }
242 242
 
... ...
@@ -252,7 +252,7 @@ func TestExtractProvidesValidBuildForAPushEvent(t *testing.T) {
252 252
 		t.Errorf("Error while extracting build info: %s", err)
253 253
 	}
254 254
 	if !proceed {
255
-		t.Errorf("The 'proceed' return value should equal 'true' %s", proceed)
255
+		t.Errorf("The 'proceed' return value should equal 'true' %t", proceed)
256 256
 	}
257 257
 	if revision == nil {
258 258
 		t.Error("Expecting the revision to not be nil")
... ...
@@ -276,7 +276,7 @@ func TestExtractProvidesValidBuildForAPushEventOtherThanMaster(t *testing.T) {
276 276
 		t.Errorf("Error while extracting build info: %s", err)
277 277
 	}
278 278
 	if !proceed {
279
-		t.Errorf("The 'proceed' return value should equal 'true' %s", proceed)
279
+		t.Errorf("The 'proceed' return value should equal 'true' %t", proceed)
280 280
 	}
281 281
 	if revision == nil {
282 282
 		t.Error("Expecting the revision to not be nil")
... ...
@@ -148,7 +148,7 @@ func NewCmdRouter(f *clientcmd.Factory, parentName, name string, out io.Writer)
148 148
 					glog.Fatalf("You must specify a .kubeconfig file path containing credentials for connecting the router to the master with --credentials")
149 149
 				}
150 150
 
151
-				clientConfigLoadingRules := &kclientcmd.ClientConfigLoadingRules{cfg.Credentials, []string{}}
151
+				clientConfigLoadingRules := &kclientcmd.ClientConfigLoadingRules{ExplicitPath: cfg.Credentials, Precedence: []string{}}
152 152
 				credentials, err := clientConfigLoadingRules.Load()
153 153
 				if err != nil {
154 154
 					glog.Fatalf("The provided credentials %q could not be loaded: %v", cfg.Credentials, err)
... ...
@@ -85,7 +85,7 @@ func start(cfg *clientcmd.Config, plugin router.Plugin) error {
85 85
 
86 86
 	proc.StartReaper()
87 87
 
88
-	factory := controllerfactory.RouterControllerFactory{kubeClient, osClient}
88
+	factory := controllerfactory.RouterControllerFactory{KClient: kubeClient, OSClient: osClient}
89 89
 	controller := factory.Create(plugin)
90 90
 	controller.Run()
91 91
 
... ...
@@ -34,7 +34,7 @@ func NewDefaultImageTemplate() ImageTemplate {
34 34
 func (t *ImageTemplate) ExpandOrDie(component string) string {
35 35
 	value, err := t.Expand(component)
36 36
 	if err != nil {
37
-		glog.Fatalf("Unable to find an image for %q due to an error processing the format: %v", err)
37
+		glog.Fatalf("Unable to find an image for %q due to an error processing the format: %v", component, err)
38 38
 	}
39 39
 	return value
40 40
 }
... ...
@@ -132,7 +132,7 @@ func TestRetryController_realFifoEventOrdering(t *testing.T) {
132 132
 		RetryManager: NewQueueRetryManager(fifo, keyFunc, func(_ interface{}, _ error, _ int) bool { return true }),
133 133
 		Handle: func(obj interface{}) error {
134 134
 			if e, a := 1, obj.(testObj).value; e != a {
135
-				t.Fatalf("expected to handle test value %d, got %d")
135
+				t.Fatalf("expected to handle test value %d, got %d", e, a)
136 136
 			}
137 137
 
138 138
 			go func() {
... ...
@@ -226,11 +226,11 @@ type DeploymentConfigRollbackSpec struct {
226 226
 	// From points to a ReplicationController which is a deployment.
227 227
 	From kapi.ObjectReference `json:"from"`
228 228
 	// IncludeTriggers specifies whether to include config Triggers.
229
-	IncludeTriggers bool `json:"includeTriggers`
229
+	IncludeTriggers bool `json:"includeTriggers"`
230 230
 	// IncludeTemplate specifies whether to include the PodTemplateSpec.
231
-	IncludeTemplate bool `json:"includeTemplate`
231
+	IncludeTemplate bool `json:"includeTemplate"`
232 232
 	// IncludeReplicationMeta specifies whether to include the replica count and selector.
233
-	IncludeReplicationMeta bool `json:"includeReplicationMeta`
233
+	IncludeReplicationMeta bool `json:"includeReplicationMeta"`
234 234
 	// IncludeStrategy specifies whether to include the deployment Strategy.
235
-	IncludeStrategy bool `json:"includeStrategy`
235
+	IncludeStrategy bool `json:"includeStrategy"`
236 236
 }
... ...
@@ -227,11 +227,11 @@ type DeploymentConfigRollbackSpec struct {
227 227
 	// From points to a ReplicationController which is a deployment.
228 228
 	From kapi.ObjectReference `json:"from"`
229 229
 	// IncludeTriggers specifies whether to include config Triggers.
230
-	IncludeTriggers bool `json:"includeTriggers`
230
+	IncludeTriggers bool `json:"includeTriggers"`
231 231
 	// IncludeTemplate specifies whether to include the PodTemplateSpec.
232
-	IncludeTemplate bool `json:"includeTemplate`
232
+	IncludeTemplate bool `json:"includeTemplate"`
233 233
 	// IncludeReplicationMeta specifies whether to include the replica count and selector.
234
-	IncludeReplicationMeta bool `json:"includeReplicationMeta`
234
+	IncludeReplicationMeta bool `json:"includeReplicationMeta"`
235 235
 	// IncludeStrategy specifies whether to include the deployment Strategy.
236
-	IncludeStrategy bool `json:"includeStrategy`
236
+	IncludeStrategy bool `json:"includeStrategy"`
237 237
 }
... ...
@@ -260,7 +260,7 @@ func TestValidateDeploymentConfigRollbackOK(t *testing.T) {
260 260
 	}
261 261
 
262 262
 	if e, a := "ReplicationController", rollback.Spec.From.Kind; e != a {
263
-		t.Errorf("expected kind %s, got %s")
263
+		t.Errorf("expected kind %s, got %s", e, a)
264 264
 	}
265 265
 }
266 266
 
... ...
@@ -48,7 +48,7 @@ func (c *DeploymentConfigChangeController) Handle(config *deployapi.DeploymentCo
48 48
 		_, _, err := c.generateDeployment(config)
49 49
 		if err != nil {
50 50
 			if kerrors.IsConflict(err) {
51
-				return fatalError(fmt.Sprintf("config %s updated since retrieval; aborting trigger", labelFor(config), err))
51
+				return fatalError(fmt.Sprintf("config %s updated since retrieval; aborting trigger: %v", labelFor(config), err))
52 52
 			}
53 53
 			return fmt.Errorf("couldn't create initial deployment for config %s: %v", labelFor(config), err)
54 54
 		}
... ...
@@ -164,7 +164,7 @@ func TestGetDeploymentOk(t *testing.T) {
164 164
 		t.Error("Unexpected nil deployment")
165 165
 	}
166 166
 	if err != nil {
167
-		t.Errorf("Unexpected non-nil error", err)
167
+		t.Errorf("Unexpected non-nil error: %v", err)
168 168
 	}
169 169
 	if deployment.(*api.Deployment).Name != "foo" {
170 170
 		t.Errorf("Unexpected deployment: %#v", deployment)
... ...
@@ -168,7 +168,7 @@ func TestGetDeploymentConfigOK(t *testing.T) {
168 168
 		t.Error("Unexpected nil deploymentConfig")
169 169
 	}
170 170
 	if err != nil {
171
-		t.Errorf("Unexpected non-nil error", err)
171
+		t.Errorf("Unexpected non-nil error: %v", err)
172 172
 	}
173 173
 	if deploymentConfig.(*api.DeploymentConfig).Name != "foo" {
174 174
 		t.Errorf("Unexpected deploymentConfig: %#v", deploymentConfig)
... ...
@@ -276,7 +276,7 @@ func TestEtcdUpdateOkDeployments(t *testing.T) {
276 276
 	registry := NewTestEtcd(fakeClient)
277 277
 	err := registry.UpdateDeployment(kapi.NewDefaultContext(), &api.Deployment{ObjectMeta: kapi.ObjectMeta{Name: "foo"}})
278 278
 	if err != nil {
279
-		t.Error("Unexpected error: %#v", err)
279
+		t.Errorf("Unexpected error: %#v", err)
280 280
 	}
281 281
 }
282 282
 
... ...
@@ -507,7 +507,7 @@ func TestEtcdUpdateOkDeploymentConfig(t *testing.T) {
507 507
 	registry := NewTestEtcd(fakeClient)
508 508
 	err := registry.UpdateDeploymentConfig(kapi.NewDefaultContext(), &api.DeploymentConfig{ObjectMeta: kapi.ObjectMeta{Name: "foo"}})
509 509
 	if err != nil {
510
-		t.Error("Unexpected error %#v", err)
510
+		t.Errorf("Unexpected error %#v", err)
511 511
 	}
512 512
 }
513 513
 
... ...
@@ -467,7 +467,7 @@ func LabelsFromSpec(spec []string) (map[string]string, []string, error) {
467 467
 		} else if strings.HasSuffix(labelSpec, "-") {
468 468
 			remove = append(remove, labelSpec[:len(labelSpec)-1])
469 469
 		} else {
470
-			return nil, nil, fmt.Errorf("unknown label spec: %v")
470
+			return nil, nil, fmt.Errorf("unknown label spec: %s", labelSpec)
471 471
 		}
472 472
 	}
473 473
 	for _, removeLabel := range remove {
... ...
@@ -101,7 +101,7 @@ func TestControllerRepoHandled(t *testing.T) {
101 101
 		t.Errorf("did not set annotation: %#v", repo)
102 102
 	}
103 103
 	if len(fake.Actions) != 1 {
104
-		t.Error("expected an update action: %#v", fake.Actions)
104
+		t.Errorf("expected an update action: %#v", fake.Actions)
105 105
 	}
106 106
 }
107 107
 
... ...
@@ -142,7 +142,7 @@ func TestControllerRepoTagsAlreadySet(t *testing.T) {
142 142
 		t.Errorf("did not set annotation: %#v", repo)
143 143
 	}
144 144
 	if len(fake.Actions) != 1 {
145
-		t.Error("expected an update action: %#v", fake.Actions)
145
+		t.Errorf("expected an update action: %#v", fake.Actions)
146 146
 	}
147 147
 }
148 148
 
... ...
@@ -160,7 +160,7 @@ func TestControllerImageNotFoundError(t *testing.T) {
160 160
 		t.Errorf("did not set annotation: %#v", repo)
161 161
 	}
162 162
 	if len(fake.Actions) != 1 {
163
-		t.Error("expected an update action: %#v", fake.Actions)
163
+		t.Errorf("expected an update action: %#v", fake.Actions)
164 164
 	}
165 165
 }
166 166
 
... ...
@@ -186,7 +186,7 @@ func TestControllerImageWithGenericError(t *testing.T) {
186 186
 		t.Errorf("did not expect annotation: %#v", repo)
187 187
 	}
188 188
 	if len(fake.Actions) != 0 {
189
-		t.Error("expected no update action: %#v", fake.Actions)
189
+		t.Errorf("expected no update action: %#v", fake.Actions)
190 190
 	}
191 191
 }
192 192
 
... ...
@@ -215,7 +215,7 @@ func TestControllerWithImage(t *testing.T) {
215 215
 		t.Fatalf("did not set annotation: %#v", repo)
216 216
 	}
217 217
 	if len(fake.Actions) != 2 {
218
-		t.Error("expected an update action: %#v", fake.Actions)
218
+		t.Errorf("expected an update action: %#v", fake.Actions)
219 219
 	}
220 220
 }
221 221
 
... ...
@@ -247,7 +247,7 @@ func TestControllerWithEmptyTag(t *testing.T) {
247 247
 		t.Fatalf("did not set annotation: %#v", repo)
248 248
 	}
249 249
 	if len(fake.Actions) != 2 {
250
-		t.Error("expected an update action: %#v", fake.Actions)
250
+		t.Errorf("expected an update action: %#v", fake.Actions)
251 251
 	}
252 252
 }
253 253
 
... ...
@@ -228,6 +228,6 @@ func TestDeleteValid(t *testing.T) {
228 228
 	}
229 229
 
230 230
 	if registry.DeletedAccessTokenName != "foo" {
231
-		t.Error("Unexpected access token deleted: %s", registry.DeletedAccessTokenName)
231
+		t.Errorf("Unexpected access token deleted: %s", registry.DeletedAccessTokenName)
232 232
 	}
233 233
 }
... ...
@@ -228,6 +228,6 @@ func TestDeleteValid(t *testing.T) {
228 228
 	}
229 229
 
230 230
 	if registry.DeletedAuthorizeTokenName != "foo" {
231
-		t.Error("Unexpected access token deleted: %s", registry.DeletedAuthorizeTokenName)
231
+		t.Errorf("Unexpected access token deleted: %s", registry.DeletedAuthorizeTokenName)
232 232
 	}
233 233
 }
... ...
@@ -219,6 +219,6 @@ func TestDeleteValid(t *testing.T) {
219 219
 	}
220 220
 
221 221
 	if registry.DeletedClientName != "foo" {
222
-		t.Error("Unexpected client deleted: %s", registry.DeletedClientName)
222
+		t.Errorf("Unexpected client deleted: %s", registry.DeletedClientName)
223 223
 	}
224 224
 }
... ...
@@ -135,7 +135,7 @@ func TestGetProjectOK(t *testing.T) {
135 135
 		t.Error("Unexpected nil project")
136 136
 	}
137 137
 	if err != nil {
138
-		t.Errorf("Unexpected non-nil error", err)
138
+		t.Errorf("Unexpected non-nil error: %v", err)
139 139
 	}
140 140
 	if project.(*api.Project).Name != "foo" {
141 141
 		t.Errorf("Unexpected project: %#v", project)
... ...
@@ -151,7 +151,7 @@ func TestGetRouteOK(t *testing.T) {
151 151
 		t.Error("Unexpected nil route")
152 152
 	}
153 153
 	if err != nil {
154
-		t.Errorf("Unexpected non-nil error", err)
154
+		t.Errorf("Unexpected non-nil error: %v", err)
155 155
 	}
156 156
 	if route.(*api.Route).Name != "foo" {
157 157
 		t.Errorf("Unexpected route: %#v", route)