Fix keyring tests, working around Go nil timezone bug in DeepEqual

See https://github.com/golang/go/issues/10089
This commit is contained in:
Jeff Mitchell 2017-01-24 12:33:22 -05:00
parent 57fd902d93
commit 31ce37188b
1 changed files with 10 additions and 0 deletions

View File

@ -167,6 +167,11 @@ func TestKeyring_Serialize(t *testing.T) {
for i = 1; i < k.ActiveTerm(); i++ {
key1 := k2.TermKey(i)
key2 := k.TermKey(i)
// Work around timezone bug due to DeepEqual using == for comparison
if !key1.InstallTime.Equal(key2.InstallTime) {
t.Fatalf("bad: key 1:\n%#v\nkey 2:\n%#v", key1, key2)
}
key1.InstallTime = key2.InstallTime
if !reflect.DeepEqual(key1, key2) {
t.Fatalf("bad: key 1:\n%#v\nkey 2:\n%#v", key1, key2)
}
@ -191,6 +196,11 @@ func TestKey_Serialize(t *testing.T) {
t.Fatalf("err: %v", err)
}
// Work around timezone bug due to DeepEqual using == for comparison
if !k.InstallTime.Equal(out.InstallTime) {
t.Fatalf("bad: key 1:\n%#v\nkey 2:\n%#v", key1, key2)
}
if !reflect.DeepEqual(k, out) {
t.Fatalf("bad: %#v", out)
}