Code change:
buf.Reset() } } <ins> func TestPrintCluster(t *testing.T) { tests := []struct { cluster    federation.Cluster expect     []metav1alpha1.TableRow showLabels bool }{ { federation.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name:              "cluster1", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, }, }, []metav1alpha1.TableRow{{Cells: []interface{}{"cluster1", "Unknown", "0s"}}}, false, }, { federation.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name:              "cluster2", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, Labels:            map[string]string{"label1": "", "label2": "cluster"}, }, Status: federation.ClusterStatus{ Conditions: []federation.ClusterCondition{ { Status: api.ConditionTrue, Type:   federation.ClusterReady, }, { Status: api.ConditionFalse, Type:   federation.ClusterOffline, }, }, }, }, []metav1alpha1.TableRow{{Cells: []interface{}{"cluster2", "Ready,NotOffline", "0s", "label1=,label2=cluster"}}}, true, }, } for i, test := range tests { rows, err := printCluster(&test.cluster, printers.PrintOptions{ShowLabels: test.showLabels}) if err != nil { t.Fatal(err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(test.expect, rows) { t.Errorf("%d mismatch: %s", i, diff.ObjectReflectDiff(test.expect, rows)) } } } func TestPrintClusterList(t *testing.T) { tests := []struct { clusters   federation.ClusterList expect     []metav1alpha1.TableRow showLabels bool }{ // Test podList's pod: name, num of containers, restarts, container ready status { federation.ClusterList{ Items: []federation.Cluster{ { ObjectMeta: metav1.ObjectMeta{ Name:              "cluster1", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, }, Status: federation.ClusterStatus{ Conditions: []federation.ClusterCondition{ { Status: api.ConditionTrue, Type:   federation.ClusterReady, }, }, }, }, { ObjectMeta: metav1.ObjectMeta{ Name:              "cluster2", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, Labels:            map[string]string{"label1": "", "label2": "cluster2"}, }, Status: federation.ClusterStatus{ Conditions: []federation.ClusterCondition{ { Status: api.ConditionTrue, Type:   federation.ClusterReady, }, { Status: api.ConditionFalse, Type:   federation.ClusterOffline, }, }, }, }, }, }, []metav1alpha1.TableRow{{Cells: []interface{}{"cluster1", "Ready", "0s", "<none>"}}, {Cells: []interface{}{"cluster2", "Ready,NotOffline", "0s", "label1=,label2=cluster2"}}}, true, }, } for _, test := range tests { rows, err := printClusterList(&test.clusters, printers.PrintOptions{ShowLabels: test.showLabels}) if err != nil { t.Fatal(err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(test.expect, rows) { t.Errorf("mismatch: %s", diff.ObjectReflectDiff(test.expect, rows)) } } } </ins>

Related discussion:
text: Is this a BUG REPORT or FEATURE REQUEST?: /kind bug What happened: After labeling clusters in a Federation, when you type the field is empty. What you expected to happen: The fiels should contain information about the labels in the cluster How to reproduce it (as minimally and precisely as possible): a federation control pane in any Cloud Provider and any DNS provider your cluster: info aboyut the cluster with the flag: Note: if you describe it, you see the labels being : Environment: Kubernetes version (use ): 1.8.0 Cloud provider or hardware configuration**: anyone OS (e.g. from /etc/os-release): Ubuntu 16.04 Kernel (e.g. ): Linux Install tools: curl Others:
/sig multicluster
I'm working on it.