Use IsRestrictedVolume from runner-go

This commit is contained in:
Marko Gaćeša
2021-06-30 14:52:05 +02:00
parent e4064e6260
commit 3c1bfd3a84
3 changed files with 5 additions and 50 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/drone-runners/drone-runner-docker/engine"
"github.com/drone-runners/drone-runner-docker/engine/resource"
"github.com/drone/runner-go/manifest"
"github.com/google/go-cmp/cmp"
@@ -198,23 +199,3 @@ 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)
}
}
}