zrepl/zfs/zfs_test.go

20 lines
419 B
Go
Raw Normal View History

package zfs
import (
"github.com/stretchr/testify/assert"
2017-04-26 20:25:53 +02:00
"testing"
)
func TestZFSListHandlesProducesZFSErrorOnNonZeroExit(t *testing.T) {
var err error
ZFS_BINARY = "./test_helpers/zfs_failer.sh"
_, err = ZFSList([]string{"fictionalprop"}, "nonexistent/dataset")
assert.Error(t, err)
zfsError, ok := err.(ZFSError)
assert.True(t, ok)
assert.Equal(t, "error: this is a mock\n", string(zfsError.Stderr))
}