Change CreationTimestamp to a util.Time and set in each storage implementation

Because time.Time doesn't work correctly with our YAML package, it is necessary
to introduce a type, util.Time, which serializes correctly to JSON and YAML.

Eventually we would like timestamping to cut across storage implementations;
for now, we set it in each storage.
This commit is contained in:
Paul Morie
2014-08-12 15:14:00 -04:00
parent 9355fae71e
commit c69160059b
10 changed files with 262 additions and 22 deletions

View File

@@ -43,7 +43,11 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
// only when all 8 bytes are set.
j.ResourceVersion = c.RandUint64() >> 8
j.SelfLink = c.RandString()
j.CreationTimestamp = c.RandString()
var sec, nsec int64
c.Fuzz(&sec)
c.Fuzz(&nsec)
j.CreationTimestamp = util.Unix(sec, nsec).Rfc3339Copy()
},
func(intstr *util.IntOrString, c fuzz.Continue) {
// util.IntOrString will panic if its kind is set wrong.
@@ -113,6 +117,7 @@ func runTest(t *testing.T, source interface{}) {
t.Errorf("%v: %v (%#v)", name, err, source)
return
}
obj2, err := Decode(data)
if err != nil {
t.Errorf("%v: %v", name, err)