Skip to content

Commit 0dc06cc

Browse files
committed
test: cover spice listen readback preservation
Refs: #1289
1 parent 552eaba commit 0dc06cc

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

internal/generated/conversion_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,48 @@ func TestDomainCPUModePreservesPlanValue(t *testing.T) {
259259
}
260260
}
261261

262+
func TestDomainGraphicSpiceListenPreservesPlanValueWhenXMLListenIsOmitted(t *testing.T) {
263+
ctx := context.Background()
264+
265+
plan := &DomainGraphicSpiceModel{
266+
Port: types.Int64Null(),
267+
TLSPort: types.Int64Null(),
268+
AutoPort: types.BoolNull(),
269+
Listen: types.StringValue("0.0.0.0"),
270+
Keymap: types.StringNull(),
271+
DefaultMode: types.StringNull(),
272+
Passwd: types.StringNull(),
273+
PasswdValidTo: types.StringNull(),
274+
Connected: types.StringNull(),
275+
Listeners: types.ListNull(types.ObjectType{AttrTypes: DomainGraphicListenerAttributeTypes()}),
276+
Channel: types.ListNull(types.ObjectType{AttrTypes: DomainGraphicSpiceChannelAttributeTypes()}),
277+
Image: types.ObjectNull(DomainGraphicSpiceImageAttributeTypes()),
278+
JPEG: types.ObjectNull(DomainGraphicSpiceJPEGAttributeTypes()),
279+
ZLib: types.ObjectNull(DomainGraphicSpiceZLibAttributeTypes()),
280+
Playback: types.ObjectNull(DomainGraphicSpicePlaybackAttributeTypes()),
281+
Streaming: types.ObjectNull(DomainGraphicSpiceStreamingAttributeTypes()),
282+
Mouse: types.ObjectNull(DomainGraphicSpiceMouseAttributeTypes()),
283+
ClipBoard: types.ObjectNull(DomainGraphicSpiceClipBoardAttributeTypes()),
284+
FileTransfer: types.ObjectNull(DomainGraphicSpiceFileTransferAttributeTypes()),
285+
GL: types.ObjectNull(DomainGraphicSpiceGLAttributeTypes()),
286+
}
287+
288+
xmlSpice := &libvirtxml.DomainGraphicSpice{}
289+
290+
model, err := DomainGraphicSpiceFromXML(ctx, xmlSpice, plan)
291+
if err != nil {
292+
t.Fatalf("DomainGraphicSpiceFromXML failed: %v", err)
293+
}
294+
295+
if model.Listen.IsNull() {
296+
t.Fatal("Listen should not be null")
297+
}
298+
299+
if got := model.Listen.ValueString(); got != "0.0.0.0" {
300+
t.Fatalf("expected listen 0.0.0.0 from plan, got %q", got)
301+
}
302+
}
303+
262304
func TestDomainAddressPCIZeroValues(t *testing.T) {
263305
ctx := context.Background()
264306

0 commit comments

Comments
 (0)