mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-22 23:20:51 +01:00
35 lines
929 B
Go
35 lines
929 B
Go
|
package tests
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
|
||
|
"github.com/zrepl/zrepl/platformtest"
|
||
|
"github.com/zrepl/zrepl/zfs"
|
||
|
)
|
||
|
|
||
|
func ListFilesystemsNoFilter(t *platformtest.Context) {
|
||
|
platformtest.Run(t, platformtest.PanicErr, t.RootDataset, `
|
||
|
DESTROYROOT
|
||
|
CREATEROOT
|
||
|
R zfs create -V 10M "${ROOTDS}/bar baz"
|
||
|
+ "foo bar"
|
||
|
+ "foo bar/bar blup"
|
||
|
+ "foo bar/blah"
|
||
|
R zfs create -V 10M "${ROOTDS}/foo bar/blah/a volume"
|
||
|
`)
|
||
|
|
||
|
fss, err := zfs.ZFSListMapping(t, zfs.NoFilter())
|
||
|
require.NoError(t, err)
|
||
|
var onlyTestPool []*zfs.DatasetPath
|
||
|
for _, fs := range fss {
|
||
|
if strings.HasPrefix(fs.ToString(), t.RootDataset) {
|
||
|
onlyTestPool = append(onlyTestPool, fs)
|
||
|
}
|
||
|
}
|
||
|
onlyTestPoolStr := datasetToStringSortedTrimPrefix(mustDatasetPath(t.RootDataset), onlyTestPool)
|
||
|
require.Equal(t, []string{"bar baz", "foo bar", "foo bar/bar blup", "foo bar/blah", "foo bar/blah/a volume"}, onlyTestPoolStr)
|
||
|
|
||
|
}
|