44package controllers_test
55
66import (
7+ "time"
8+
79 "github.com/digitalocean/go-libvirt"
810 "github.com/ironcore-dev/libvirt-provider/api"
911 libvirtutils "github.com/ironcore-dev/libvirt-provider/internal/libvirt/utils"
@@ -56,8 +58,9 @@ var _ = Describe("MachineController", func() {
5658
5759 })
5860
59- It ("should handle machine without boot image, but with volume and network interface" , func (ctx SpecContext ) {
60- By ("creating a machine with volume and network interface" )
61+ It ("should handle machine with boot image and network interface" , func (ctx SpecContext ) {
62+ By ("creating a machine with boot image and network interface" )
63+ image := osImage
6164 machine , err := createMachine (api.MachineSpec {
6265 Power : api .PowerStatePowerOn ,
6366 Cpu : 2 ,
@@ -66,7 +69,7 @@ var _ = Describe("MachineController", func() {
6669 {
6770 Name : "disk-1" ,
6871 LocalDisk : & api.LocalDiskSpec {
69- Size : emptyDiskSize ,
72+ Image : & image ,
7073 },
7174 Device : "oda" ,
7275 },
@@ -97,7 +100,7 @@ var _ = Describe("MachineController", func() {
97100 Eventually (func () error {
98101 domain , err = libvirtConn .DomainLookupByUUID (libvirtutils .UUIDStringToBytes (machine .ID ))
99102 return err
100- }).Should (Succeed ())
103+ }).WithTimeout ( 5 * time . Minute ). WithPolling ( 5 * time . Second ). Should (Succeed ())
101104 domainXMLData , err := libvirtConn .DomainGetXMLDesc (domain , 0 )
102105 Expect (err ).NotTo (HaveOccurred ())
103106 Expect (domainXMLData ).NotTo (BeEmpty ())
@@ -116,12 +119,11 @@ var _ = Describe("MachineController", func() {
116119 return & m .Status
117120 }).Should (SatisfyAll (
118121 HaveField ("ImageRef" , BeEmpty ()),
119- HaveField ("VolumeStatus" , ContainElement (api.VolumeStatus {
120- Name : "disk-1" ,
121- Handle : "libvirt-provider.ironcore.dev/local-disk/disk-1" ,
122- State : api .VolumeStateAttached ,
123- Size : emptyDiskSize ,
124- })),
122+ HaveField ("VolumeStatus" , ContainElement (SatisfyAll (
123+ HaveField ("Name" , Equal ("disk-1" )),
124+ HaveField ("Handle" , Equal ("libvirt-provider.ironcore.dev/local-disk/disk-1" )),
125+ HaveField ("State" , Equal (api .VolumeStateAttached )),
126+ ))),
125127 HaveField ("NetworkInterfaceStatus" , ContainElement (api.NetworkInterfaceStatus {
126128 Name : "nic-1" ,
127129 State : api .NetworkInterfaceStateAttached ,
0 commit comments