mirror of
https://github.com/containers/podman.git
synced 2025-06-17 23:20:59 +08:00
utils: new conversion method
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -88,3 +89,30 @@ func TestParseInputTime(t *testing.T) {
|
||||
|
||||
assert.Equal(t, expected, tm)
|
||||
}
|
||||
|
||||
func TestConvertMappings(t *testing.T) {
|
||||
start := []specs.LinuxIDMapping{
|
||||
{
|
||||
ContainerID: 1,
|
||||
HostID: 2,
|
||||
Size: 3,
|
||||
},
|
||||
{
|
||||
ContainerID: 4,
|
||||
HostID: 5,
|
||||
Size: 6,
|
||||
},
|
||||
}
|
||||
|
||||
converted := RuntimeSpecToIDtools(start)
|
||||
|
||||
convertedBack := IDtoolsToRuntimeSpec(converted)
|
||||
|
||||
assert.Equal(t, len(start), len(convertedBack))
|
||||
|
||||
for i := range start {
|
||||
assert.Equal(t, start[i].ContainerID, convertedBack[i].ContainerID)
|
||||
assert.Equal(t, start[i].HostID, convertedBack[i].HostID)
|
||||
assert.Equal(t, start[i].Size, convertedBack[i].Size)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user