mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Export PrintOptions struct
This commit is contained in:
@@ -213,12 +213,12 @@ func TestJSONPrinter(t *testing.T) {
|
||||
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)
|
||||
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")
|
||||
}
|
||||
|
||||
@@ -755,7 +755,7 @@ func TestPrintHumanReadableService(t *testing.T) {
|
||||
|
||||
for _, svc := range tests {
|
||||
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())
|
||||
ip := svc.Spec.ClusterIP
|
||||
if !strings.Contains(output, ip) {
|
||||
@@ -1044,7 +1044,7 @@ func TestPrintPod(t *testing.T) {
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
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
|
||||
if !strings.HasPrefix(buf.String(), test.expect) {
|
||||
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
|
||||
@@ -1137,7 +1137,7 @@ func TestPrintNonTerminatedPod(t *testing.T) {
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
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
|
||||
if !strings.HasPrefix(buf.String(), test.expect) {
|
||||
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
|
||||
@@ -1197,7 +1197,7 @@ func TestPrintPodWithLabels(t *testing.T) {
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
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
|
||||
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())
|
||||
@@ -1259,7 +1259,7 @@ func TestPrintDeployment(t *testing.T) {
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
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 {
|
||||
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user