kubectl: use bytes.Buffer.String
Signed-off-by: TommyStarK <thomasmilox@gmail.com> Kubernetes-commit: da4a8d831b933475cfdb20cb7e6d0ed027d516eb
This commit is contained in:
parent
8ea3943384
commit
e88f1b3589
|
|
@ -163,7 +163,7 @@ func TestCreateClusterRole(t *testing.T) {
|
|||
cmd.Run(cmd, []string{clusterRoleName})
|
||||
actual := &rbac.ClusterRole{}
|
||||
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), buf.Bytes(), actual); err != nil {
|
||||
t.Log(string(buf.Bytes()))
|
||||
t.Log(buf.String())
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !equality.Semantic.DeepEqual(test.expectedClusterRole, actual) {
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ func TestLabelErrors(t *testing.T) {
|
|||
return
|
||||
}
|
||||
if buf.Len() > 0 {
|
||||
t.Errorf("buffer should be empty: %s", string(buf.Bytes()))
|
||||
t.Errorf("buffer should be empty: %s", buf.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ func TestSetEnvLocal(t *testing.T) {
|
|||
err = opts.RunEnv()
|
||||
assert.NoError(t, err)
|
||||
if bufErr.Len() > 0 {
|
||||
t.Errorf("unexpected error: %s", string(bufErr.String()))
|
||||
t.Errorf("unexpected error: %s", bufErr.String())
|
||||
}
|
||||
if !strings.Contains(buf.String(), "replicationcontroller/cassandra") {
|
||||
t.Errorf("did not set env: %s", buf.String())
|
||||
|
|
@ -109,7 +109,7 @@ func TestSetEnvLocalNamespace(t *testing.T) {
|
|||
err = opts.RunEnv()
|
||||
assert.NoError(t, err)
|
||||
if bufErr.Len() > 0 {
|
||||
t.Errorf("unexpected error: %s", string(bufErr.String()))
|
||||
t.Errorf("unexpected error: %s", bufErr.String())
|
||||
}
|
||||
if !strings.Contains(buf.String(), "namespace: existing-ns") {
|
||||
t.Errorf("did not set env: %s", buf.String())
|
||||
|
|
@ -146,7 +146,7 @@ func TestSetMultiResourcesEnvLocal(t *testing.T) {
|
|||
err = opts.RunEnv()
|
||||
assert.NoError(t, err)
|
||||
if bufErr.Len() > 0 {
|
||||
t.Errorf("unexpected error: %s", string(bufErr.String()))
|
||||
t.Errorf("unexpected error: %s", bufErr.String())
|
||||
}
|
||||
expectedOut := "replicationcontroller/first-rc\nreplicationcontroller/second-rc\n"
|
||||
if buf.String() != expectedOut {
|
||||
|
|
|
|||
|
|
@ -5205,8 +5205,7 @@ func tabbedString(f func(io.Writer) error) (string, error) {
|
|||
}
|
||||
|
||||
out.Flush()
|
||||
str := string(buf.String())
|
||||
return str, nil
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
type SortableResourceNames []corev1.ResourceName
|
||||
|
|
|
|||
|
|
@ -464,8 +464,7 @@ func tabbedString(f func(io.Writer) error) (string, error) {
|
|||
}
|
||||
|
||||
out.Flush()
|
||||
str := string(buf.String())
|
||||
return str, nil
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
// getChangeCause returns the change-cause annotation of the input object
|
||||
|
|
|
|||
Loading…
Reference in New Issue