Move the mount duplicate filter to the modules package

Also simplify the mount validation logic. There are plenty of ways a user can create mount configs that behaves oddly.
This commit is contained in:
Bjørn Erik Pedersen 2019-07-31 08:21:17 +02:00
parent edf9f0a354
commit 4b6c5eba30
6 changed files with 154 additions and 123 deletions

View file

@ -36,3 +36,19 @@ func TestPathKey(t *testing.T) {
}
}
func TestFilterUnwantedMounts(t *testing.T) {
mounts := []Mount{
Mount{Source: "a", Target: "b", Lang: "en"},
Mount{Source: "a", Target: "b", Lang: "en"},
Mount{Source: "b", Target: "c", Lang: "en"},
}
filtered := filterUnwantedMounts(mounts)
assert := require.New(t)
assert.Len(filtered, 2)
assert.Equal([]Mount{Mount{Source: "a", Target: "b", Lang: "en"}, Mount{Source: "b", Target: "c", Lang: "en"}}, filtered)
}