zfs: userrefs, platformtests for ListFilesystemVersions and ListMapping (likely needs fixup from next commit)

This commit is contained in:
Christian Schwarz
2020-04-05 19:12:20 +02:00
parent e82aea5862
commit b16a9ede46
12 changed files with 381 additions and 90 deletions
+24
View File
@@ -5,6 +5,7 @@ import (
"math/rand"
"os"
"path"
"sort"
"strings"
"github.com/stretchr/testify/require"
@@ -150,3 +151,26 @@ func makeResumeSituation(ctx *platformtest.Context, src dummySnapshotSituation,
return situation
}
func versionRelnamesSorted(versions []zfs.FilesystemVersion) []string {
var vstrs []string
for _, v := range versions {
vstrs = append(vstrs, v.RelName())
}
sort.Sort(sort.StringSlice(vstrs))
return vstrs
}
func datasetToStringSortedTrimPrefix(prefix *zfs.DatasetPath, paths []*zfs.DatasetPath) []string {
var pstrs []string
for _, p := range paths {
trimmed := p.Copy()
trimmed.TrimPrefix(prefix)
if trimmed.Length() == 0 {
continue
}
pstrs = append(pstrs, trimmed.ToString())
}
sort.Sort(sort.StringSlice(pstrs))
return pstrs
}