podman/pkg/spec/spec_test.go
Matthew Heon 6d52ebdd13 Add flag to add annotations to a container
Also add annotations from the image the container was created
from.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #886
Approved by: rhatdan
2018-06-04 17:52:28 +00:00

40 lines
955 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", "private"},
}
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]))
}