mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-09 15:14:52 +02:00
zfs: ability to specify sources for zfsGet
fix use for Placeholder, leave rest as previous behavior
This commit is contained in:
@ -30,3 +30,41 @@ func TestDatasetPathTrimNPrefixComps(t *testing.T) {
|
||||
p.TrimNPrefixComps((1))
|
||||
assert.True(t, p.Empty(), "empty trimming shouldn't do harm")
|
||||
}
|
||||
|
||||
func TestZFSPropertySource(t *testing.T) {
|
||||
|
||||
tcs := []struct{
|
||||
in zfsPropertySource
|
||||
exp []string
|
||||
}{
|
||||
{
|
||||
in: sourceAny,
|
||||
exp: []string{"local", "default", "inherited", "-", "temporary"},
|
||||
},
|
||||
{
|
||||
in: sourceTemporary,
|
||||
exp: []string{"temporary"},
|
||||
},
|
||||
{
|
||||
in: sourceLocal|sourceInherited,
|
||||
exp: []string{"local", "inherited"},
|
||||
},
|
||||
}
|
||||
|
||||
toSet := func(in []string) map[string]struct{} {
|
||||
m := make(map[string]struct{}, len(in))
|
||||
for _, s := range in {
|
||||
m[s] = struct{}{}
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
for _, tc := range tcs {
|
||||
|
||||
res := tc.in.zfsGetSourceFieldPrefixes()
|
||||
resSet := toSet(res)
|
||||
expSet := toSet(tc.exp)
|
||||
assert.Equal(t, expSet, resSet)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user