github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/specgen/specgen_test.go (about)

     1  package specgen
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestNewSpecGeneratorWithRootfs(t *testing.T) {
    10  	tests := []struct {
    11  		rootfs                string
    12  		expectedRootfsOverlay bool
    13  		expectedRootfs        string
    14  	}{
    15  		{"/root/a:b:O", true, "/root/a:b"},
    16  		{"/root/a:b/c:O", true, "/root/a:b/c"},
    17  		{"/root/a:b/c:", false, "/root/a:b/c:"},
    18  		{"/root/a/b", false, "/root/a/b"},
    19  	}
    20  	for _, args := range tests {
    21  		val := NewSpecGenerator(args.rootfs, true)
    22  		assert.Equal(t, val.RootfsOverlay, args.expectedRootfsOverlay)
    23  		assert.Equal(t, val.Rootfs, args.expectedRootfs)
    24  	}
    25  }