Skip to content

Commit

Permalink
Merge pull request kubernetes#112093 from HecarimV/fix-2282915
Browse files Browse the repository at this point in the history
test: use bytes.Buffer.String
  • Loading branch information
k8s-ci-robot authored Sep 7, 2022
2 parents ed96734 + f55d658 commit 1ab4021
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestErrors(t *testing.T) {
for _, test := range cases {
observer := httptest.NewRecorder()
fns[test.fn](observer, &http.Request{RequestURI: test.uri})
result := string(observer.Body.Bytes())
result := observer.Body.String()
if result != test.expected {
t.Errorf("%s(..., %q) != %q, got %q", test.fn, test.uri, test.expected, result)
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestForbidden(t *testing.T) {
scheme := runtime.NewScheme()
negotiatedSerializer := serializer.NewCodecFactory(scheme).WithoutConversion()
Forbidden(request.NewDefaultContext(), test.attributes, observer, &http.Request{URL: &url.URL{Path: "/path"}}, test.reason, negotiatedSerializer)
result := string(observer.Body.Bytes())
result := observer.Body.String()
if result != test.expected {
t.Errorf("Forbidden response body(%#v...)\n expected: %v\ngot: %v", test.attributes, test.expected, result)
}
Expand Down

0 comments on commit 1ab4021

Please sign in to comment.