mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 23:16:22 +00:00
Do not rewrite SELinux labels on volume mounts
This commit is contained in:
19
util/util_test.go
Normal file
19
util/util_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRemoveZFromBinds(t *testing.T) {
|
||||
binds := []string{"/etc/kubernetes:/etc/kubernetes:z", "/var/log/kube-audit:/var/log/kube-audit:rw,z", "/var/lib/test:/var/lib/test:Z,ro", "/usr/local/lib/test:/usr/local/lib/test:ro,z,noexec", "/etc/normalz:/etc/normalz"}
|
||||
expectedBinds := []string{"/etc/kubernetes:/etc/kubernetes", "/var/log/kube-audit:/var/log/kube-audit:rw", "/var/lib/test:/var/lib/test:ro", "/usr/local/lib/test:/usr/local/lib/test:ro,noexec", "/etc/normalz:/etc/normalz"}
|
||||
|
||||
removedBinds := RemoveZFromBinds(binds)
|
||||
assert.ElementsMatch(t, expectedBinds, removedBinds)
|
||||
|
||||
emptyBinds, expectedEmptyBinds := []string{}, []string{}
|
||||
removedEmptyBinds := RemoveZFromBinds(emptyBinds)
|
||||
assert.ElementsMatch(t, expectedEmptyBinds, removedEmptyBinds)
|
||||
}
|
Reference in New Issue
Block a user