fix(digest): check container image info for nil (#1027)

This commit is contained in:
nils måsén 2021-07-25 12:44:29 +02:00 committed by GitHub
parent 7221704638
commit 9bb8991a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -43,6 +43,11 @@ func CreateMockContainer(id string, name string, image string, created time.Time
// CreateMockContainerWithImageInfo should only be used for testing
func CreateMockContainerWithImageInfo(id string, name string, image string, created time.Time, imageInfo types.ImageInspect) container.Container {
return CreateMockContainerWithImageInfoP(id, name, image, created, &imageInfo)
}
// CreateMockContainerWithImageInfoP should only be used for testing
func CreateMockContainerWithImageInfoP(id string, name string, image string, created time.Time, imageInfo *types.ImageInspect) container.Container {
content := types.ContainerJSON{
ContainerJSONBase: &types.ContainerJSONBase{
ID: id,
@ -57,7 +62,7 @@ func CreateMockContainerWithImageInfo(id string, name string, image string, crea
}
return *container.NewContainer(
&content,
&imageInfo,
imageInfo,
)
}