Change:
When draining a node, using kubectl drain [NODE], the output resembles this: Expected output should indicate that the node was drained, for example: kubectl drain [NODE] No response <details</details<detailsCan reproduce locally using and printing the output </details<details</details<details</details<details</details<details</details
/sig cli
/triage accepted

Discussion:
return err } <del> printObj, err := o.ToPrinter("drained") if err != nil { return err } </del> drainedNodes := sets.NewString() var fatal error for _, info := range o.nodeInfos { if err := o.deleteOrEvictPodsSimple(info); err == nil { drainedNodes.Insert(info.Name) <ins> printObj, err := o.ToPrinter("drained") if err != nil { return err } </ins> printObj(info.Object, o.Out) } else { if o.drainer.IgnoreErrors && len(o.nodeInfos) > 1 {

expectWarning              string expectFatal                bool expectDelete               bool <ins> expectOutputToContain      string </ins> }{ { <del> description:  "RC-managed pod", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{rcPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "RC-managed pod", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{rcPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { description:  "DS-managed pod",

expectDelete: false, }, { <del> description:  "DS-managed terminated pod", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{dsTerminatedPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "DS-managed terminated pod", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{dsTerminatedPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { description:  "orphaned DS-managed pod",

expectDelete: false, }, { <del> description:   "orphaned DS-managed pod with --force", node:          node, expected:      cordonedNode, pods:          []corev1.Pod{orphanedDsPod}, rcs:           []corev1.ReplicationController{}, args:          []string{"node", "--force"}, expectFatal:   false, expectDelete:  true, expectWarning: "WARNING: deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: default/bar", </del> <ins> description:           "orphaned DS-managed pod with --force", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{orphanedDsPod}, rcs:                   []corev1.ReplicationController{}, args:                  []string{"node", "--force"}, expectFatal:           false, expectDelete:          true, expectWarning:         "WARNING: deleting Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: default/bar", expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "DS-managed pod with --ignore-daemonsets", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{dsPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node", "--ignore-daemonsets"}, expectFatal:  false, expectDelete: false, </del> <ins> description:           "DS-managed pod with --ignore-daemonsets", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{dsPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node", "--ignore-daemonsets"}, expectFatal:           false, expectDelete:          false, expectOutputToContain: "node/node drained", </ins> }, { <del> description:   "DS-managed pod with emptyDir with --ignore-daemonsets", node:          node, expected:      cordonedNode, pods:          []corev1.Pod{dsPodWithEmptyDir}, rcs:           []corev1.ReplicationController{rc}, args:          []string{"node", "--ignore-daemonsets"}, expectWarning: "WARNING: ignoring DaemonSet-managed Pods: default/bar", expectFatal:   false, expectDelete:  false, </del> <ins> description:           "DS-managed pod with emptyDir with --ignore-daemonsets", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{dsPodWithEmptyDir}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node", "--ignore-daemonsets"}, expectWarning:         "WARNING: ignoring DaemonSet-managed Pods: default/bar", expectFatal:           false, expectDelete:          false, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "Job-managed pod with local storage", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{jobPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node", "--force", "--delete-emptydir-data=true"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "Job-managed pod with local storage", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{jobPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node", "--force", "--delete-emptydir-data=true"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "Ensure compatibility for --delete-local-data until fully deprecated", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{jobPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node", "--force", "--delete-local-data=true"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "Ensure compatibility for --delete-local-data until fully deprecated", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{jobPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node", "--force", "--delete-local-data=true"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "Job-managed terminated pod", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{terminatedJobPodWithLocalStorage}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "Job-managed terminated pod", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{terminatedJobPodWithLocalStorage}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "RS-managed pod", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{rsPod}, replicaSets:  []appsv1.ReplicaSet{rs}, args:         []string{"node"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "RS-managed pod", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{rsPod}, replicaSets:           []appsv1.ReplicaSet{rs}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { description:  "naked pod",

expectDelete: false, }, { <del> description:  "naked pod with --force", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{nakedPod}, rcs:          []corev1.ReplicationController{}, args:         []string{"node", "--force"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "naked pod with --force", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{nakedPod}, rcs:                   []corev1.ReplicationController{}, args:                  []string{"node", "--force"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { description:  "pod with EmptyDir",

expectDelete: false, }, { <del> description:  "terminated pod with emptyDir", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{emptydirTerminatedPod}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "terminated pod with emptyDir", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{emptydirTerminatedPod}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "pod with EmptyDir and --delete-emptydir-data", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{emptydirPod}, args:         []string{"node", "--force", "--delete-emptydir-data=true"}, expectFatal:  false, expectDelete: true, </del> <ins> description:           "pod with EmptyDir and --delete-emptydir-data", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{emptydirPod}, args:                  []string{"node", "--force", "--delete-emptydir-data=true"}, expectFatal:           false, expectDelete:          true, expectOutputToContain: "node/node drained", </ins> }, { <del> description:  "empty node", node:         node, expected:     cordonedNode, pods:         []corev1.Pod{}, rcs:          []corev1.ReplicationController{rc}, args:         []string{"node"}, expectFatal:  false, expectDelete: false, </del> <ins> description:           "empty node", node:                  node, expected:              cordonedNode, pods:                  []corev1.Pod{}, rcs:                   []corev1.ReplicationController{rc}, args:                  []string{"node"}, expectFatal:           false, expectDelete:          false, expectOutputToContain: "node/node drained", </ins> }, { description:                "fail to list pods",

} tf.ClientConfigVal = cmdtesting.DefaultClientConfig() <del> ioStreams, _, _, errBuf := genericclioptions.NewTestIOStreams() </del> <ins> ioStreams, _, outBuf, errBuf := genericclioptions.NewTestIOStreams() </ins> cmd := NewCmdDrain(tf, ioStreams) var recovered interface{}

t.Fatalf("%s: actual warning message did not match expected warning message.n Expecting:n%vn  Got:n%v", test.description, e, a) } } <ins> if len(test.expectOutputToContain) > 0 { out := outBuf.String() if !strings.Contains(out, test.expectOutputToContain) { t.Fatalf("%s: expected output to contain: %snGot:n%s", test.description, test.expectOutputToContain, out) } } </ins> }) } }