From 8eade3d20a2b64e8083d585763ff56161970fb16 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Tue, 4 Sep 2018 17:01:46 -0700 Subject: [PATCH] replication/pdu: fix broken test --- replication/pdu/pdu_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/replication/pdu/pdu_test.go b/replication/pdu/pdu_test.go index 6a1d596..79315a6 100644 --- a/replication/pdu/pdu_test.go +++ b/replication/pdu/pdu_test.go @@ -3,6 +3,7 @@ package pdu import ( "github.com/stretchr/testify/assert" "testing" + "time" ) func TestFilesystemVersion_RelName(t *testing.T) { @@ -13,11 +14,13 @@ func TestFilesystemVersion_RelName(t *testing.T) { Panic bool } + creat := FilesystemVersionCreation(time.Now()) tcs := []TestCase{ { In: FilesystemVersion{ Type: FilesystemVersion_Snapshot, Name: "foobar", + Creation: creat, }, Out: "@foobar", }, @@ -25,6 +28,7 @@ func TestFilesystemVersion_RelName(t *testing.T) { In: FilesystemVersion{ Type: FilesystemVersion_Bookmark, Name: "foobar", + Creation: creat, }, Out: "#foobar", }, @@ -32,6 +36,7 @@ func TestFilesystemVersion_RelName(t *testing.T) { In: FilesystemVersion{ Type: 2342, Name: "foobar", + Creation: creat, }, Panic: true, }, @@ -53,12 +58,11 @@ func TestFilesystemVersion_RelName(t *testing.T) { func TestFilesystemVersion_ZFSFilesystemVersion(t *testing.T) { empty := &FilesystemVersion{} - emptyZFS := empty.ZFSFilesystemVersion() - assert.Zero(t, emptyZFS.Creation) + _, err:= empty.ZFSFilesystemVersion() + assert.Error(t, err) dateInvalid := &FilesystemVersion{Creation: "foobar"} - assert.Panics(t, func() { - dateInvalid.ZFSFilesystemVersion() - }) + _, err = dateInvalid.ZFSFilesystemVersion() + assert.Error(t, err) }