mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 14:13:58 +08:00
e3e7c47123
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
38 lines
786 B
Go
38 lines
786 B
Go
// +build linux
|
|
|
|
package libcontainer
|
|
|
|
import "testing"
|
|
|
|
func TestCheckMountDestOnProc(t *testing.T) {
|
|
dest := "/rootfs/proc/"
|
|
err := checkMountDestination("/rootfs", dest)
|
|
if err == nil {
|
|
t.Fatal("destination inside proc should return an error")
|
|
}
|
|
}
|
|
|
|
func TestCheckMountDestInSys(t *testing.T) {
|
|
dest := "/rootfs//sys/fs/cgroup"
|
|
err := checkMountDestination("/rootfs", dest)
|
|
if err == nil {
|
|
t.Fatal("destination inside proc should return an error")
|
|
}
|
|
}
|
|
|
|
func TestCheckMountDestFalsePositive(t *testing.T) {
|
|
dest := "/rootfs/sysfiles/fs/cgroup"
|
|
err := checkMountDestination("/rootfs", dest)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestCheckMountRoot(t *testing.T) {
|
|
dest := "/rootfs"
|
|
err := checkMountDestination("/rootfs", dest)
|
|
if err == nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|