mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Support readonly rootfs contains colon
Fix: https://github.com/containers/podman/issues/11913 Signed-off-by: chenkang <kongchen28@gmail.com>
This commit is contained in:
25
pkg/specgen/specgen_test.go
Normal file
25
pkg/specgen/specgen_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
package specgen
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewSpecGeneratorWithRootfs(t *testing.T) {
|
||||
tests := []struct {
|
||||
rootfs string
|
||||
expectedRootfsOverlay bool
|
||||
expectedRootfs string
|
||||
}{
|
||||
{"/root/a:b:O", true, "/root/a:b"},
|
||||
{"/root/a:b/c:O", true, "/root/a:b/c"},
|
||||
{"/root/a:b/c:", false, "/root/a:b/c:"},
|
||||
{"/root/a/b", false, "/root/a/b"},
|
||||
}
|
||||
for _, args := range tests {
|
||||
val := NewSpecGenerator(args.rootfs, true)
|
||||
assert.Equal(t, val.RootfsOverlay, args.rootfs)
|
||||
assert.Equal(t, val.Rootfs, args.rootfs)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user