Move from go-yaml/yaml to ghodss/yaml
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"reflect"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||
@@ -138,6 +139,14 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
|
||||
c.RandString(): c.RandString(),
|
||||
}
|
||||
},
|
||||
func(t *time.Time, c fuzz.Continue) {
|
||||
// This is necessary because the standard fuzzed time.Time object is
|
||||
// completely nil, but when JSON unmarshals dates it fills in the
|
||||
// unexported loc field with the time.UTC object, resulting in
|
||||
// reflect.DeepEqual returning false in the round trip tests. We solve it
|
||||
// by using a date that will be identical to the one JSON unmarshals.
|
||||
*t = time.Date(2000, 1, 1, 1, 1, 1, 0, time.UTC)
|
||||
},
|
||||
)
|
||||
|
||||
func runTest(t *testing.T, codec runtime.Codec, source runtime.Object) {
|
||||
@@ -162,7 +171,7 @@ func runTest(t *testing.T, codec runtime.Codec, source runtime.Object) {
|
||||
return
|
||||
}
|
||||
if !reflect.DeepEqual(source, obj2) {
|
||||
t.Errorf("1: %v: diff: %v\nCodec: %v\nData: %s\nSource: %#v", name, util.ObjectDiff(source, obj2), codec, string(data), source)
|
||||
t.Errorf("1: %v: diff: %v\nCodec: %v\nData: %s\nSource: %#v", name, util.ObjectGoPrintDiff(source, obj2), codec, string(data), source)
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user