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