From 9f76f1320505727383ab16deb46629d9fe96fd3b Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 11 Jun 2014 12:50:01 -0700 Subject: [PATCH] gofmt --- pkg/util/fake_handler_test.go | 32 +++++++++++++++----------------- pkg/util/util_test.go | 15 +++++++-------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/pkg/util/fake_handler_test.go b/pkg/util/fake_handler_test.go index a9ca5655d89..c5c4d00d509 100644 --- a/pkg/util/fake_handler_test.go +++ b/pkg/util/fake_handler_test.go @@ -4,7 +4,7 @@ import ( "bytes" "net/http" "net/http/httptest" - "testing" + "testing" ) func expectNoError(t *testing.T, err error) { @@ -19,13 +19,13 @@ func TestFakeHandlerPath(t *testing.T) { method := "GET" path := "/foo/bar" body := "somebody" - - req, err := http.NewRequest(method, server.URL + path, bytes.NewBufferString(body)); + + req, err := http.NewRequest(method, server.URL+path, bytes.NewBufferString(body)) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) expectNoError(t, err) - + handler.ValidateRequest(t, path, method, &body) } @@ -34,18 +34,18 @@ func TestFakeHandlerPathNoBody(t *testing.T) { server := httptest.NewServer(&handler) method := "GET" path := "/foo/bar" - - req, err := http.NewRequest(method, server.URL + path, nil); + + req, err := http.NewRequest(method, server.URL+path, nil) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) expectNoError(t, err) - + handler.ValidateRequest(t, path, method, nil) } type fakeError struct { - errors[] string + errors []string } func (f *fakeError) Errorf(format string, args ...interface{}) { @@ -59,12 +59,12 @@ func TestFakeHandlerWrongPath(t *testing.T) { path := "/foo/bar" fakeT := fakeError{} - req, err := http.NewRequest(method, server.URL + "/foo/baz", nil); + req, err := http.NewRequest(method, server.URL+"/foo/baz", nil) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) expectNoError(t, err) - + handler.ValidateRequest(&fakeT, path, method, nil) if len(fakeT.errors) != 1 { t.Errorf("Unexpected error set: %#v", fakeT.errors) @@ -78,12 +78,12 @@ func TestFakeHandlerWrongMethod(t *testing.T) { path := "/foo/bar" fakeT := fakeError{} - req, err := http.NewRequest("PUT", server.URL + path, nil); + req, err := http.NewRequest("PUT", server.URL+path, nil) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) expectNoError(t, err) - + handler.ValidateRequest(&fakeT, path, method, nil) if len(fakeT.errors) != 1 { t.Errorf("Unexpected error set: %#v", fakeT.errors) @@ -98,12 +98,12 @@ func TestFakeHandlerWrongBody(t *testing.T) { body := "somebody" fakeT := fakeError{} - req, err := http.NewRequest(method, server.URL + path, bytes.NewBufferString(body)); + req, err := http.NewRequest(method, server.URL+path, bytes.NewBufferString(body)) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) expectNoError(t, err) - + otherbody := "otherbody" handler.ValidateRequest(&fakeT, path, method, &otherbody) if len(fakeT.errors) != 1 { @@ -119,7 +119,7 @@ func TestFakeHandlerNilBody(t *testing.T) { body := "somebody" fakeT := fakeError{} - req, err := http.NewRequest(method, server.URL + path, nil); + req, err := http.NewRequest(method, server.URL+path, nil) expectNoError(t, err) client := http.Client{} _, err = client.Do(req) @@ -130,5 +130,3 @@ func TestFakeHandlerNilBody(t *testing.T) { t.Errorf("Unexpected error set: %#v", fakeT.errors) } } - - diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 1098a3fd300..3e8aeabac6f 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -2,22 +2,22 @@ package util import ( "encoding/json" - "testing" - - "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + "testing" + + "github.com/GoogleCloudPlatform/kubernetes/pkg/api" ) func TestMakeJSONString(t *testing.T) { pod := api.Pod{ - JSONBase: api.JSONBase{ ID: "foo" }, + JSONBase: api.JSONBase{ID: "foo"}, Labels: map[string]string{ "foo": "bar", "baz": "blah", }, } - + body := MakeJSONString(pod) - + expectedBody, err := json.Marshal(pod) expectNoError(t, err) if string(expectedBody) != body { @@ -30,7 +30,7 @@ func TestHandleCrash(t *testing.T) { expect := 10 for i := 0; i < expect; i = i + 1 { defer HandleCrash() - if i % 2 == 0 { + if i%2 == 0 { panic("Test Panic") } count = count + 1 @@ -39,4 +39,3 @@ func TestHandleCrash(t *testing.T) { t.Errorf("Expected %d iterations, found %d", expect, count) } } -