|
|
|
|
@ -49,7 +49,8 @@ func testPlatformPolicy() PlatformNetworkPolicySnapshot {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestBuildDomainXMLUsesQ35UEFIWithSecureBootDisabled(t *testing.T) {
|
|
|
|
|
document, err := BuildDomainXML(validDomainDefinition())
|
|
|
|
|
definition := validDomainDefinition()
|
|
|
|
|
document, err := BuildDomainXML(definition)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
@ -60,10 +61,10 @@ func TestBuildDomainXMLUsesQ35UEFIWithSecureBootDisabled(t *testing.T) {
|
|
|
|
|
if domain.OS == nil || domain.OS.Type == nil || domain.OS.Type.Machine != "q35" {
|
|
|
|
|
t.Fatalf("machine is not q35: %#v", domain.OS)
|
|
|
|
|
}
|
|
|
|
|
if domain.OS.Loader == nil || domain.OS.Loader.Type != "pflash" || domain.OS.Loader.Secure != "no" {
|
|
|
|
|
t.Fatalf("loader does not explicitly disable secure boot: %#v", domain.OS.Loader)
|
|
|
|
|
if domain.OS.Loader == nil || domain.OS.Loader.Path != definition.Firmware.Loader || domain.OS.Loader.Type != "pflash" || domain.OS.Loader.Readonly != "yes" || domain.OS.Loader.Secure != "no" {
|
|
|
|
|
t.Fatalf("loader does not pin the configured non-Secure-Boot pflash firmware: %#v", domain.OS.Loader)
|
|
|
|
|
}
|
|
|
|
|
if domain.OS.NVRam == nil || domain.OS.NVRam.Template == "" || domain.OS.NVRam.NVRam == "" {
|
|
|
|
|
if domain.OS.NVRam == nil || domain.OS.NVRam.Template != definition.Firmware.NVRAMTemplate || domain.OS.NVRam.NVRam != definition.Firmware.NVRAMPath {
|
|
|
|
|
t.Fatalf("NVRAM is incomplete: %#v", domain.OS.NVRam)
|
|
|
|
|
}
|
|
|
|
|
if domain.Features == nil || domain.Features.SMM == nil || domain.Features.SMM.State != "off" {
|
|
|
|
|
@ -92,12 +93,8 @@ func TestBuildDomainXMLUsesQ35UEFIWithSecureBootDisabled(t *testing.T) {
|
|
|
|
|
if domain.Devices.MemBalloon == nil || domain.Devices.MemBalloon.Model != "virtio" || domain.Devices.MemBalloon.FreePageReporting != "on" || domain.Devices.MemBalloon.Stats == nil || domain.Devices.MemBalloon.Stats.Period != 10 {
|
|
|
|
|
t.Fatalf("virtio balloon telemetry is incomplete: %#v", domain.Devices.MemBalloon)
|
|
|
|
|
}
|
|
|
|
|
features := map[string]string{}
|
|
|
|
|
for _, feature := range domain.OS.FirmwareInfo.Features {
|
|
|
|
|
features[feature.Name] = feature.Enabled
|
|
|
|
|
}
|
|
|
|
|
if features["secure-boot"] != "no" || features["enrolled-keys"] != "no" {
|
|
|
|
|
t.Fatalf("firmware features = %#v", features)
|
|
|
|
|
if domain.OS.Firmware != "" || domain.OS.FirmwareInfo != nil || strings.Contains(document, "<firmware>") {
|
|
|
|
|
t.Fatalf("manual firmware must not request autoselection features: %#v", domain.OS)
|
|
|
|
|
}
|
|
|
|
|
if strings.Contains(document, "escaped <description>") || !strings.Contains(document, "<description> & safe") {
|
|
|
|
|
t.Fatalf("description was not XML escaped: %s", document)
|
|
|
|
|
|