Commit e963e4ad authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #19866 from liggitt/export_printoptions

Auto commit by PR queue bot
parents 2d061aa1 5a59dac0
...@@ -213,12 +213,12 @@ func TestJSONPrinter(t *testing.T) { ...@@ -213,12 +213,12 @@ func TestJSONPrinter(t *testing.T) {
testPrinter(t, &JSONPrinter{}, json.Unmarshal) testPrinter(t, &JSONPrinter{}, json.Unmarshal)
} }
func PrintCustomType(obj *TestPrintType, w io.Writer, options printOptions) error { func PrintCustomType(obj *TestPrintType, w io.Writer, options PrintOptions) error {
_, err := fmt.Fprintf(w, "%s", obj.Data) _, err := fmt.Fprintf(w, "%s", obj.Data)
return err return err
} }
func ErrorPrintHandler(obj *TestPrintType, w io.Writer, options printOptions) error { func ErrorPrintHandler(obj *TestPrintType, w io.Writer, options PrintOptions) error {
return fmt.Errorf("ErrorPrintHandler error") return fmt.Errorf("ErrorPrintHandler error")
} }
...@@ -755,7 +755,7 @@ func TestPrintHumanReadableService(t *testing.T) { ...@@ -755,7 +755,7 @@ func TestPrintHumanReadableService(t *testing.T) {
for _, svc := range tests { for _, svc := range tests {
buff := bytes.Buffer{} buff := bytes.Buffer{}
printService(&svc, &buff, printOptions{false, false, false, false, false, []string{}}) printService(&svc, &buff, PrintOptions{false, false, false, false, false, []string{}})
output := string(buff.Bytes()) output := string(buff.Bytes())
ip := svc.Spec.ClusterIP ip := svc.Spec.ClusterIP
if !strings.Contains(output, ip) { if !strings.Contains(output, ip) {
...@@ -1044,7 +1044,7 @@ func TestPrintPod(t *testing.T) { ...@@ -1044,7 +1044,7 @@ func TestPrintPod(t *testing.T) {
buf := bytes.NewBuffer([]byte{}) buf := bytes.NewBuffer([]byte{})
for _, test := range tests { for _, test := range tests {
printPod(&test.pod, buf, printOptions{false, false, false, true, false, []string{}}) printPod(&test.pod, buf, PrintOptions{false, false, false, true, false, []string{}})
// We ignore time // We ignore time
if !strings.HasPrefix(buf.String(), test.expect) { if !strings.HasPrefix(buf.String(), test.expect) {
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
...@@ -1137,7 +1137,7 @@ func TestPrintNonTerminatedPod(t *testing.T) { ...@@ -1137,7 +1137,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
buf := bytes.NewBuffer([]byte{}) buf := bytes.NewBuffer([]byte{})
for _, test := range tests { for _, test := range tests {
printPod(&test.pod, buf, printOptions{false, false, false, false, false, []string{}}) printPod(&test.pod, buf, PrintOptions{false, false, false, false, false, []string{}})
// We ignore time // We ignore time
if !strings.HasPrefix(buf.String(), test.expect) { if !strings.HasPrefix(buf.String(), test.expect) {
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
...@@ -1197,7 +1197,7 @@ func TestPrintPodWithLabels(t *testing.T) { ...@@ -1197,7 +1197,7 @@ func TestPrintPodWithLabels(t *testing.T) {
buf := bytes.NewBuffer([]byte{}) buf := bytes.NewBuffer([]byte{})
for _, test := range tests { for _, test := range tests {
printPod(&test.pod, buf, printOptions{false, false, false, false, false, test.labelColumns}) printPod(&test.pod, buf, PrintOptions{false, false, false, false, false, test.labelColumns})
// We ignore time // We ignore time
if !strings.HasPrefix(buf.String(), test.startsWith) || !strings.HasSuffix(buf.String(), test.endsWith) { if !strings.HasPrefix(buf.String(), test.startsWith) || !strings.HasSuffix(buf.String(), test.endsWith) {
t.Fatalf("Expected to start with: %s and end with: %s, but got: %s", test.startsWith, test.endsWith, buf.String()) t.Fatalf("Expected to start with: %s and end with: %s, but got: %s", test.startsWith, test.endsWith, buf.String())
...@@ -1259,7 +1259,7 @@ func TestPrintDeployment(t *testing.T) { ...@@ -1259,7 +1259,7 @@ func TestPrintDeployment(t *testing.T) {
buf := bytes.NewBuffer([]byte{}) buf := bytes.NewBuffer([]byte{})
for _, test := range tests { for _, test := range tests {
printDeployment(&test.deployment, buf, printOptions{false, false, false, true, false, []string{}}) printDeployment(&test.deployment, buf, PrintOptions{false, false, false, true, false, []string{}})
if buf.String() != test.expect { if buf.String() != test.expect {
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String()) t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment