cri-o/cmd/kpod/imagePushData_test.go
Ryan Cole 680f7a6106 Add kpod push command
Push an image to a specified location, such as to an atomic registry
or a local directory

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-20 11:12:40 -04:00

40 lines
1 KiB
Go

package main
import (
"bytes"
"fmt"
)
// We have to compare the structs manually because they contain
// []byte variables, which cannot be compared with "=="
func compareImagePushData(a, b *imagePushData) bool {
if a.store != b.store {
fmt.Println("store")
return false
} else if a.Type != b.Type {
fmt.Println("type")
return false
} else if a.FromImage != b.FromImage {
fmt.Println("FromImage")
return false
} else if a.FromImageID != b.FromImageID {
fmt.Println("FromImageID")
return false
} else if !bytes.Equal(a.Config, b.Config) {
fmt.Println("Config")
return false
} else if !bytes.Equal(a.Manifest, b.Manifest) {
fmt.Println("Manifest")
return false
} else if fmt.Sprint(a.ImageAnnotations) != fmt.Sprint(b.ImageAnnotations) {
fmt.Println("Annotations")
return false
} else if a.ImageCreatedBy != b.ImageCreatedBy {
fmt.Println("ImageCreatedBy")
return false
} else if fmt.Sprintf("%+v", a.OCIv1) != fmt.Sprintf("%+v", b.OCIv1) {
fmt.Println("OCIv1")
return false
}
return true
}