@@ -83,7 +83,7 @@ var _ = BeforeSuite(func() {
83
83
84
84
})
85
85
86
- func WaitForIronic (name types.NamespacedName ) * metal3api.Ironic {
86
+ func WaitForIronic (name types.NamespacedName , distributed bool ) * metal3api.Ironic {
87
87
GinkgoHelper ()
88
88
89
89
ironic := & metal3api.Ironic {}
@@ -98,8 +98,19 @@ func WaitForIronic(name types.NamespacedName) *metal3api.Ironic {
98
98
if cond != nil && cond .Status == metav1 .ConditionTrue {
99
99
return true
100
100
}
101
-
102
101
GinkgoWriter .Printf ("Current status of Ironic: %+v\n " , ironic )
102
+
103
+ serviceName := fmt .Sprintf ("%s-service" , name .Name )
104
+ if distributed {
105
+ deploy , err := clientset .AppsV1 ().DaemonSets (name .Namespace ).Get (ctx , serviceName , metav1.GetOptions {})
106
+ Expect (err ).NotTo (HaveOccurred ())
107
+ GinkgoWriter .Printf ("... status of DaemonSet: %+v\n " , deploy )
108
+ } else {
109
+ deploy , err := clientset .AppsV1 ().Deployments (name .Namespace ).Get (ctx , serviceName , metav1.GetOptions {})
110
+ Expect (err ).NotTo (HaveOccurred ())
111
+ GinkgoWriter .Printf ("... status of Deployment: %+v\n " , deploy )
112
+ }
113
+
103
114
return false
104
115
}).WithTimeout (15 * time .Minute ).WithPolling (10 * time .Second ).Should (BeTrue ())
105
116
@@ -180,7 +191,45 @@ var _ = Describe("Ironic object tests", func() {
180
191
DeleteAndWait (ironic )
181
192
})
182
193
183
- ironic = WaitForIronic (name )
194
+ ironic = WaitForIronic (name , false )
195
+ VerifyIronic (ironic )
196
+ })
197
+
198
+ It ("creates distributed Ironic" , func () {
199
+ name := types.NamespacedName {
200
+ Name : "test-ironic" ,
201
+ Namespace : namespace ,
202
+ }
203
+
204
+ ironicDb := & metal3api.IronicDatabase {
205
+ ObjectMeta : metav1.ObjectMeta {
206
+ Name : fmt .Sprintf ("%s-db" , name .Name ),
207
+ Namespace : name .Namespace ,
208
+ },
209
+ }
210
+
211
+ err := k8sClient .Create (ctx , ironicDb )
212
+ Expect (err ).NotTo (HaveOccurred ())
213
+
214
+ ironic := & metal3api.Ironic {
215
+ ObjectMeta : metav1.ObjectMeta {
216
+ Name : name .Name ,
217
+ Namespace : name .Namespace ,
218
+ },
219
+ Spec : metal3api.IronicSpec {
220
+ DatabaseRef : corev1.LocalObjectReference {
221
+ Name : ironicDb .Name ,
222
+ },
223
+ Distributed : true ,
224
+ },
225
+ }
226
+ err = k8sClient .Create (ctx , ironic )
227
+ Expect (err ).NotTo (HaveOccurred ())
228
+ DeferCleanup (func () {
229
+ DeleteAndWait (ironic )
230
+ })
231
+
232
+ ironic = WaitForIronic (name , true )
184
233
VerifyIronic (ironic )
185
234
})
186
235
})
0 commit comments