@@ -18,7 +18,7 @@ import (
1818
1919var _ = FDescribe ("UpdateVolume" , func () {
2020 It ("should correctly update machine volume" , func (ctx SpecContext ) {
21- By ("creating a machine with empty disks and single ceph volume" )
21+ By ("creating a machine with ceph volume" )
2222 createResp , err := machineClient .CreateMachine (ctx , & iri.CreateMachineRequest {
2323 Machine : & iri.Machine {
2424 Metadata : & irimeta.ObjectMetadata {
@@ -33,16 +33,9 @@ var _ = FDescribe("UpdateVolume", func() {
3333 },
3434 Class : machineClassx3xlarge ,
3535 Volumes : []* iri.Volume {
36- {
37- Name : "disk-1" ,
38- EmptyDisk : & iri.EmptyDisk {
39- SizeBytes : emptyDiskSize ,
40- },
41- Device : "oda" ,
42- },
4336 {
4437 Name : "volume-1" ,
45- Device : "odc " ,
38+ Device : "oda " ,
4639 Connection : & iri.VolumeConnection {
4740 Driver : "ceph" ,
4841 Handle : "dummy" ,
@@ -106,11 +99,6 @@ var _ = FDescribe("UpdateVolume", func() {
10699 return listResp .Machines [0 ].Status
107100 }).Should (SatisfyAll (
108101 HaveField ("Volumes" , ContainElements (
109- & iri.VolumeStatus {
110- Name : "disk-1" ,
111- Handle : "libvirt-provider.ironcore.dev/empty-disk/disk-1" ,
112- State : iri .VolumeState_VOLUME_ATTACHED ,
113- },
114102 & iri.VolumeStatus {
115103 Name : "volume-1" ,
116104 Handle : "libvirt-provider.ironcore.dev/ceph/libvirt-provider.ironcore.dev/ceph^dummy" ,
@@ -128,9 +116,8 @@ var _ = FDescribe("UpdateVolume", func() {
128116 g .Expect (domainXML .Unmarshal (domainXMLData )).Should (Succeed ())
129117 disks = domainXML .Devices .Disks
130118 return len (disks )
131- }).Should (Equal (3 ))
119+ }).Should (Equal (2 ))
132120 Expect (disks [0 ].Serial ).To (HavePrefix ("oda" ))
133- Expect (disks [1 ].Serial ).To (HavePrefix ("odc" ))
134121
135122 // wait to complete machine reconciliation
136123 time .Sleep (20 * time .Second )
@@ -140,7 +127,7 @@ var _ = FDescribe("UpdateVolume", func() {
140127 MachineId : createResp .Machine .Metadata .Id ,
141128 Volume : & iri.Volume {
142129 Name : "volume-1" ,
143- Device : "odc " ,
130+ Device : "oda " ,
144131 Connection : & iri.VolumeConnection {
145132 Driver : "ceph" ,
146133 Handle : "dummy" ,
@@ -159,12 +146,11 @@ var _ = FDescribe("UpdateVolume", func() {
159146 Expect (err ).NotTo (HaveOccurred ())
160147 Expect (updateVolumeResp ).NotTo (BeNil ())
161148
162- By ("ensuring volume-1 is updated" )
163149 // wait to complete machine reconciliation
164150 time .Sleep (20 * time .Second )
165151
166152 By ("ensuring volume-1 has been updated in machine spec field" )
167- Eventually (func (g Gomega ) * iri.MachineSpec {
153+ Eventually (func (g Gomega ) * iri.Volume {
168154 listResp , err := machineClient .ListMachines (ctx , & iri.ListMachinesRequest {
169155 Filter : & iri.MachineFilter {
170156 Id : createResp .Machine .Metadata .Id ,
@@ -173,33 +159,11 @@ var _ = FDescribe("UpdateVolume", func() {
173159 g .Expect (err ).NotTo (HaveOccurred ())
174160 g .Expect (listResp .Machines ).NotTo (BeEmpty ())
175161 g .Expect (listResp .Machines ).Should (HaveLen (1 ))
176- return listResp .Machines [0 ].Spec
162+ return listResp .Machines [0 ].Spec . Volumes [ 0 ]
177163 }).Should (SatisfyAll (
178- HaveField ("Volumes" , ContainElements (
179- & iri.Volume {
180- Name : "disk-1" ,
181- EmptyDisk : & iri.EmptyDisk {
182- SizeBytes : emptyDiskSize ,
183- },
184- Device : "oda" ,
185- },
186- & iri.Volume {
187- Name : "volume-1" ,
188- Device : "odc" ,
189- Connection : & iri.VolumeConnection {
190- Driver : "ceph" ,
191- Handle : "dummy" ,
192- Attributes : map [string ]string {
193- "image" : cephImage ,
194- "monitors" : cephMonitors ,
195- },
196- SecretData : map [string ][]byte {
197- "userID" : []byte (cephUsername ),
198- "userKey" : []byte (cephUserkey ),
199- },
200- EffectiveStorageBytes : resource .NewQuantity (2 * 1024 * 1024 * 1024 , resource .BinarySI ).Value (),
201- },
202- })),
164+ HaveField ("Name" , Equal ("volume-1" )),
165+ HaveField ("Device" , Equal ("oda" )),
166+ HaveField ("Connection.EffectiveStorageBytes" , Equal (resource .NewQuantity (2 * 1024 * 1024 * 1024 , resource .BinarySI ).Value ())),
203167 ))
204168 })
205169})
0 commit comments