Implement DatasetMapping + basic ZFS list functionality.

This commit is contained in:
Christian Schwarz
2017-04-26 17:39:16 +02:00
parent 4494afe47f
commit 40f3b530e1
6 changed files with 384 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
package zfs
import (
"testing"
"github.com/stretchr/testify/assert"
)
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))
}