aboutsummaryrefslogtreecommitdiff
path: root/pkg/specgen/specgen_test.go
blob: b838d9d30b176ca25dda19899664e411223d4bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
	}
}