From 6012f5047d4563576128b1d302b6c12c9f1a3221 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 25 Jul 2017 13:59:16 -0700 Subject: [PATCH] Update storage kind test Testing proto and snapshot kinds are equivalent when cast to each other. Signed-off-by: Derek McGowan --- snapshot/storage/bolt_test.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/snapshot/storage/bolt_test.go b/snapshot/storage/bolt_test.go index 17d1a9596..cacbab270 100644 --- a/snapshot/storage/bolt_test.go +++ b/snapshot/storage/bolt_test.go @@ -18,15 +18,28 @@ func TestMetastore(t *testing.T) { // TestKidnConversion ensures we can blindly cast from protobuf types. func TestKindConversion(t *testing.T) { - for _, testcase := range []snapshot.Kind{ - snapshot.KindView, - snapshot.KindActive, - snapshot.KindCommitted, + for _, testcase := range []struct { + s snapshot.Kind + p proto.Kind + }{ + { + s: snapshot.KindView, + p: proto.KindView, + }, + { + s: snapshot.KindActive, + p: proto.KindActive, + }, + { + s: snapshot.KindCommitted, + p: proto.KindCommitted, + }, } { - cast := proto.Kind(testcase) - uncast := snapshot.Kind(cast) - if uncast != testcase { - t.Fatalf("kind value cast failed: %v != %v", uncast, testcase) + if testcase.s != snapshot.Kind(testcase.p) { + t.Fatalf("snapshot kind value cast failed: %v != %v", testcase.s, testcase.p) + } + if testcase.p != proto.Kind(testcase.s) { + t.Fatalf("proto kind value cast failed: %v != %v", testcase.s, testcase.p) } } }