zrepl/zfs/zfs_test.go

22 lines
437 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("nonexistent/dataset", func(p DatasetPath) bool {
return true
})
assert.Error(t, err)
zfsError, ok := err.(ZFSError)
assert.True(t, ok)
assert.Equal(t, "error: this is a mock\n", string(zfsError.Stderr))
}