reduce restricted volume false positives

This commit is contained in:
Brad Rydzewski
2021-01-08 10:32:39 -05:00
parent 77684a5864
commit ea74fa2ba4
2 changed files with 31 additions and 11 deletions

View File

@@ -198,3 +198,23 @@ func Test_removeCloneDeps_CloneEnabled(t *testing.T) {
t.Log(diff)
}
}
func TestIsRestricedVolume(t *testing.T) {
tests := map[string]bool{
"/var/run": true,
"//var/run": true,
"/var/run/": true,
"/var/run/.": true,
"/var/run//": true,
"/var/run/test/..": true,
"/var/./run": true,
"/": true,
"/drone": false,
"/drone/var/run": false,
}
for path, ok := range tests {
if got, want := isRestrictedVolume(path), ok; got != want {
t.Errorf("Want restriced %v for path %q", want, path)
}
}
}