mirror of
https://github.com/zrepl/zrepl.git
synced 2025-05-16 23:00:47 +02:00
replication/pdu: fix broken test
This commit is contained in:
parent
308e5e35fb
commit
8eade3d20a
@ -3,6 +3,7 @@ package pdu
|
|||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFilesystemVersion_RelName(t *testing.T) {
|
func TestFilesystemVersion_RelName(t *testing.T) {
|
||||||
@ -13,11 +14,13 @@ func TestFilesystemVersion_RelName(t *testing.T) {
|
|||||||
Panic bool
|
Panic bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creat := FilesystemVersionCreation(time.Now())
|
||||||
tcs := []TestCase{
|
tcs := []TestCase{
|
||||||
{
|
{
|
||||||
In: FilesystemVersion{
|
In: FilesystemVersion{
|
||||||
Type: FilesystemVersion_Snapshot,
|
Type: FilesystemVersion_Snapshot,
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
|
Creation: creat,
|
||||||
},
|
},
|
||||||
Out: "@foobar",
|
Out: "@foobar",
|
||||||
},
|
},
|
||||||
@ -25,6 +28,7 @@ func TestFilesystemVersion_RelName(t *testing.T) {
|
|||||||
In: FilesystemVersion{
|
In: FilesystemVersion{
|
||||||
Type: FilesystemVersion_Bookmark,
|
Type: FilesystemVersion_Bookmark,
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
|
Creation: creat,
|
||||||
},
|
},
|
||||||
Out: "#foobar",
|
Out: "#foobar",
|
||||||
},
|
},
|
||||||
@ -32,6 +36,7 @@ func TestFilesystemVersion_RelName(t *testing.T) {
|
|||||||
In: FilesystemVersion{
|
In: FilesystemVersion{
|
||||||
Type: 2342,
|
Type: 2342,
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
|
Creation: creat,
|
||||||
},
|
},
|
||||||
Panic: true,
|
Panic: true,
|
||||||
},
|
},
|
||||||
@ -53,12 +58,11 @@ func TestFilesystemVersion_RelName(t *testing.T) {
|
|||||||
func TestFilesystemVersion_ZFSFilesystemVersion(t *testing.T) {
|
func TestFilesystemVersion_ZFSFilesystemVersion(t *testing.T) {
|
||||||
|
|
||||||
empty := &FilesystemVersion{}
|
empty := &FilesystemVersion{}
|
||||||
emptyZFS := empty.ZFSFilesystemVersion()
|
_, err:= empty.ZFSFilesystemVersion()
|
||||||
assert.Zero(t, emptyZFS.Creation)
|
assert.Error(t, err)
|
||||||
|
|
||||||
dateInvalid := &FilesystemVersion{Creation: "foobar"}
|
dateInvalid := &FilesystemVersion{Creation: "foobar"}
|
||||||
assert.Panics(t, func() {
|
_, err = dateInvalid.ZFSFilesystemVersion()
|
||||||
dateInvalid.ZFSFilesystemVersion()
|
assert.Error(t, err)
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user