summaryrefslogtreecommitdiff
path: root/pkg/specgen/specgen_test.go
diff options
context:
space:
mode:
authorchenkang <kongchen28@gmail.com>2021-10-11 09:17:57 +0800
committerchenkang <kongchen28@gmail.com>2021-10-11 17:26:30 +0800
commitdd5975f3d579e64493f9b005eb304b86c478829e (patch)
tree9754d8e23c6e337b8642df049b9177857813e946 /pkg/specgen/specgen_test.go
parentea868933e8c014ac52192f397f5dc1c3e8ee375a (diff)
downloadpodman-dd5975f3d579e64493f9b005eb304b86c478829e.tar.gz
podman-dd5975f3d579e64493f9b005eb304b86c478829e.tar.bz2
podman-dd5975f3d579e64493f9b005eb304b86c478829e.zip
Support readonly rootfs contains colon
Fix: https://github.com/containers/podman/issues/11913 Signed-off-by: chenkang <kongchen28@gmail.com>
Diffstat (limited to 'pkg/specgen/specgen_test.go')
-rw-r--r--pkg/specgen/specgen_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/specgen/specgen_test.go b/pkg/specgen/specgen_test.go
new file mode 100644
index 000000000..8e00bd4b6
--- /dev/null
+++ b/pkg/specgen/specgen_test.go
@@ -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)
+ }
+}