Ensure empty serialized slices are zero-length, not null

This commit is contained in:
Jordan Liggitt
2017-03-20 23:07:57 -04:00
parent e3f6f14bf0
commit 0e2f1b535d
7 changed files with 41 additions and 15 deletions

View File

@@ -25,12 +25,12 @@ import (
"os"
"os/user"
"path"
"reflect"
"sort"
"strings"
"testing"
"time"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -623,7 +623,7 @@ func TestGetFirstPod(t *testing.T) {
t.Errorf("%s: expected %d pods, got %d", test.name, test.expectedNum, numPods)
continue
}
if !reflect.DeepEqual(test.expected, pod) {
if !apiequality.Semantic.DeepEqual(test.expected, pod) {
t.Errorf("%s:\nexpected pod:\n%#v\ngot:\n%#v\n\n", test.name, test.expected, pod)
}
}