Documentation ¶
Overview ¶
Package boottest contains methods for comparing boot.OSImages to each other and to JSON representations of themselves for use in tests.
The JSON representation for boot.OSImages is special because the built-in json.Marshal function cannot marshal interfaces such as io.ReaderAt nicely, especially when the underlying members in structs used (such as *os.File or curl.lazyFile) are not exported.
They are not json.Marshalers as part of boot.OSImage itself because they're not a fully accurate representation of an OSImage, not including file contents and depending for example on the current working directory of the calling process.
Index ¶
- func CompareImagesToJSON(imgs []boot.OSImage, jsonEncoded []byte) error
- func ImagesToJSONLike(imgs []boot.OSImage) []interface{}
- func LinuxImageToJSON(li *boot.LinuxImage) map[string]interface{}
- func MultibootImageToJSON(mi *boot.MultibootImage) map[string]interface{}
- func SameBootImage(got, want boot.OSImage) error
- func ToJSONFile(imgs []boot.OSImage, filename string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareImagesToJSON ¶
CompareImagesToJSON compares the names, cmdlines, and file URLs in imgs to the ones stored in jsonEncoded.
You can obtain such a JSON encoding with ToJSONFile.
func ImagesToJSONLike ¶
ImagesToJSONLike spits out a json-convertible reproducible representation of the given boot images. This can be used in configuration parser tests (when the content of the images doesn't matter, but the file URLs, cmdlines, names, etc.)
The JSON representation for boot.OSImages is special because the built-in json.Marshal function cannot marshal interfaces such as io.ReaderAt nicely, especially when the underlying structs used are not exported.
func LinuxImageToJSON ¶
func LinuxImageToJSON(li *boot.LinuxImage) map[string]interface{}
LinuxImageToJSON is implemented only in order to compare LinuxImages in tests.
It should be json-encodable and decodable.
func MultibootImageToJSON ¶
func MultibootImageToJSON(mi *boot.MultibootImage) map[string]interface{}
MultibootImageToJSON is implemented only in order to compare MultibootImages in tests.
It should be json-encodable and decodable.
func SameBootImage ¶
SameBootImage compares the contents of given boot images, but not the underlying URLs.
Works for Linux and Multiboot images.
Types ¶
This section is empty.