summaryrefslogtreecommitdiff
path: root/pkg/specgen/specgen_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-11 19:52:13 +0200
committerGitHub <noreply@github.com>2021-10-11 19:52:13 +0200
commit00ebf3cf1885fc95c3c36021e717db1f1e7d63be (patch)
tree46d5e51466495e19c092edc646d3c398a65ae3e9 /pkg/specgen/specgen_test.go
parentdd9c9172af28942cada45d7e0b63343abf863601 (diff)
parent54471acba8fa6a6298615cff9c2130d9c3bc7b2c (diff)
downloadpodman-00ebf3cf1885fc95c3c36021e717db1f1e7d63be.tar.gz
podman-00ebf3cf1885fc95c3c36021e717db1f1e7d63be.tar.bz2
podman-00ebf3cf1885fc95c3c36021e717db1f1e7d63be.zip
Merge pull request #11912 from chenk008/fix_roofs_path_contains_colon
support rootfs contains colon
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..b838d9d30
--- /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.expectedRootfsOverlay)
+ assert.Equal(t, val.Rootfs, args.expectedRootfs)
+ }
+}