mirror of
https://github.com/containers/podman
synced 2024-10-21 01:34:37 +00:00
e2137cd009
This matches Docker behavior more closely and should resolve an issue we were seeing with /sys mounts Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #1465 Approved by: rhatdan
40 lines
956 B
Go
40 lines
956 B
Go
package createconfig
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
spec "github.com/opencontainers/runtime-spec/specs-go"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreateConfig_GetVolumeMounts(t *testing.T) {
|
|
data := spec.Mount{
|
|
Destination: "/foobar",
|
|
Type: "bind",
|
|
Source: "foobar",
|
|
Options: []string{"ro", "rbind", "rprivate"},
|
|
}
|
|
config := CreateConfig{
|
|
Volumes: []string{"foobar:/foobar:ro"},
|
|
}
|
|
specMount, err := config.GetVolumeMounts([]spec.Mount{})
|
|
assert.NoError(t, err)
|
|
assert.True(t, reflect.DeepEqual(data, specMount[0]))
|
|
}
|
|
|
|
func TestCreateConfig_GetTmpfsMounts(t *testing.T) {
|
|
data := spec.Mount{
|
|
Destination: "/homer",
|
|
Type: "tmpfs",
|
|
Source: "tmpfs",
|
|
Options: []string{"rw", "size=787448k", "mode=1777"},
|
|
}
|
|
config := CreateConfig{
|
|
Tmpfs: []string{"/homer:rw,size=787448k,mode=1777"},
|
|
}
|
|
tmpfsMount := config.GetTmpfsMounts()
|
|
assert.True(t, reflect.DeepEqual(data, tmpfsMount[0]))
|
|
|
|
}
|