add Images testcase
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
This commit is contained in:
parent
48cce22933
commit
832f39c2ed
1 changed files with 34 additions and 0 deletions
|
@ -2,6 +2,7 @@ package image
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -54,6 +55,39 @@ func TestMarshalKeyOrder(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestImage(t *testing.T) {
|
||||
cid := "50a16564e727"
|
||||
config := &container.Config{
|
||||
Hostname: "hostname",
|
||||
Domainname: "domain",
|
||||
User: "root",
|
||||
}
|
||||
platform := runtime.GOOS
|
||||
|
||||
img := &Image{
|
||||
V1Image: V1Image{
|
||||
Config: config,
|
||||
},
|
||||
computedID: ID(cid),
|
||||
}
|
||||
|
||||
assert.Equal(t, cid, img.ImageID())
|
||||
assert.Equal(t, cid, img.ID().String())
|
||||
assert.Equal(t, platform, img.Platform())
|
||||
assert.Equal(t, config, img.RunConfig())
|
||||
}
|
||||
|
||||
func TestImagePlatformNotEmpty(t *testing.T) {
|
||||
platform := "platform"
|
||||
img := &Image{
|
||||
V1Image: V1Image{
|
||||
OS: platform,
|
||||
},
|
||||
OSVersion: "osversion",
|
||||
}
|
||||
assert.Equal(t, platform, img.Platform())
|
||||
}
|
||||
|
||||
func TestNewChildImageFromImageWithRootFS(t *testing.T) {
|
||||
rootFS := NewRootFS()
|
||||
rootFS.Append(layer.DiffID("ba5e"))
|
||||
|
|
Loading…
Reference in a new issue