diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-05 15:38:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 15:38:11 -0400 |
commit | 404bc2684edd14b20d02d8cd05ca3e6b6ee8888d (patch) | |
tree | 44d917aef41b2b1d6c1a2514184510f2ae0bdcb2 /pkg/specgen/generate/config_linux_test.go | |
parent | 0bd5da5b7fe0aad31d795cf5bea1b37c9053f791 (diff) | |
parent | 4fd1965ab4d1395b5cc4a0e03526ef9c43f794ec (diff) | |
download | podman-404bc2684edd14b20d02d8cd05ca3e6b6ee8888d.tar.gz podman-404bc2684edd14b20d02d8cd05ca3e6b6ee8888d.tar.bz2 podman-404bc2684edd14b20d02d8cd05ca3e6b6ee8888d.zip |
Merge pull request #10185 from rhatdan/volume
Add filepath glob support to --security-opt unmask
Diffstat (limited to 'pkg/specgen/generate/config_linux_test.go')
-rw-r--r-- | pkg/specgen/generate/config_linux_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/specgen/generate/config_linux_test.go b/pkg/specgen/generate/config_linux_test.go new file mode 100644 index 000000000..39973324b --- /dev/null +++ b/pkg/specgen/generate/config_linux_test.go @@ -0,0 +1,28 @@ +package generate + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestShouldMask(t *testing.T) { + tests := []struct { + mask string + unmask []string + shouldMask bool + }{ + {"/proc/foo", []string{"all"}, false}, + {"/proc/foo", []string{"ALL"}, false}, + {"/proc/foo", []string{"/proc/foo"}, false}, + {"/proc/foo", []string{"/proc/*"}, false}, + {"/proc/foo", []string{"/proc/bar", "all"}, false}, + {"/proc/foo", []string{"/proc/f*"}, false}, + {"/proc/foo", []string{"/proc/b*"}, true}, + {"/proc/foo", []string{}, true}, + } + for _, test := range tests { + val := shouldMask(test.mask, test.unmask) + assert.Equal(t, val, test.shouldMask) + } +} |